Clone a Pluggable Database – 12c Edition

With the introduction of Pluggable Databases in Oracle Database 12c, there is going to be questions on how to clone a pluggable database (PDB) either from the seed PDB or an existing PDB.  In the testing that I have done both in the beta program and with the general release creating a clone is fairly simple depending on the settings of your database.  The simplest way is using Oracle Managed Fils (OMF).  

Using OMF, all we need to do is specify the PDB name that we want to create.

CREATE PLUGGABLE DATABASE pdb2 FROM pdb1;

If we are not using the OMF, the SQL syntax is bit drawn out; yet still simple enough to use for creating a PDB.

CREATE PLUGGABLE DATABASE pdb2 FROM pdb1
PATH_PREFIX = '/oracle/app/oradata'
FILE_NAME_CONVERT = ('/oracle/app/oradata/ora12c/pdb1', '/oracle/app/oradata/ora12c/pdb2');

You will notice the difference in the syntax is that we needed to add PATH_PREFIX and FILE_NAME_CONVERT to the CREATE PLUGGABLE DATABASE sql.  The PATH_PREFIX option is used to ensure that all relative directory object paths and relative paths contain certain initialization parameters associated with the PDB are treated as relative to the specified directory or subdirectories.  The FILE_NAME_CONVERT option is used to specify the target location of the files based on the file locations of the source.

There are multiple ways of performing the SQL commands above.  Oracle has done a very good job at enabling their tools to perform the tasks of cloning a PDB.  Cloning can be done from the SQL*Plus prompt (above commands), Oracle Enterprise Manager 12c Cloud Control and SQLDeveloper.  I encourage you to give it a go; I’m positive you will like provisioning a database in under two (2) minutes*!

Enjoy!

twitter: @curtisbl294

blog: http://dbasolve.com

*Provisioning time will depend on the size of the PDB.

Please follow and like:
Comments
  • Simply:
    1. SQL> alter system set db_create_file_dest=’/u01/app/oracle/oradata/TESTP/TESTPD/pdb3′;
    System altered.
    2. SQL> create pluggable database pdb3 from testpd;
    Pluggable database created.
    Thanks
    Monowar Mukul

Comments are closed.

Enquire now

Give us a call or fill in the form below and we will contact you. We endeavor to answer all inquiries within 24 hours on business days.