How to Clone PDB to Another CDB

  • by

Clone PDB to Another CDB

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.

3. Create a database link to the source CDB.

[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=('/u01/app/oracle/oradata/orcl/FINANPDB','/u01/app/oracle/oradata/orcl/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=('/u01/app/oracle/oradata/orcl/FINANPDB','/u01/app/oracle/oradata/orcl/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.

Leave a Reply

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