Oracle 18c-Rman Duplication of a PDB To Another CDB

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

https://docs.oracle.com/en/database/oracle/oracle-database/18/bradv/rman-duplicating-databases.html#GUID-9E630E2C-3D1B-4594-B738-4B5B43E50C58

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

Oracle 18c-Cloning a PDB Database Using DBCA 

Oracle 18c-Cloning a PDB Database Using DBCA

Description:-

  • In this article we are going to see Oracle 18c-DBCA PDB Clone.
  • Oracle 18c New Feature cloning a PDB Database using DBCA
  • This example clones a PDB using the silent mode of DBCA. Hot cloning is supported.

Cloning a Local PDB Using DBCA

  • The source CDB is a single-instance database with the SID TESTDB.
  • The source PDB is pdb2. You intend for pdb2 to remain open during the cloning operation, which means that local undo and ARCHIVELOG mode are enabled in the CDB. Otherwise, DBCA closes the PDB during the clone operation, and after receiving confirmation, opens the source PDB in read-only mode.
  • The new PDB is pdb3.
  • You are running DBCA in noninteractive mode.

Let’s start the Demo:-

Step1:-Check the PDB in TestDB

Step2:-Cloning a PDB Database Using DBCA 

[oracle@testdb dbhome_1]$ cd $ORACLE_HOME/bin
[oracle@testdb bin]$ ./dbca -silent -createpluggabledatabase -sourcedb testdb -createpdbfrom PDB -pdbName pdb3 -sourcepdb pdb2
Prepare for db operation
13% complete
Creating Pluggable Database
15% complete
19% complete
23% complete
31% complete
53% complete
Completing Pluggable Database Creation
60% complete
Executing Post Configuration Actions
100% complete
Pluggable database "pdb3" plugged successfully.

Step3:-Check post cloning

Successfully completed the Cloning a PDB Database Using DBCA

Reference:-

https://docs.oracle.com/en/database/oracle/oracle-database/18/multi/cloning-a-pdb.html#GUID-8380406C-4D2D-4855-AC31-8A7AEE437D26

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