Skip to content
Home » Oracle » How to Clone PDB to Another CDB

How to Clone PDB to Another CDB

Clone PDB to Another CDB

To clone a PDB to a different CDB, we may take the following steps:

  1. Close the source PDB.
  2. Open the source PDB to READ ONLY.
  3. Create a database link to the source CDB.
  4. Clone the target PDB from the remote database via a database link.
  5. Open the target PDB to READ WRITE.

The step 1, and 2 are same as How to Clone a PDB From Another PDB in Same CDB, so we skip them and directly go to step 3.

Once again, if your CDB is local undo mode which is recommended in production environment, then you can skip step 1 and step 2. This is because we can clone the PDB online (read/write) with local undo mode.

For continuing the story from the previous post. Please remember, step 1 and 2 are on the source host test1. Now we are on the target host test2.

[oracle@test2 ~]$ sqlplus / as sysdba
...
SQL> create database link link_to_test1 connect to system identified by oracle using 'finanpdb';

Database link created.

4. Clone the target PDB from the remote database via a database link.

SQL> create pluggable database finance_pdb from finanpdb@link_to_test1 file_name_convert=('FINANPDB','FINANCE_PDB');

Pluggable database created.

ORA-17628 and ORA-01031 Issue

In some situations, you might see errors like this:

ORA-17628: Oracle error 1031 returned by remote Oracle server
ORA-01031: insufficient privileges

Please refer to : How to Resolve ORA-17628: Oracle error 1031 returned by remote Oracle server for more details.

Parallel Creation

If you want to clone a big database, say 10 TB from the source, you can add some degrees of parallelism on it.

SQL> create pluggable database finance_pdb from finanpdb@link_to_test1 file_name_convert=('FINANPDB','FINANCE_PDB') parallel 8;

Pluggable database created.

5. Open the target PDB to READ WRITE.

SQL> alter pluggable database finance_pdb open;

Pluggable database altered.

SQL> show pdbs;

    CON_ID CON_NAME                       OPEN MODE  RESTRICTED
---------- ------------------------------ ---------- ----------
         2 PDB$SEED                       READ ONLY  NO
         3 SUPPLYCH                       READ WRITE NO
         4 FINANCE_PDB                    READ WRITE NO

Actually, we can clone a PDB from any PDB over the network, as long as they are connected and compatible.

Later on, if don't like its name, you still have chances to rename the PDB with restricted mode.

2 thoughts on “How to Clone PDB to Another CDB”

    1. Parallel cloning may heavily impact the performance on the both sides. However, less time consumed means less risk exposed.

Leave a Reply

Your email address will not be published. Required fields are marked *