Use SQL Developer to Create a PDB — Database 12cR2

Continuing along with the release of 12cR2, let’s quickly look at creating a PDB in the database. Now that we have a database installed fire up one of my favorite tools, SQL Developer and let’s get to work.

Note: These steps have not change from 12cR1, but maybe you haven’t seen that process either.

Create a connection to the database CDB with SQL Developer. The SID will be what you set up

Next we will open up the DBA view and create a connection here.

Choose DBA from the View menu: View → DBA

Select the connection you created you created earlier from the drop down

Open the DBA connection to the 12cR2 database and expand the Container Database

Right click on PDB1 and select Clone PDB…

Give your PDB a name. Also select Custom Names in the File Name Conversions dropdown section. If you have a specific naming convention, you can modify the Target File section. Take note of the Open Automatically checkbox, which will open the PDB immediately upon its creation.

BEGIN
EXECUTE IMMEDIATE 'CREATE PLUGGABLE DATABASE "dbaontap" FROM "PDB1"
STORAGE UNLIMITED TEMPFILE REUSE
FILE_NAME_CONVERT=(
''/u01/app/oracle/oradata/cdb1/pdb1/system01.dbf'', ''/u01/app/oracle/oradata/cdb1/pdb1/system0-dbaontap.dbf'',
''/u01/app/oracle/oradata/cdb1/pdb1/sysaux01.dbf'', ''/u01/app/oracle/oradata/cdb1/pdb1/sysaux0-dbaontap.dbf'',
''/u01/app/oracle/oradata/cdb1/pdb1/undotbs01.dbf'', ''/u01/app/oracle/oradata/cdb1/pdb1/undotbs0-dbaontap.dbf'',
''/u01/app/oracle/oradata/cdb1/pdb1/users01.dbf'', ''/u01/app/oracle/oradata/cdb1/pdb1/users0-dbaontap.dbf'',
''/u01/app/oracle/oradata/cdb1/pdb1/temp01.dbf'', ''/u01/app/oracle/oradata/cdb1/pdb1/temp0-dbaontap.dbf''
)';
EXECUTE IMMEDIATE 'ALTER PLUGGABLE DATABASE dbaontap OPEN READ WRITE';
END;

View of the same screen and SQL with the Open Automatically checkbox unchecked.

BEGIN
EXECUTE IMMEDIATE 'CREATE PLUGGABLE DATABASE "dbaontap" FROM "PDB1"
STORAGE UNLIMITED TEMPFILE REUSE
FILE_NAME_CONVERT=(
''/u01/app/oracle/oradata/cdb1/pdb1/system01.dbf'', ''/u01/app/oracle/oradata/cdb1/pdb1/system0-dbaontap.dbf'',
''/u01/app/oracle/oradata/cdb1/pdb1/sysaux01.dbf'', ''/u01/app/oracle/oradata/cdb1/pdb1/sysaux0-dbaontap.dbf'',
''/u01/app/oracle/oradata/cdb1/pdb1/undotbs01.dbf'', ''/u01/app/oracle/oradata/cdb1/pdb1/undotbs0-dbaontap.dbf'',
''/u01/app/oracle/oradata/cdb1/pdb1/users01.dbf'', ''/u01/app/oracle/oradata/cdb1/pdb1/users0-dbaontap.dbf'',
''/u01/app/oracle/oradata/cdb1/pdb1/temp01.dbf'', ''/u01/app/oracle/oradata/cdb1/pdb1/temp0-dbaontap.dbf''
)';
END;

Finally what I like to do is, right click on my shiny new PDB and Create Startup Trigger.

Finally, we will connect to the new PDB

SQL Developer

and SQLcl from my MacBook Pro

Enjoy!


Originally published at My Experiences with Oracle Technology.