Oracle 12c – Plug a PDB in a New CDB Without XML Manifest

multi-tenantoracle-12c

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?

Best Answer

you can recover the XML file of a not unplugged PDB.

  1. COPY the PDB folder into the CDB folder on the new machine.
  2. Connect as SYSDBA to the new CDB (I use SQLDeveloper)
  3. EXECUTE the package DBMS_PDB.RECOVER

it uses 3 parameters:

  1. /path/to/new/file.xml
  2. NAME_OF_PDB (you can use the same as OLD PDB or a NEW ONE)
  3. /path/to/pdb/folder/

EXAMPLE:

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;

SOURCE http://www.oraclebuffer.com/oracle/oracle-12c-lost-your-pdbs-xml-manifest-file-heres-how-you-can-recover-it/