12cR2, Oracle

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 are not using OMF, you’ll have to select Custom Names from the drop down. 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

Below you can see that if we use the Open Automatically option, the available State Option is IMMEDIATE and the New State will be CLOSE.

 

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. You will notice here that the available State Option is READ WRITE indicating that the New State will be OPEN and the database will be in READ WRITE mode.

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 and the Linux VM.

 

 

Enjoy!

 

Related Posts Plugin for WordPress, Blogger...

Leave a Reply

This site uses Akismet to reduce spam. Learn how your comment data is processed.