In Oracle 12.2 there is a beauty in RMAN that we can restore a single pdb from whole CDB backup.

In this article, we will see how we can duplicate Single PDB from CDB backup What I have :

One CDB : CDB12

Three pdbs : pdb, pdb1, pdb2

What I will get :

One CDB : dupcdb

Two pdbs: pdb, pdb1

Step 1: Check Cdb Database

SQL> show pdbs

    CON_ID CON_NAME			  OPEN MODE  RESTRICTED
---------- ------------------------------ ---------- ----------
	 2 PDB$SEED			  READ ONLY  NO
	 3 PDB				  READ WRITE NO
	 4 PDB2 			  READ WRITE NO
	 5 PDB1 			  READ WRITE NO
SQL> show con_name

CON_NAME
------------------------------
CDB$ROOT
SQL> select name,open_mode from v$database;

NAME	  OPEN_MODE
--------- --------------------
CDB12	  READ WRITE

SQL>

Step 2: Connect to RMAN with CDB$ROOT and backup database

[oracle@localhost oradata]$ rman target /

Recovery Manager: Release 12.2.0.1.0 - Production on Sun Sep 2 04:38:39 2018

Copyright (c) 1982, 2017, Oracle and/or its affiliates.  All rights reserved.

connected to target database: CDB12 (DBID=2003437607)

RMAN> backup database;

Starting backup at 02-SEP-18
using target database control file instead of recovery catalog
allocated channel: ORA_DISK_1
channel ORA_DISK_1: SID=52 device type=DISK
channel ORA_DISK_1: starting full datafile backup set
channel ORA_DISK_1: specifying datafile(s) in backup set
input datafile file number=00001 name=/u02/oradata/CDB12/datafile/o1_mf_system_frd0o5fx_.dbf
input datafile file number=00003 name=/u02/oradata/CDB12/datafile/o1_mf_sysaux_frd0qllf_.dbf
input datafile file number=00004 name=/u02/oradata/CDB12/datafile/o1_mf_undotbs1_frd0s111_.dbf
input datafile file number=00007 name=/u02/oradata/CDB12/datafile/o1_mf_users_frd0s25l_.dbf
channel ORA_DISK_1: starting piece 1 at 02-SEP-18
channel ORA_DISK_1: finished piece 1 at 02-SEP-18
piece handle=/u01/oracle/fast_recovery_area/cdb12/CDB12/backupset/2018_09_02/o1_mf_nnndf_TAG20180902T043848_frp7019x_.bkp tag=TAG20180902T043848 comment=NONE
channel ORA_DISK_1: backup set complete, elapsed time: 00:01:25
channel ORA_DISK_1: starting full datafile backup set
channel ORA_DISK_1: specifying datafile(s) in backup set
input datafile file number=00010 name=/u02/oradata/CDB12/7488420FE8375E14E055000000000001/datafile/o1_mf_sysaux_frfggtt0_.dbf
input datafile file number=00012 name=/u02/oradata/CDB12/7488420FE8375E14E055000000000001/datafile/o1_mf_undo_1_frfgp5hx_.dbf
input datafile file number=00009 name=/u02/oradata/CDB12/7488420FE8375E14E055000000000001/datafile/o1_mf_system_frfggto4_.dbf
input datafile file number=00011 name=/u02/oradata/CDB12/7488420FE8375E14E055000000000001/datafile/o1_mf_users_frfggtt2_.dbf
channel ORA_DISK_1: starting piece 1 at 02-SEP-18
channel ORA_DISK_1: finished piece 1 at 02-SEP-18
piece handle=/u01/oracle/fast_recovery_area/cdb12/CDB12/7488420FE8375E14E055000000000001/backupset/2018_09_02/o1_mf_nnndf_TAG20180902T043848_frp72qgk_.bkp tag=TAG20180902T043848 comment=NONE
channel ORA_DISK_1: backup set complete, elapsed time: 00:01:46
channel ORA_DISK_1: starting full datafile backup set
channel ORA_DISK_1: specifying datafile(s) in backup set
input datafile file number=00014 name=/u02/oradata/CDB12/74D7FDB4AE814BFEE055000000000001/datafile/o1_mf_sysaux_frp5bgvg_.dbf
input datafile file number=00013 name=/u02/oradata/CDB12/74D7FDB4AE814BFEE055000000000001/datafile/o1_mf_system_frp5bgt2_.dbf
input datafile file number=00015 name=/u02/oradata/CDB12/74D7FDB4AE814BFEE055000000000001/datafile/o1_mf_undotbs1_frp5bgvh_.dbf
channel ORA_DISK_1: starting piece 1 at 02-SEP-18
channel ORA_DISK_1: finished piece 1 at 02-SEP-18
piece handle=/u01/oracle/fast_recovery_area/cdb12/CDB12/74D7FDB4AE814BFEE055000000000001/backupset/2018_09_02/o1_mf_nnndf_TAG20180902T043848_frp762dt_.bkp tag=TAG20180902T043848 comment=NONE
channel ORA_DISK_1: backup set complete, elapsed time: 00:00:35
channel ORA_DISK_1: starting full datafile backup set
channel ORA_DISK_1: specifying datafile(s) in backup set
input datafile file number=00017 name=/u02/oradata/CDB12/74D7FDB4AE824BFEE055000000000001/datafile/o1_mf_sysaux_frp5n9o4_.dbf
input datafile file number=00016 name=/u02/oradata/CDB12/74D7FDB4AE824BFEE055000000000001/datafile/o1_mf_system_frp5n9n6_.dbf
input datafile file number=00018 name=/u02/oradata/CDB12/74D7FDB4AE824BFEE055000000000001/datafile/o1_mf_undotbs1_frp5n9o5_.dbf
channel ORA_DISK_1: starting piece 1 at 02-SEP-18
channel ORA_DISK_1: finished piece 1 at 02-SEP-18
piece handle=/u01/oracle/fast_recovery_area/cdb12/CDB12/74D7FDB4AE824BFEE055000000000001/backupset/2018_09_02/o1_mf_nnndf_TAG20180902T043848_frp7764w_.bkp tag=TAG20180902T043848 comment=NONE
channel ORA_DISK_1: backup set complete, elapsed time: 00:00:45
channel ORA_DISK_1: starting full datafile backup set
channel ORA_DISK_1: specifying datafile(s) in backup set
input datafile file number=00006 name=/u02/oradata/CDB12/datafile/o1_mf_sysaux_frd0x315_.dbf
input datafile file number=00005 name=/u02/oradata/CDB12/datafile/o1_mf_system_frd0x31c_.dbf
input datafile file number=00008 name=/u02/oradata/CDB12/datafile/o1_mf_undotbs1_frd0x31k_.dbf
channel ORA_DISK_1: starting piece 1 at 02-SEP-18
channel ORA_DISK_1: finished piece 1 at 02-SEP-18
piece handle=/u01/oracle/fast_recovery_area/cdb12/CDB12/748AA82CF6530AE9E055000000000001/backupset/2018_09_02/o1_mf_nnndf_TAG20180902T043848_frp78ms8_.bkp tag=TAG20180902T043848 comment=NONE
channel ORA_DISK_1: backup set complete, elapsed time: 00:00:25
Finished backup at 02-SEP-18

Starting Control File and SPFILE Autobackup at 02-SEP-18
piece handle=/u01/oracle/fast_recovery_area/cdb12/CDB12/autobackup/2018_09_02/o1_mf_s_985754629_frp79kqp_.bkp comment=NONE
Finished Control File and SPFILE Autobackup at 02-SEP-18

RMAN>

Step 3: Transfer backup to the destination server

Step 4: Create pfile having just two parameters db_name and enable_pluggable_database

[oracle@localhost dbs]$ cat initdupcdb.ora
db_name=dupcdb
enable_pluggable_database=true

Step 5: Start the database in nomount mode

[oracle@localhost dbs]$ export ORACLE_SID=dupcdb
[oracle@localhost dbs]$ sqlplus / as sysdba

SQL*Plus: Release 12.2.0.1.0 Production on Sun Sep 2 04:11:33 2018

Copyright (c) 1982, 2016, Oracle.  All rights reserved.

Connected to an idle instance.

SQL> startup nomount
ORACLE instance started.

Total System Global Area  297795584 bytes
Fixed Size		    8791960 bytes
Variable Size		  234883176 bytes
Database Buffers	   50331648 bytes
Redo Buffers		    3788800 bytes

Step 6: Create tns entry for source pdb database in the destination server

cdb12 =
  (DESCRIPTION =
    (ADDRESS_LIST =
      (ADDRESS = (PROTOCOL = TCP)(HOST = 101.0.0.11)(PORT = 1521))
    )
    (CONNECT_DATA =
      (SERVICE_NAME = cdb12)
    )
  )

Step 7: Connect RMAN target as a source CDB and auxiliary with destination cdb

[oracle@localhost dbs]$ rman target sys/oracle@cdb12 auxiliary /

Recovery Manager: Release 12.2.0.1.0 - Production on Sun Sep 2 04:40:40 2018

Copyright (c) 1982, 2017, Oracle and/or its affiliates.  All rights reserved.

connected to target database: CDB12 (DBID=2003437607)
connected to auxiliary database: DUPCDB (not mounted)
RMAN>

Step 8: I just want pdb and pdb1 in my new cdb use “duplicate database to dupcdb database pdb,pdb1”

RMAN> duplicate database to dupcdb pluggable database pdb,pdb1;

Starting Duplicate Db at 02-SEP-18
using target database control file instead of recovery catalog
allocated channel: ORA_AUX_DISK_1
channel ORA_AUX_DISK_1: SID=35 device type=DISK
current log archived

contents of Memory Script:
{
   sql clone "create spfile from memory";
}
executing Memory Script

sql statement: create spfile from memory

contents of Memory Script:
{
   shutdown clone immediate;
   startup clone nomount;
}
executing Memory Script

Oracle instance shut down

connected to auxiliary database (not started)
Oracle instance started

Total System Global Area     297795584 bytes

Fixed Size                     8791960 bytes
Variable Size                234883176 bytes
Database Buffers              50331648 bytes
Redo Buffers                   3788800 bytes

contents of Memory Script:
{
   sql clone "alter system set  db_name = 
 ''CDB12'' comment=
 ''Modified by RMAN duplicate'' scope=spfile";
   sql clone "alter system set  db_unique_name = 
 ''dupcdb'' comment=
 ''Modified by RMAN duplicate'' scope=spfile";
   shutdown clone immediate;
   startup clone force nomount
   restore clone primary controlfile;
   alter clone database mount;
}
executing Memory Script

sql statement: alter system set  db_name =  ''CDB12'' comment= ''Modified by RMAN duplicate'' scope=spfile

sql statement: alter system set  db_unique_name =  ''dupcdb'' comment= ''Modified by RMAN duplicate'' scope=spfile

Oracle instance shut down

Oracle instance started

Total System Global Area     297795584 bytes

Fixed Size                     8791960 bytes
Variable Size                234883176 bytes
Database Buffers              50331648 bytes
Redo Buffers                   3788800 bytes

Starting restore at 02-SEP-18
allocated channel: ORA_AUX_DISK_1
channel ORA_AUX_DISK_1: SID=34 device type=DISK

channel ORA_AUX_DISK_1: starting datafile backup set restore
channel ORA_AUX_DISK_1: restoring control file
channel ORA_AUX_DISK_1: reading from backup piece /u01/oracle/fast_recovery_area/cdb12/CDB12/autobackup/2018_09_02/o1_mf_s_985754629_frp79kqp_.bkp
channel ORA_AUX_DISK_1: piece handle=/u01/oracle/fast_recovery_area/cdb12/CDB12/autobackup/2018_09_02/o1_mf_s_985754629_frp79kqp_.bkp tag=TAG20180902T044349
channel ORA_AUX_DISK_1: restored backup piece 1
channel ORA_AUX_DISK_1: restore complete, elapsed time: 00:00:01
output file name=/u01/oracle/product/12.2.0/db_1/dbs/cntrldupcdb.dbf
Finished restore at 02-SEP-18

database mounted
Skipping pluggable database PDB2
Automatically adding tablespace SYSTEM
Automatically adding tablespace SYSAUX
Automatically adding tablespace PDB$SEED:SYSTEM
Automatically adding tablespace PDB$SEED:SYSAUX
Automatically adding tablespace PDB2:SYSTEM
Automatically adding tablespace UNDOTBS1
Automatically adding tablespace PDB2:UNDOTBS1
Skipping tablespace USERS

contents of Memory Script:
{
   set until scn  2842490;
   set newname for datafile  1 to 
 "/u02/oradata/dupcdb/datafile/o1_mf_system_frd0o5fx_.dbf";
   set newname for datafile  3 to 
 "/u02/oradata/dupcdb/datafile/o1_mf_sysaux_frd0qllf_.dbf";
   set newname for datafile  4 to 
 "/u02/oradata/dupcdb/datafile/o1_mf_undotbs1_frd0s111_.dbf";
   set newname for datafile  5 to 
 "/u02/oradata/dupcdb/datafile/o1_mf_system_frd0x31c_.dbf";
   set newname for datafile  6 to 
 "/u02/oradata/dupcdb/datafile/o1_mf_sysaux_frd0x315_.dbf";
   set newname for datafile  8 to 
 "/u02/oradata/dupcdb/datafile/o1_mf_undotbs1_frd0x31k_.dbf";
   set newname for datafile  9 to 
 "/u02/oradata/dupcdb/7488420FE8375E14E055000000000001/datafile/o1_mf_system_frfggto4_.dbf";
   set newname for datafile  10 to 
 "/u02/oradata/dupcdb/7488420FE8375E14E055000000000001/datafile/o1_mf_sysaux_frfggtt0_.dbf";
   set newname for datafile  11 to 
 "/u02/oradata/dupcdb/7488420FE8375E14E055000000000001/datafile/o1_mf_users_frfggtt2_.dbf";
   set newname for datafile  12 to 
 "/u02/oradata/dupcdb/7488420FE8375E14E055000000000001/datafile/o1_mf_undo_1_frfgp5hx_.dbf";
   set newname for datafile  16 to 
 "/u02/oradata/dupcdb/74D7FDB4AE824BFEE055000000000001/datafile/o1_mf_system_frp5n9n6_.dbf";
   set newname for datafile  17 to 
 "/u02/oradata/dupcdb/74D7FDB4AE824BFEE055000000000001/datafile/o1_mf_sysaux_frp5n9o4_.dbf";
   set newname for datafile  18 to 
 "/u02/oradata/dupcdb/74D7FDB4AE824BFEE055000000000001/datafile/o1_mf_undotbs1_frp5n9o5_.dbf";
   restore
   clone database
   skip forever tablespace  "USERS",
 "PDB2":"UNDOTBS1",
 "PDB2":"SYSTEM",
 "PDB2":"SYSAUX"   ;
}
executing Memory Script

executing command: SET until clause

executing command: SET NEWNAME

executing command: SET NEWNAME

executing command: SET NEWNAME

executing command: SET NEWNAME

executing command: SET NEWNAME

executing command: SET NEWNAME

executing command: SET NEWNAME

executing command: SET NEWNAME

executing command: SET NEWNAME

executing command: SET NEWNAME

executing command: SET NEWNAME

executing command: SET NEWNAME

executing command: SET NEWNAME

Starting restore at 02-SEP-18
using channel ORA_AUX_DISK_1

channel ORA_AUX_DISK_1: starting datafile backup set restore
channel ORA_AUX_DISK_1: specifying datafile(s) to restore from backup set
channel ORA_AUX_DISK_1: restoring datafile 00001 to /u02/oradata/dupcdb/datafile/o1_mf_system_frd0o5fx_.dbf
channel ORA_AUX_DISK_1: restoring datafile 00003 to /u02/oradata/dupcdb/datafile/o1_mf_sysaux_frd0qllf_.dbf
channel ORA_AUX_DISK_1: restoring datafile 00004 to /u02/oradata/dupcdb/datafile/o1_mf_undotbs1_frd0s111_.dbf
channel ORA_AUX_DISK_1: reading from backup piece /u01/oracle/fast_recovery_area/cdb12/CDB12/backupset/2018_09_02/o1_mf_nnndf_TAG20180902T043848_frp7019x_.bkp
channel ORA_AUX_DISK_1: piece handle=/u01/oracle/fast_recovery_area/cdb12/CDB12/backupset/2018_09_02/o1_mf_nnndf_TAG20180902T043848_frp7019x_.bkp tag=TAG20180902T043848
channel ORA_AUX_DISK_1: restored backup piece 1
channel ORA_AUX_DISK_1: restore complete, elapsed time: 00:01:05
channel ORA_AUX_DISK_1: starting datafile backup set restore
channel ORA_AUX_DISK_1: specifying datafile(s) to restore from backup set
channel ORA_AUX_DISK_1: restoring datafile 00009 to /u02/oradata/dupcdb/7488420FE8375E14E055000000000001/datafile/o1_mf_system_frfggto4_.dbf
channel ORA_AUX_DISK_1: restoring datafile 00010 to /u02/oradata/dupcdb/7488420FE8375E14E055000000000001/datafile/o1_mf_sysaux_frfggtt0_.dbf
channel ORA_AUX_DISK_1: restoring datafile 00011 to /u02/oradata/dupcdb/7488420FE8375E14E055000000000001/datafile/o1_mf_users_frfggtt2_.dbf
channel ORA_AUX_DISK_1: restoring datafile 00012 to /u02/oradata/dupcdb/7488420FE8375E14E055000000000001/datafile/o1_mf_undo_1_frfgp5hx_.dbf
channel ORA_AUX_DISK_1: reading from backup piece /u01/oracle/fast_recovery_area/cdb12/CDB12/7488420FE8375E14E055000000000001/backupset/2018_09_02/o1_mf_nnndf_TAG20180902T043848_frp72qgk_.bkp
channel ORA_AUX_DISK_1: piece handle=/u01/oracle/fast_recovery_area/cdb12/CDB12/7488420FE8375E14E055000000000001/backupset/2018_09_02/o1_mf_nnndf_TAG20180902T043848_frp72qgk_.bkp tag=TAG20180902T043848
channel ORA_AUX_DISK_1: restored backup piece 1
channel ORA_AUX_DISK_1: restore complete, elapsed time: 00:00:55
channel ORA_AUX_DISK_1: starting datafile backup set restore
channel ORA_AUX_DISK_1: specifying datafile(s) to restore from backup set
channel ORA_AUX_DISK_1: restoring datafile 00016 to /u02/oradata/dupcdb/74D7FDB4AE824BFEE055000000000001/datafile/o1_mf_system_frp5n9n6_.dbf
channel ORA_AUX_DISK_1: restoring datafile 00017 to /u02/oradata/dupcdb/74D7FDB4AE824BFEE055000000000001/datafile/o1_mf_sysaux_frp5n9o4_.dbf
channel ORA_AUX_DISK_1: restoring datafile 00018 to /u02/oradata/dupcdb/74D7FDB4AE824BFEE055000000000001/datafile/o1_mf_undotbs1_frp5n9o5_.dbf
channel ORA_AUX_DISK_1: reading from backup piece /u01/oracle/fast_recovery_area/cdb12/CDB12/74D7FDB4AE824BFEE055000000000001/backupset/2018_09_02/o1_mf_nnndf_TAG20180902T043848_frp7764w_.bkp
channel ORA_AUX_DISK_1: piece handle=/u01/oracle/fast_recovery_area/cdb12/CDB12/74D7FDB4AE824BFEE055000000000001/backupset/2018_09_02/o1_mf_nnndf_TAG20180902T043848_frp7764w_.bkp tag=TAG20180902T043848
channel ORA_AUX_DISK_1: restored backup piece 1
channel ORA_AUX_DISK_1: restore complete, elapsed time: 00:00:45
channel ORA_AUX_DISK_1: starting datafile backup set restore
channel ORA_AUX_DISK_1: specifying datafile(s) to restore from backup set
channel ORA_AUX_DISK_1: restoring datafile 00005 to /u02/oradata/dupcdb/datafile/o1_mf_system_frd0x31c_.dbf
channel ORA_AUX_DISK_1: restoring datafile 00006 to /u02/oradata/dupcdb/datafile/o1_mf_sysaux_frd0x315_.dbf
channel ORA_AUX_DISK_1: restoring datafile 00008 to /u02/oradata/dupcdb/datafile/o1_mf_undotbs1_frd0x31k_.dbf
channel ORA_AUX_DISK_1: reading from backup piece /u01/oracle/fast_recovery_area/cdb12/CDB12/748AA82CF6530AE9E055000000000001/backupset/2018_09_02/o1_mf_nnndf_TAG20180902T043848_frp78ms8_.bkp
channel ORA_AUX_DISK_1: piece handle=/u01/oracle/fast_recovery_area/cdb12/CDB12/748AA82CF6530AE9E055000000000001/backupset/2018_09_02/o1_mf_nnndf_TAG20180902T043848_frp78ms8_.bkp tag=TAG20180902T043848
channel ORA_AUX_DISK_1: restored backup piece 1
channel ORA_AUX_DISK_1: restore complete, elapsed time: 00:00:45
Finished restore at 02-SEP-18

contents of Memory Script:
{
   switch clone datafile all;
}
executing Memory Script

datafile 1 switched to datafile copy
input datafile copy RECID=17 STAMP=985754971 file name=/u02/oradata/dupcdb/datafile/o1_mf_system_frd0o5fx_.dbf
datafile 3 switched to datafile copy
input datafile copy RECID=18 STAMP=985754971 file name=/u02/oradata/dupcdb/datafile/o1_mf_sysaux_frd0qllf_.dbf
datafile 4 switched to datafile copy
input datafile copy RECID=19 STAMP=985754971 file name=/u02/oradata/dupcdb/datafile/o1_mf_undotbs1_frd0s111_.dbf
datafile 5 switched to datafile copy
input datafile copy RECID=20 STAMP=985754971 file name=/u02/oradata/dupcdb/datafile/o1_mf_system_frd0x31c_.dbf
datafile 6 switched to datafile copy
input datafile copy RECID=21 STAMP=985754972 file name=/u02/oradata/dupcdb/datafile/o1_mf_sysaux_frd0x315_.dbf
datafile 8 switched to datafile copy
input datafile copy RECID=22 STAMP=985754972 file name=/u02/oradata/dupcdb/datafile/o1_mf_undotbs1_frd0x31k_.dbf
datafile 9 switched to datafile copy
input datafile copy RECID=23 STAMP=985754972 file name=/u02/oradata/dupcdb/7488420FE8375E14E055000000000001/datafile/o1_mf_system_frfggto4_.dbf
datafile 10 switched to datafile copy
input datafile copy RECID=24 STAMP=985754972 file name=/u02/oradata/dupcdb/7488420FE8375E14E055000000000001/datafile/o1_mf_sysaux_frfggtt0_.dbf
datafile 11 switched to datafile copy
input datafile copy RECID=25 STAMP=985754972 file name=/u02/oradata/dupcdb/7488420FE8375E14E055000000000001/datafile/o1_mf_users_frfggtt2_.dbf
datafile 12 switched to datafile copy
input datafile copy RECID=26 STAMP=985754972 file name=/u02/oradata/dupcdb/7488420FE8375E14E055000000000001/datafile/o1_mf_undo_1_frfgp5hx_.dbf
datafile 16 switched to datafile copy
input datafile copy RECID=27 STAMP=985754972 file name=/u02/oradata/dupcdb/74D7FDB4AE824BFEE055000000000001/datafile/o1_mf_system_frp5n9n6_.dbf
datafile 17 switched to datafile copy
input datafile copy RECID=28 STAMP=985754972 file name=/u02/oradata/dupcdb/74D7FDB4AE824BFEE055000000000001/datafile/o1_mf_sysaux_frp5n9o4_.dbf
datafile 18 switched to datafile copy
input datafile copy RECID=29 STAMP=985754972 file name=/u02/oradata/dupcdb/74D7FDB4AE824BFEE055000000000001/datafile/o1_mf_undotbs1_frp5n9o5_.dbf

contents of Memory Script:
{
   set until scn  2842490;
   recover
   clone database
   skip forever tablespace  "USERS",
 "PDB2":"UNDOTBS1",
 "PDB2":"SYSTEM",
 "PDB2":"SYSAUX"    delete archivelog
   ;
}
executing Memory Script

executing command: SET until clause

Starting recover at 02-SEP-18
using channel ORA_AUX_DISK_1

Executing: alter database datafile 7 offline drop
Executing: alter database datafile 15 offline drop
Executing: alter database datafile 13 offline drop
Executing: alter database datafile 14 offline drop
starting media recovery

archived log for thread 1 with sequence 20 is already on disk as file /u01/arc/cdb12/1_20_985420331.dbf
archived log file name=/u01/arc/cdb12/1_20_985420331.dbf thread=1 sequence=20
media recovery complete, elapsed time: 00:00:02
Finished recover at 02-SEP-18
Oracle instance started

Total System Global Area     297795584 bytes

Fixed Size                     8791960 bytes
Variable Size                234883176 bytes
Database Buffers              50331648 bytes
Redo Buffers                   3788800 bytes

contents of Memory Script:
{
   sql clone "alter system set  db_name = 
 ''DUPCDB'' comment=
 ''Reset to original value by RMAN'' scope=spfile";
   sql clone "alter system reset  db_unique_name scope=spfile";
}
executing Memory Script

sql statement: alter system set  db_name =  ''DUPCDB'' comment= ''Reset to original value by RMAN'' scope=spfile

sql statement: alter system reset  db_unique_name scope=spfile
Oracle instance started

Total System Global Area     297795584 bytes

Fixed Size                     8791960 bytes
Variable Size                234883176 bytes
Database Buffers              50331648 bytes
Redo Buffers                   3788800 bytes
sql statement: CREATE CONTROLFILE REUSE SET DATABASE "DUPCDB" RESETLOGS ARCHIVELOG 
  MAXLOGFILES     16
  MAXLOGMEMBERS      3
  MAXDATAFILES     1024
  MAXINSTANCES     8
  MAXLOGHISTORY      292
 LOGFILE
  GROUP   1 ( '/u02/oradata/dupcdb/onlinelog/o1_mf_1_frd0tmtf_.log', '/u01/oracle/fast_recovery_area/dupcdb/CDB12/onlinelog/o1_mf_1_frd0v20y_.log' ) SIZE 200 M  REUSE,
  GROUP   2 ( '/u02/oradata/dupcdb/onlinelog/o1_mf_2_frd0tmv7_.log', '/u01/oracle/fast_recovery_area/dupcdb/CDB12/onlinelog/o1_mf_2_frd0v1xr_.log' ) SIZE 200 M  REUSE,
  GROUP   3 ( '/u02/oradata/dupcdb/onlinelog/o1_mf_3_frd0vfg9_.log', '/u01/oracle/fast_recovery_area/dupcdb/CDB12/onlinelog/o1_mf_3_frd0vmwf_.log' ) SIZE 200 M  REUSE
 DATAFILE
  '/u02/oradata/dupcdb/datafile/o1_mf_system_frd0o5fx_.dbf',
  '/u02/oradata/dupcdb/datafile/o1_mf_system_frd0x31c_.dbf',
  '/u02/oradata/dupcdb/7488420FE8375E14E055000000000001/datafile/o1_mf_system_frfggto4_.dbf',
  '/u02/oradata/dupcdb/74D7FDB4AE824BFEE055000000000001/datafile/o1_mf_system_frp5n9n6_.dbf'
 CHARACTER SET AL32UTF8


contents of Memory Script:
{
   set newname for tempfile  1 to 
 "/u02/oradata/dupcdb/datafile/o1_mf_temp_frd0wp2c_.tmp";
   set newname for tempfile  2 to 
 "/u02/oradata/dupcdb/datafile/temp012018-08-29_07-54-23-792-AM.dbf";
   set newname for tempfile  3 to 
 "/u02/oradata/dupcdb/7488420FE8375E14E055000000000001/datafile/o1_mf_temp_frfggtt1_.dbf";
   set newname for tempfile  5 to 
 "/u02/oradata/dupcdb/74D7FDB4AE824BFEE055000000000001/datafile/o1_mf_temp_frp5n9ob_.dbf";
   switch clone tempfile all;
   catalog clone datafilecopy  "/u02/oradata/dupcdb/datafile/o1_mf_sysaux_frd0qllf_.dbf", 
 "/u02/oradata/dupcdb/datafile/o1_mf_undotbs1_frd0s111_.dbf", 
 "/u02/oradata/dupcdb/datafile/o1_mf_sysaux_frd0x315_.dbf", 
 "/u02/oradata/dupcdb/datafile/o1_mf_undotbs1_frd0x31k_.dbf", 
 "/u02/oradata/dupcdb/7488420FE8375E14E055000000000001/datafile/o1_mf_sysaux_frfggtt0_.dbf", 
 "/u02/oradata/dupcdb/7488420FE8375E14E055000000000001/datafile/o1_mf_users_frfggtt2_.dbf", 
 "/u02/oradata/dupcdb/7488420FE8375E14E055000000000001/datafile/o1_mf_undo_1_frfgp5hx_.dbf", 
 "/u02/oradata/dupcdb/74D7FDB4AE824BFEE055000000000001/datafile/o1_mf_sysaux_frp5n9o4_.dbf", 
 "/u02/oradata/dupcdb/74D7FDB4AE824BFEE055000000000001/datafile/o1_mf_undotbs1_frp5n9o5_.dbf";
   switch clone datafile all;
}
executing Memory Script

executing command: SET NEWNAME

executing command: SET NEWNAME

executing command: SET NEWNAME

executing command: SET NEWNAME

renamed tempfile 1 to /u02/oradata/dupcdb/datafile/o1_mf_temp_frd0wp2c_.tmp in control file
renamed tempfile 2 to /u02/oradata/dupcdb/datafile/temp012018-08-29_07-54-23-792-AM.dbf in control file
renamed tempfile 3 to /u02/oradata/dupcdb/7488420FE8375E14E055000000000001/datafile/o1_mf_temp_frfggtt1_.dbf in control file
renamed tempfile 5 to /u02/oradata/dupcdb/74D7FDB4AE824BFEE055000000000001/datafile/o1_mf_temp_frp5n9ob_.dbf in control file

cataloged datafile copy
datafile copy file name=/u02/oradata/dupcdb/datafile/o1_mf_sysaux_frd0qllf_.dbf RECID=1 STAMP=985755008
cataloged datafile copy
datafile copy file name=/u02/oradata/dupcdb/datafile/o1_mf_undotbs1_frd0s111_.dbf RECID=2 STAMP=985755008
cataloged datafile copy
datafile copy file name=/u02/oradata/dupcdb/datafile/o1_mf_sysaux_frd0x315_.dbf RECID=3 STAMP=985755008
cataloged datafile copy
datafile copy file name=/u02/oradata/dupcdb/datafile/o1_mf_undotbs1_frd0x31k_.dbf RECID=4 STAMP=985755008
cataloged datafile copy
datafile copy file name=/u02/oradata/dupcdb/7488420FE8375E14E055000000000001/datafile/o1_mf_sysaux_frfggtt0_.dbf RECID=5 STAMP=985755008
cataloged datafile copy
datafile copy file name=/u02/oradata/dupcdb/7488420FE8375E14E055000000000001/datafile/o1_mf_users_frfggtt2_.dbf RECID=6 STAMP=985755008
cataloged datafile copy
datafile copy file name=/u02/oradata/dupcdb/7488420FE8375E14E055000000000001/datafile/o1_mf_undo_1_frfgp5hx_.dbf RECID=7 STAMP=985755008
cataloged datafile copy
datafile copy file name=/u02/oradata/dupcdb/74D7FDB4AE824BFEE055000000000001/datafile/o1_mf_sysaux_frp5n9o4_.dbf RECID=8 STAMP=985755008
cataloged datafile copy
datafile copy file name=/u02/oradata/dupcdb/74D7FDB4AE824BFEE055000000000001/datafile/o1_mf_undotbs1_frp5n9o5_.dbf RECID=9 STAMP=985755008

datafile 3 switched to datafile copy
input datafile copy RECID=1 STAMP=985755008 file name=/u02/oradata/dupcdb/datafile/o1_mf_sysaux_frd0qllf_.dbf
datafile 4 switched to datafile copy
input datafile copy RECID=2 STAMP=985755008 file name=/u02/oradata/dupcdb/datafile/o1_mf_undotbs1_frd0s111_.dbf
datafile 6 switched to datafile copy
input datafile copy RECID=3 STAMP=985755008 file name=/u02/oradata/dupcdb/datafile/o1_mf_sysaux_frd0x315_.dbf
datafile 8 switched to datafile copy
input datafile copy RECID=4 STAMP=985755008 file name=/u02/oradata/dupcdb/datafile/o1_mf_undotbs1_frd0x31k_.dbf
datafile 10 switched to datafile copy
input datafile copy RECID=5 STAMP=985755008 file name=/u02/oradata/dupcdb/7488420FE8375E14E055000000000001/datafile/o1_mf_sysaux_frfggtt0_.dbf
datafile 11 switched to datafile copy
input datafile copy RECID=6 STAMP=985755008 file name=/u02/oradata/dupcdb/7488420FE8375E14E055000000000001/datafile/o1_mf_users_frfggtt2_.dbf
datafile 12 switched to datafile copy
input datafile copy RECID=7 STAMP=985755008 file name=/u02/oradata/dupcdb/7488420FE8375E14E055000000000001/datafile/o1_mf_undo_1_frfgp5hx_.dbf
datafile 17 switched to datafile copy
input datafile copy RECID=8 STAMP=985755008 file name=/u02/oradata/dupcdb/74D7FDB4AE824BFEE055000000000001/datafile/o1_mf_sysaux_frp5n9o4_.dbf
datafile 18 switched to datafile copy
input datafile copy RECID=9 STAMP=985755008 file name=/u02/oradata/dupcdb/74D7FDB4AE824BFEE055000000000001/datafile/o1_mf_undotbs1_frp5n9o5_.dbf

contents of Memory Script:
{
   Alter clone database open resetlogs;
}
executing Memory Script

database opened
Executing: drop pluggable database "PDB2" including datafiles

contents of Memory Script:
{
   sql clone "alter pluggable database all open";
}
executing Memory Script

sql statement: alter pluggable database all open
Dropping offline and skipped tablespaces
Executing: alter database default tablespace system
Executing: drop tablespace "USERS" including contents cascade constraints
Cannot remove created server parameter file
Finished Duplicate Db at 02-SEP-18

RMAN>

Step 9: Check pdbs in dupcdb[destination cdb database

[oracle@localhost dbs]$ sqlplus / as sysdba

SQL*Plus: Release 12.2.0.1.0 Production on Sun Sep 2 04:53:17 2018

Copyright (c) 1982, 2016, Oracle.  All rights reserved.


Connected to:
Oracle Database 12c Enterprise Edition Release 12.2.0.1.0 - 64bit Production

SQL> select name,open_mode,cdb from v$database;

NAME	  OPEN_MODE	       CDB
--------- -------------------- ---
DUPCDB	  READ WRITE	       YES

SQL> show pdbs

    CON_ID CON_NAME			  OPEN MODE  RESTRICTED
---------- ------------------------------ ---------- ----------
	 2 PDB$SEED			  READ ONLY  NO
	 3 PDB				  READ WRITE NO
	 5 PDB1 			  READ WRITE NO
SQL>

If you want to be updated with all our articles send us an Invitation or Follow us:

Telegram Channel: https://t.me/helporacle

Skant Gupta’s LinkedIn: www.linkedin.com/in/skantali/

Joel Perez’s LinkedIn: Joel Perez’s Profile

LinkedIn Group: Oracle Cloud DBAAS

Facebook Page: OracleHelp

About The Author

Leave a Reply

This site uses Akismet to reduce spam. Learn how your comment data is processed.