適用場景
- 軟件升級
步驟
源端unplug pdb(連接到CDB$ROOT)
關閉PDB
alter pluggable database PDB1 close immediate;
alter pluggable database PDB1 close immediate instances=all;
將PDB元數據信息保存到xml文件
alter pluggable database PDB1 unplug into '/tmp/PDB1.xml';
XML文件中包含了每個數據文件的位置,以及初始化參數等信息
刪除PDB並保留數據文件
drop pluggable database PDB1 keep datafiles;
目標端創建pdb(連接到CDB$ROOT)
檢查驗證當前CDB環境是否滿足條件
set serveroutput on
DECLARE
compatible BOOLEAN := FALSE;
BEGIN
compatible := DBMS_PDB.CHECK_PLUG_COMPATIBILITY(
pdb_descr_file => '/tmp/PDB1.xml');
if compatible then
DBMS_OUTPUT.PUT_LINE('Is pluggable database compatible? YES');
else
DBMS_OUTPUT.PUT_LINE('Is pluggable database compatible? NO');
end if;
END;
/
使用xml文件創建PDB
create pluggable database PDB1 using '/tmp/PDB1.xml' NOCOPY;
打開PDB
alter pluggable database PDB1 open;
alter pluggable database PDB1 open instances=all;