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*!
*Provisioning time will depend on the size of the PDB.
Current Oracle Certs
I’m Bobby Curtis and I’m just your normal average guy who has been working in the technology field for awhile (started when I was 18 with the US Army). The goal of this blog has changed a bit over the years. Initially, it was a general blog where I wrote thoughts down. Then it changed to focus on the Oracle Database, Oracle Enterprise Manager, and eventually Oracle GoldenGate.
If you want to follow me on a more timely manner, I can be followed on twitter at @dbasolved or on LinkedIn under “Bobby Curtis MBA”.
1. SQL> alter system set db_create_file_dest=’/u01/app/oracle/oradata/TESTP/TESTPD/pdb3′;
2. SQL> create pluggable database pdb3 from testpd;
Pluggable database created.