There are several ways of creating a PDB:
See also the OCM12C topic, Create and manage pluggable databases
Run the following commands:
ALTER SESSION SET container = cdb$root;CREATE PLUGGABLE DATABASE plum ADMIN USER plummer IDENTIFIED BY "Christopher";ALTER PLUGGABLE DATABASE plum OPEN READ WRITE;CONNECT plummer/Christopher@localhost/plum.yaocm.id.auIn the JAR CDB, I ran the following commands to create VEGEMITE from JAM:
ALTER SESSION SET container = cdb$root;ALTER PLUGGABLE DATABASE jam CLOSE;ALTER PLUGGABLE DATABASE jam OPEN READ ONLY;CREATE PLUGGABLE DATABASE vegemite FROM jam;ALTER PLUGGABLE DATABASE vegemite OPEN;Note: No need for file name conversion because I am using OMF in JAR.
I created a database using the procedure in Create 12C Non-CDB Database Using OMF.
After connecting to CAN, I ran the following command:
exec dbms_pdb.describe('can_db.xml')After connecting to JAR, I ran the following PL/SQL block to verify that the export information in 'can_db.xml' was usable to create a PDB called BISCUIT in the JAR CDB:
SET SERVEROUTPUT ON SIZE UNLIMITEDBEGIN IF dbms_pdb.check_plug_compatibility('can_db.xml', 'biscuit') THEN dbms_output.put_line('Pluggable'); ELSE dbms_output.put_line('Not pluggable'); END IF;END;/The result was:
PluggableThe BISCUIT PDB is created from CAN as follows:
CREATE PLUGGABLE DATABASE biscuit USING 'can_db.xml';Then, the following script is used to do the conversion from non-CDB to PDB:
ALTER SESSION SET CONTAINER=biscuit;@?/rdbms/admin/noncdb_to_pdbHowever, this fails with ORA-600 as described in OERI kql_tab_diana While Running noncdb_to_pdb
The pluggable database, BISCUIT, is opened anyway, but is not usable because of the failed conversion.
Close the VEGEMITE PDB, unplug it, and drop it as follows:
ALTER SESSION SET container=cdb$root;ALTER PLUGGABLE DATABASE vegemite CLOSE;ALTER PLUGGABLE DATABASE vegemite UNPLUG INTO 'vegemite.xml';DROP PLUGGABLE DATABASE vegemite;Check the validity of the XML file as follows:
SET SERVEROUTPUT ON SIZE UNLIMITEDBEGIN IF dbms_pdb.check_plug_compatibility('vegemite.xml', 'VEGEMITE') THEN dbms_output.put_line('Pluggable'); ELSE dbms_output.put_line('Not pluggable'); END IF;END;/Plug the PDB back in, and open it as follows (NOCOPY is used because the data files are unchanged):
CREATE PLUGGABLE DATABASE vegemite USING 'vegemite.xml' NOCOPY;ALTER PLUGGABLE DATABASE vegemite OPEN READ WRITE;