image

19c – Clone PDB to another CDB using DBLink

Identify the Source PDB, which needs to be Cloned:

SQL> show pdbs

CON_ID CON_NAMEOPEN MODERESTRICTED
2 PDB$SEEDREAD ONLYNO
3 TESTTST01READ WRITENO

You may receive the following ERROR during PDB Creation/Clone: ORA-17628: Oracle error 1031 returned by remote Oracle server ORA-01031: insufficient privileges

ORA-01031 alerted that the remote account has no CREATE PLUGGABLE DATABASE system privileges to clone the PDB.

In Source Environment, Grant the required privilege to the user, which would be used to clone the PDB.

clone the PDB.

$ telnet test-training-db.rawishAviation.com 1521

The escape character is ‘^]’.

Add Connection String to tnsnames.ora

[oracle@testinterface ~]$ cat $ORACLE_HOME/network/admin/tnsnames.ora

# tnsnames.ora Network Configuration File: /applic/oracle/product/19c/dbhome_1/network/admin/tnsnames.ora

# Generated by Oracle configuration tools.

TESTTST01 =   (DESCRIPTION = (ADDRESS = (PROTOCOL = TCP)(HOST = test-training-db.rawishAviation.com)(PORT = 1521)) (CONNECT_DATA = (SERVER = DEDICATED) (SERVICE_NAME = testtst01.rawishAviation.com) ) )

create database link link_to_testtst01_pdb connect to system identified by testadmin2022 using 'testtst01';

select * from tab@link_to_testtst01_pdb;

Clone PDB to another CDB using DBLink

SQL> create pluggable database TESTTST01 from TESTTST01@link_to_testtst01_pdb;

SQL> SELECT PDB_ID, PDB_NAME, STATUS FROM DBA_PDBS ORDER BY PDB_ID;

PDB_IDPDB_NAME                                                                                                                        STATUS
2PDB$SEED                                                                                                                         NORMAL
3TESTUAT01                                                                                                                       NORMAL

SQL>  create pluggable database TESTTST01 from TESTTST01@link_to_testtst01_pdb;

Pluggable database created.

SQL> show pdbs

CON_IDCON_NAME                      OPEN MODE RESTRICTED
2PDB$SEED                      READ ONLY NO
3TESTUAT01   READ WRITENO
4TESTTST01MOUNTED 

Pluggable Databases are now Cloned and Currently in Mounted State. Set the OPEN MODE to READ WRITE and save the STATE:

READ WRITE and save the STATE

SQL> show pdbs

CON_IDCON_NAME                      OPEN MODE RESTRICTED
2PDB$SEED                      READ ONLY NO
3TESTUAT01   READ WRITENO
4TESTTST01READ WRITENO
SQL> show pdbs

The newly cloned PDB is now ready for use.


You might be interested in reading:

Leave a Reply

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

fifteen − 12 =