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.

About these ads

One comment

  1. Monowar Mukul · · Reply

    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

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

PeteWhoDoesNotTweet

Stuff that interests me, if not you!

The Oracle Instructor

Explain, Exemplify, Empower

Frits Hoogland Weblog

IT Technology; Oracle, linux, TCP/IP and other stuff I find interesting

Oracle Spin - Flimatech Blog

Sharing Our Database Experience

Oracle Scratchpad

Just another Oracle weblog

Oracle SQL Tuning Tools and Tips

SQLTXPLAIN (SQLT), TRCANLZR (TRCA), SQL Health-Check (SQLHC) and SQL Tuning Topics

DBA Kevlar

Tips, tricks, (and maybe a few rants) so more DBAs become bulletproof!

Follow

Get every new post delivered to your Inbox.

Join 1,235 other followers

%d bloggers like this: