Oracle 18c-Rman Duplication of a PDB To Another CDB
Description:-
- In this article we are going to see Oracle 18c-Rman Duplication of a PDB To Another CDB
- It is Available from Oracle 18c
Restrictions on Duplicating PDBS
- Only active database duplication is supported.
- Only the following clauses of the DUPLICATE command are supported: NORESUME, DB_FILE_NAME_CONVERT, SECTION SIZE, and USING COMPRESSED BACKUPSET.
- The following clauses of the DUPLICATE command are not supported: SPFILE, NO STANDBY, FARSYNC STANDBY, and LOG_FILE_NAME_CONVERT.
- Duplicating a PDB to a CDB that is a standby database is not supported.
Only one PDB can be duplicated at a time. - Partial PDB duplication is not supported, only complete PDB duplication is supported. For example, you cannot include or exclude specific tablespaces while duplicating a PDB.
- Duplicating a non-CDB as a PDB in an existing CDB is not supported.
- Duplicating PDBs that contain TDE-encrypted tablespaces is not supported.
Environment Details
Let’s start the Demo:-
Step1:-Prerequisites for active database duplication
Check PDB status on Source side (TESTDB)
SQL> show pdbs
CON_ID CON_NAME OPEN MODE RESTRICTED
---------- -------------------- ---------- ----------
2 PDB$SEED READ ONLY NO
3 PDB2 READ WRITE NO
4 PDB1 READ WRITE NO
5 PDB2_COPY READ WRITE NO
6 PDB3 READ WRITE NO
Check PDB status on Target side (DEVDB)
SQL> show pdbs CON_ID CON_NAME OPEN MODE RESTRICTED ---------- ------------------------------ ---------- ---------- 2 PDB$SEED READ ONLY NO 3 DEVPDB2 READ WRITE NO 4 DEVPDB1 READ WRITE NO
Creating table for Testing After the clone we will verify the table
[oracle@testdb ~]$ sqlplus '/as sysdba' SQL*Plus: Release 18.0.0.0.0 Production on Tue Jul 3 08:49:28 2018 Version 18.1.0.0.0 Copyright (c) 1982, 2017, Oracle. All rights reserved. Connected to: Oracle Database 18c Enterprise Edition Release 18.0.0.0.0 - Production Version 18.1.0.0.0 SQL> alter session set container=pdb2; Session altered. SQL> create table india (no number); Table created. SQL> insert into india values(1); 1 row created. SQL> commit; Commit complete.
Step2:-Create the directories that store the duplicate database files on the destination CDB (DEVDB)
[oracle@devdb ~]$ mkdir -p /u02/app/oracle/oradata/devdb/devpdb3/ [oracle@devdb ~]$ mkdir -p /u01/devpdb3 [oracle@devdb ~]$ sqlplus '/as sysdba' SQL*Plus: Release 18.0.0.0.0 Production on Tue Jul 3 08:48:39 2018 Version 18.1.0.0.0 Copyright (c) 1982, 2017, Oracle. All rights reserved. Connected to: Oracle Database 18c Enterprise Edition Release 18.0.0.0.0 - Production Version 18.1.0.0.0 SQL> alter system set remote_recovery_file_dest='/u01/devpdb3'; System altered. SQL> exit Disconnected from Oracle Database 18c Enterprise Edition Release 18.0.0.0.0 - Production Version 18.1.0.0.0
Step3:-Establish Oracle net connectivity between the source CDB and the destination CDB
[oracle@testdb ~]$ tnsping devdb TNS Ping Utility for Linux: Version 18.0.0.0.0 - Production on 03-JUL-2018 08:58:54 Copyright (c) 1997, 2017, Oracle. All rights reserved. Used parameter files: /u01/app/oracle/product/18.0.0/dbhome_1/network/admin/sqlnet.ora Used TNSNAMES adapter to resolve the alias Attempting to contact (DESCRIPTION = (ADDRESS = (PROTOCOL = TCP)(HOST = devdb.compute-604179528.oraclecloud.internal)(PORT = 1521)) (CONNECT_DATA = (SERVER = DEDICATED) (SERVICE_NAME = devdb.604179528.oraclecloud.internal))) OK (0 msec) [oracle@devdb ~]$ tnsping testdb TNS Ping Utility for Linux: Version 18.0.0.0.0 - Production on 03-JUL-2018 08:59:47 Copyright (c) 1997, 2017, Oracle. All rights reserved. Used parameter files: /u01/app/oracle/product/18.0.0/dbhome_1/network/admin/sqlnet.ora Used TNSNAMES adapter to resolve the alias Attempting to contact (DESCRIPTION = (ADDRESS = (PROTOCOL = TCP)(HOST = testdb.compute-604179528.oraclecloud.internal)(PORT = 1521)) (CONNECT_DATA = (SERVER = DEDICATED) (SERVICE_NAME = testdb.604179528.oraclecloud.internal))) OK (0 msec)
Step4:-start the Rman Duplication of a PDB To Another CDB
[oracle@testdb ~]$ rman target sys/Chennai#123@testdb auxiliary sys/Chennai#123@devdb Recovery Manager: Release 18.0.0.0.0 - Production on Tue Jul 3 08:50:40 2018 Version 18.1.0.0.0 Copyright (c) 1982, 2018, Oracle and/or its affiliates. All rights reserved. connected to target database: TESTDB (DBID=2763264412) connected to auxiliary database: DEVDB (DBID=885182715) RMAN> DUPLICATE PLUGGABLE DATABASE PDB2 as DEVPDB3 TO DEVDB DB_FILE_NAME_CONVERT('/u02/app/oracle/oradata/testdb/PDB2/','/u02/app/oracle/oradata/devdb/devpdb3/') FROM ACTIVE DATABASE SECTION SIZE 400M; Starting Duplicate PDB at 03-JUL-18 using target database control file instead of recovery catalog allocated channel: ORA_AUX_DISK_1 channel ORA_AUX_DISK_1: SID=4 device type=DISK current log archived contents of Memory Script: { set newname for datafile 22 to "/u02/app/oracle/oradata/devdb/devpdb3/system01.dbf"; set newname for datafile 23 to "/u02/app/oracle/oradata/devdb/devpdb3/sysaux01.dbf"; set newname for datafile 24 to "/u02/app/oracle/oradata/devdb/devpdb3/undotbs01.dbf"; restore from nonsparse section size 400 m clone foreign pluggable database "PDB2" from service 'testdb' ; } executing Memory Script executing command: SET NEWNAME executing command: SET NEWNAME executing command: SET NEWNAME Starting restore at 03-JUL-18 using channel ORA_AUX_DISK_1 channel ORA_AUX_DISK_1: starting datafile backup set restore channel ORA_AUX_DISK_1: using network backup set from service testdb channel ORA_AUX_DISK_1: specifying datafile(s) to restore from backup set channel ORA_AUX_DISK_1: restoring section 1 of 1 channel ORA_AUX_DISK_1: restoring foreign file 22 to /u02/app/oracle/oradata/devdb/devpdb3/system01.dbf channel ORA_AUX_DISK_1: restore complete, elapsed time: 00:00:16 channel ORA_AUX_DISK_1: starting datafile backup set restore channel ORA_AUX_DISK_1: using network backup set from service testdb channel ORA_AUX_DISK_1: specifying datafile(s) to restore from backup set channel ORA_AUX_DISK_1: restoring section 1 of 2 channel ORA_AUX_DISK_1: restoring foreign file 23 to /u02/app/oracle/oradata/devdb/devpdb3/sysaux01.dbf channel ORA_AUX_DISK_1: restore complete, elapsed time: 00:00:16 channel ORA_AUX_DISK_1: starting datafile backup set restore channel ORA_AUX_DISK_1: using network backup set from service testdb channel ORA_AUX_DISK_1: specifying datafile(s) to restore from backup set channel ORA_AUX_DISK_1: restoring section 2 of 2 channel ORA_AUX_DISK_1: restoring foreign file 23 to /u02/app/oracle/oradata/devdb/devpdb3/sysaux01.dbf channel ORA_AUX_DISK_1: restore complete, elapsed time: 00:00:15 channel ORA_AUX_DISK_1: starting datafile backup set restore channel ORA_AUX_DISK_1: using network backup set from service testdb channel ORA_AUX_DISK_1: specifying datafile(s) to restore from backup set channel ORA_AUX_DISK_1: restoring section 1 of 1 channel ORA_AUX_DISK_1: restoring foreign file 24 to /u02/app/oracle/oradata/devdb/devpdb3/undotbs01.dbf channel ORA_AUX_DISK_1: restore complete, elapsed time: 00:00:03 Finished restore at 03-JUL-18 current log archived contents of Memory Script: { set archivelog destination to '/u01/devpdb3'; restore clone force from service 'testdb' foreign archivelog from scn 4198374; } executing Memory Script executing command: SET ARCHIVELOG DESTINATION Starting restore at 03-JUL-18 using channel ORA_AUX_DISK_1 channel ORA_AUX_DISK_1: starting archived log restore to user-specified destination archived log destination=/u01/devpdb3 channel ORA_AUX_DISK_1: using network backup set from service testdb channel ORA_AUX_DISK_1: restoring archived log archived log thread=1 sequence=15 channel ORA_AUX_DISK_1: restore complete, elapsed time: 00:00:01 channel ORA_AUX_DISK_1: starting archived log restore to user-specified destination archived log destination=/u01/devpdb3 channel ORA_AUX_DISK_1: using network backup set from service testdb channel ORA_AUX_DISK_1: restoring archived log archived log thread=1 sequence=16 channel ORA_AUX_DISK_1: restore complete, elapsed time: 00:00:02 Finished restore at 03-JUL-18 Performing import of metadata... Finished Duplicate PDB at 03-JUL-18 RMAN> exit
Step5:-Ensure that the destination CDB is open in read-write mode.
SQL> show pdbs
CON_ID CON_NAME OPEN MODE RESTRICTED
---------- ----------- --------- ----------
2 PDB$SEED READ ONLY NO
3 DEVPDB2 READ WRITE NO
4 DEVPDB1 READ WRITE NO
5 DEVPDB3 READ WRITE NO
Check the Table
SQL> alter session set container=DEVPDB3; Session altered. SQL> select * from india; NO ---------- 1
Successfully completed the Rman Duplication of a PDB To Another CDB
Reference:-
Catch Me On:- Hariprasath Rajaram
LinkedIn:https://www.linkedin.com/in/hari-prasath-aa65bb19/
Facebook:https://www.facebook.com/HariPrasathdba
FB Group:https://www.facebook.com/groups/894402327369506/
FB Page: https://www.facebook.com/dbahariprasath/?
Twitter: https://twitter.com/hariprasathdba