There is a fancy new command to unplug a PDB in Oracle Database 188.8.131.52:
ALTER PLUGGABLE DATABASE pdb1 UNPLUG INTO 'pdb1.pdb';
The nice thing with this command differing in the file ending of ‘
pdb‘ instead of ‘
xml‘ as you used it in Oracle 12.1 (and the ‘
xml‘ option is still available of course): Instead of just creating an
xml description file it
zips everything together into a PDB archive.
SQL> show pdbs CON_ID CON_NAME OPEN MODE RESTRICTED ---------- ------------------------------ ---------- ---------- 2 PDB$SEED READ ONLY NO SQL> create pluggable database PDB1 admin user adm identified by adm 2 file_name_convert=('/u02/oradata/CDB2/pdbseed','/u02/oradata/CDB2/pdb1'); Pluggable database created. SQL> alter pluggable database pdb1 open; Pluggable database altered. SQL> alter pluggable database pdb1 close; Pluggable database altered. SQL> alter pluggable database pdb1 unplug into '/home/oracle/pdb1.pdb'; Pluggable database altered.
Now lets have a quick look into the created file:
-rw-r--r--. 1 oracle dba 108414 May 19 16:20 pdb1.pdb $ unzip pdb1.pdb Archive: pdb1.pdb inflating: system01.dbf inflating: sysaux01.dbf inflating: undotbs01.dbf warning: stripped absolute path spec from /home/oracle/pdb1.xml inflating: home/oracle/pdb1.xml
Not bad. Actually pretty cool.
Of course the same command fails in Oracle Database 184.108.40.206:
SQL> alter pluggable database pdb1 unplug into '/home/oracle/pdb1.pdb'; alter pluggable database pdb1 unplug into '/home/oracle/pdb1.pdb' * ERROR at line 1: ORA-65125: valid XML file name is required
Unfortunately there’s a significant flaw when your PDB is stored in ASM:
The zip file does not contain the datafiles of your PDB.
The fix is included since the July 2017 Update (RU) and in Oracle Database 18c.
A really handy feature – but don’t use it when your PDBs are located in ASM before Oracle 18c.
And be very aware that the larger your PDB is, the longer this will take. As the archive gets zip compressed, the “standard” way may be a bit more inconvenient but complete much faster. And NEVER … really NEVER …
CTRL-C it as this will damage the PDB. Your fallback then will be a restore and recover of the PDB (if your database runs in