f Oracle Plug / Unplug PDB 來更改資料庫名稱 ~ 迪貝之家

Oracle Plug / Unplug PDB 來更改資料庫名稱

為了以最短的時間弄出一個環境給AP
由於AP正在資料庫test PDB上進行測試
只好另建testsync PDB 透過OGG 同步資料
其實也是因為test 打補丁時出了一點問題
雖然後來解了
但AP還是心裡頭總有些疙瘩
我是沒差啦!!
趁這個機會測一下新功能

-- drop PDB test
alter pluggable database test close immediate;
DROP PLUGGABLE DATABASE test including datafiles;

-- testsync rename to test
alter pluggable database testsync close immediate;

ALTER PLUGGABLE DATABASE testsync UNPLUG INTO '/tmp/testsync.xml';

DROP PLUGGABLE DATABASE testsync KEEP DATAFILES;

 CREATE PLUGGABLE DATABASE test USING '/tmp/testsync.xml'
 FILE_NAME_CONVERT=('/oradata/testcdb/testsync/','/oradata/testcdb/test/')
  move

 TEMPFILE REUSE;

alter pluggable database test open;

Very GOOD!!好用~~~~