Cloning a PDB

Hello everyone!

Today I will show, how to clone a PDB from an existing PDB, this a very simple way to do this.
To clone a PDB it is very similar to creating a PDB from a seed database.
Let’s do it:
As a first step, you need to start in READ ONLY mode the PDB that you intend to clone.

SQL> show con_name

CON_NAME
——————————
CDB$ROOT

SQL> alter session set container=salespdb;

Session altered.

SQL> show con_name

CON_NAME
——————————
SALESPDB

SQL> shutdown
Pluggable Database closed.
SQL> startup open read only;
Pluggable Database opened.
SQL> conn / as sysdba
Connected.
SQL> create pluggable database CLONESALES from SALESPDB;

Pluggable database created.

To make the clone PDB accessible you will need the start the PDB:

SQL> alter session set container=clonesales;

Session altered.

SQL> startup
Pluggable Database opened.

We also need to shut down and reopen the source PDB:

SQL> alter session set container=salespdb;

Session altered.

SQL> shutdown
Pluggable Database closed.

SQL> startup
Pluggable Database opened.

Now you are able to connect on your new PDB:

SQL> conn john/oracle@clonesales
Connected.

I hope that you enjoy!
Thanks!

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