How to Clone Remote PDB

  • by

Clone Remote PDB

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-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

This is because your release update (patched 18c or 19c) make it stricter. You have to directly grant CREATE PLUGGABLE DATABASE to the account used in DB link inside the PDB to make it work. In this case, it is SYSTEM.

SQL> alter session set container=finanpdb;

Session altered.

SQL> grant create pluggable database to system;

Grant succeeded.

Please note that, the privilege inherited from role will not work here.

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;

---------- ------------------------------ ---------- ----------
2 PDB$SEED                     READ ONLY  NO
3 SUPPLYCH                     READ WRITE NO

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

Leave a Reply

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