In oracle 12c the ALTER PLUGGABLE DATABASE "PDB1" UNPLUG INTO 'PDB1.XML' statement create the XML manifest. Is it possible to plug a PDB in a new CDB if it isn't correctly unplugged first and the source CDB isn't active?
you can recover the XML file of a not unplugged PDB.
- COPY the PDB folder into the CDB folder on the new machine.
- Connect as SYSDBA to the new CDB (I use SQLDeveloper)
- EXECUTE the package DBMS_PDB.RECOVER
it uses 3 parameters:
- NAME_OF_PDB (you can use the same as OLD PDB or a NEW ONE)
BEGIN DBMS_PDB.RECOVER ( pdb_descr_file => '/path/to/new/file.xml.xml', pdb_name => 'NAME_OF_PDB', filenames => '/path/to/pdb/folder/' ); END; /
THEN, you can plug the database using:
CREATE PLUGGABLE DATABASE NAME_OF_PDB USING '/path/to/new/file.xml' NOCOPY TEMPFILE REUSE;
THEN open the PDB:
ALTER PLUGGABLE DATABASE NAME_OF_PDB OPEN FORCE;
IF PDB DON'T OPEN, check PDB_VIOLATIONS
SELECT * FROM PDB_PLUG_IN_VIOLATIONS;
If you want to keep the PDB in the source CDB, you do not need to unplug the PDB, you can just simply clone the PDB to another CDB:
- Have a user in the source PDB or CDB with the
CREATE PLUGGABLE DATABASEprivilege
- Open the source PDB in read-only mode
- In the target CDB, create a database link to the source PDB with the above user
- In the target CDB:
CREATE PLUGGABLE DATABASE pdbclone FROM pdbsource@dblink;
More details at: