Point in time recovery of a Pluggable Database (from hereon referred to as a PDB) requires ALL files including UNDO to be restored and recovered to the specified time. As all PDBs write to the ROOT UNDO tablespace, point in time recovery of a PDB will use an auxiliary instance and will restore the CDB$ROOT UNDO, SYSTEM, SYSAUX, and SYSEXT tablespaces into the ROOT of the auxiliary instance. The datafiles of the PDB itself are restored and recovered in-situ.
The auxiliary database is created in the Fast Recovery Area if configured otherwise, the AUXILIARY DESTINATION clause can be used to specify an alternate location.
Recovery is done via RMAN, connected to ROOT container. The PDB being recovered must be closed but the ROOT and other PDBs remain open.
SQL> select con.name, df.file# from v$containers con, v$datafile df where con.con_id = df.con_id order by 1, 2; NAME FILE# ------------------------------ ---------- CDB$ROOT 1 CDB$ROOT 3 CDB$ROOT 4 CDB$ROOT 6 PDB$SEED 5 PDB$SEED 7 PDBC101 8 PDBC101 9 PDBC101 10 9 rows selected.
The following example is using an AUXILIARY DESTINATION instead of the default Flash Recovery Area.
Auxiliary destination /u02/nfs_share/ora_data indicates where the system/Undo/sysaux required for the PDB point int time recovery would be restored. The datafiles associated with the PDB would be restored in same location as it exist in the current database.
Always ensure you give auxiliary destination path which is different then the current datafile location.
Recovery Manager: Release 12.1.0.1.0 - Production on Tue Jul 2 12:05:51 2013 Copyright (c) 1982, 2013, Oracle and/or its affiliates. All rights reserved. connected to target database: CDBC101 (DBID=958900840) RMAN> ALTER PLUGGABLE DATABASE pdbc101 CLOSE; 2> run 3> { 4> SET UNTIL sequence 21 thread 1; 5> RESTORE PLUGGABLE DATABASE pdbc101; 6> RECOVER PLUGGABLE DATABASE pdbc101 7> AUXILIARY DESTINATION '/u02/nfs_share/ora_data'; 8> } 9> ALTER PLUGGABLE DATABASE pdbc101 OPEN RESETLOGS; 10> 11> using target database control file instead of recovery catalog Statement processed executing command: SET until clause Starting restore at 02-JUL-2013 12:05:56 <--- This is the restore of the PDB datafiles allocated channel: ORA_DISK_1 channel ORA_DISK_1: SID=19 device type=DISK channel ORA_DISK_1: starting datafile backup set restore channel ORA_DISK_1: specifying datafile(s) to restore from backup set channel ORA_DISK_1: restoring datafile 00008 to /u05/nfs_share/ora_data/CDBC101/E0749F57C768731AE043A1DCA10A2DCA/datafile/o1_mf_system_8x32r2sh_.dbf channel ORA_DISK_1: restoring datafile 00009 to /u05/nfs_share/ora_data/CDBC101/E0749F57C768731AE043A1DCA10A2DCA/datafile/o1_mf_sysaux_8x32r2o7_.dbf channel ORA_DISK_1: restoring datafile 00010 to /u05/nfs_share/ora_data/CDBC101/E0749F57C768731AE043A1DCA10A2DCA/datafile/o1_mf_users_8x32szkj_.dbf channel ORA_DISK_1: reading from backup piece /u02/nfs_share/reco_area/CDBC101/E0749F57C768731AE043A1DCA10A2DCA/backupset/2013_07_01/o1_mf_nnndf_TAG20130701T175102_8x39fwqb_.bkp channel ORA_DISK_1: piece handle=/u02/nfs_share/reco_area/CDBC101/E0749F57C768731AE043A1DCA10A2DCA/backupset/2013_07_01/o1_mf_nnndf_TAG20130701T175102_8x39fwqb_.bkp tag=TAG20130701T175102 channel ORA_DISK_1: restored backup piece 1 channel ORA_DISK_1: restore complete, elapsed time: 00:00:46 Finished restore at 02-JUL-2013 12:06:42 Starting recover at 02-JUL-2013 12:06:42 using channel ORA_DISK_1 RMAN-05026: WARNING: presuming following set of tablespaces applies to specified Point-in-Time List of tablespaces expected to have UNDO segments Tablespace SYSTEM Tablespace UNDOTBS1 Creating automatic instance, with SID='sDdj' initialization parameters used for automatic instance: db_name=CDBC101 db_unique_name=sDdj_pitr_pdbc101_CDBC101 compatible=12.1.0.0.0 db_block_size=8192 db_files=200 sga_target=1G processes=80 diagnostic_dest=/u01/app/oracle db_create_file_dest=/u02/nfs_share/ora_data log_archive_dest_1='location=/u02/nfs_share/ora_data' enable_pluggable_database=true _clone_one_pdb_recovery=true #No auxiliary parameter file used starting up automatic instance CDBC101 <---- Starting another instance (besides the current running original database). Oracle instance started Total System Global Area 1068937216 bytes Fixed Size 2296576 bytes Variable Size 293602560 bytes Database Buffers 767557632 bytes Redo Buffers 5480448 bytes Automatic instance created contents of Memory Script: { # set requested point in time set until logseq 21 thread 1; # restore the controlfile restore clone controlfile; # mount the controlfile sql clone 'alter database mount clone database'; } executing Memory Script executing command: SET until clause Starting restore at 02-JUL-2013 12:06:57 allocated channel: ORA_AUX_DISK_1 channel ORA_AUX_DISK_1: SID=111 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 /u02/nfs_share/reco_area/CDBC101/autobackup/2013_07_01/o1_mf_s_819654840_8x39jtc8_.bkp channel ORA_AUX_DISK_1: piece handle=/u02/nfs_share/reco_area/CDBC101/autobackup/2013_07_01/o1_mf_s_819654840_8x39jtc8_.bkp tag=TAG20130701T175400 channel ORA_AUX_DISK_1: restored backup piece 1 channel ORA_AUX_DISK_1: restore complete, elapsed time: 00:00:07 output file name=/u02/nfs_share/ora_data/CDBC101/controlfile/o1_mf_8x59l3sl_.ctl Finished restore at 02-JUL-2013 12:07:05 sql statement: alter database mount clone database contents of Memory Script: { # set requested point in time set until logseq 21 thread 1; # switch to valid datafilecopies switch clone datafile 8 to datafilecopy "/u05/nfs_share/ora_data/CDBC101/E0749F57C768731AE043A1DCA10A2DCA/datafile/o1_mf_system_8x32r2sh_.dbf"; switch clone datafile 9 to datafilecopy "/u05/nfs_share/ora_data/CDBC101/E0749F57C768731AE043A1DCA10A2DCA/datafile/o1_mf_sysaux_8x32r2o7_.dbf"; switch clone datafile 10 to datafilecopy "/u05/nfs_share/ora_data/CDBC101/E0749F57C768731AE043A1DCA10A2DCA/datafile/o1_mf_users_8x32szkj_.dbf"; # set destinations for recovery set and auxiliary set datafiles set newname for clone datafile 1 to new; set newname for clone datafile 4 to new; set newname for clone datafile 3 to new; set newname for clone datafile 6 to new; # restore the tablespaces in the recovery set and the auxiliary set restore clone datafile 1, 4, 3, 6; switch clone datafile all; } executing Memory Script executing command: SET until clause datafile 8 switched to datafile copy input datafile copy RECID=3 STAMP=819720431 file name=/u02/nfs_share/ora_data/CDBC101/E0749F57C768731AE043A1DCA10A2DCA/datafile/o1_mf_system_8x32r2sh_.dbf datafile 9 switched to datafile copy input datafile copy RECID=4 STAMP=819720431 file name=/u02/nfs_share/ora_data/CDBC101/E0749F57C768731AE043A1DCA10A2DCA/datafile/o1_mf_sysaux_8x32r2o7_.dbf datafile 10 switched to datafile copy input datafile copy RECID=5 STAMP=819720431 file name=/u02/nfs_share/ora_data/CDBC101/E0749F57C768731AE043A1DCA10A2DCA/datafile/o1_mf_users_8x32szkj_.dbf executing command: SET NEWNAME executing command: SET NEWNAME executing command: SET NEWNAME executing command: SET NEWNAME Starting restore at 02-JUL-2013 12:07:11 <---- This is the restore of the Root Container Database 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/nfs_share/ora_data/CDBC101/datafile/o1_mf_system_%u_.dbf channel ORA_AUX_DISK_1: restoring datafile 00004 to /u02/nfs_share/ora_data/CDBC101/datafile/o1_mf_undotbs1_%u_.dbf channel ORA_AUX_DISK_1: restoring datafile 00003 to /u02/nfs_share/ora_data/CDBC101/datafile/o1_mf_sysaux_%u_.dbf channel ORA_AUX_DISK_1: restoring datafile 00006 to /u02/nfs_share/ora_data/CDBC101/datafile/o1_mf_users_%u_.dbf channel ORA_AUX_DISK_1: reading from backup piece /u02/nfs_share/reco_area/CDBC101/backupset/2013_07_01/o1_mf_nnndf_TAG20130701T175102_8x39c78w_.bkp channel ORA_AUX_DISK_1: piece handle=/u02/nfs_share/reco_area/CDBC101/backupset/2013_07_01/o1_mf_nnndf_TAG20130701T175102_8x39c78w_.bkp tag=TAG20130701T175102 channel ORA_AUX_DISK_1: restored backup piece 1 channel ORA_AUX_DISK_1: restore complete, elapsed time: 00:01:15 Finished restore at 02-JUL-2013 12:08:27 datafile 1 switched to datafile copy input datafile copy RECID=10 STAMP=819720507 file name=/u02/nfs_share/ora_data/CDBC101/datafile/o1_mf_system_8x59ljbm_.dbf datafile 4 switched to datafile copy input datafile copy RECID=11 STAMP=819720507 file name=/u02/nfs_share/ora_data/CDBC101/datafile/o1_mf_undotbs1_8x59ljgm_.dbf datafile 3 switched to datafile copy input datafile copy RECID=12 STAMP=819720507 file name=/u02/nfs_share/ora_data/CDBC101/datafile/o1_mf_sysaux_8x59ljf6_.dbf datafile 6 switched to datafile copy input datafile copy RECID=13 STAMP=819720507 file name=/u02/nfs_share/ora_data/CDBC101/datafile/o1_mf_users_8x59ljjy_.dbf contents of Memory Script: { # set requested point in time set until logseq 21 thread 1; # online the datafiles restored or switched sql clone "alter database datafile 1 online"; sql clone "alter database datafile 4 online"; sql clone "alter database datafile 3 online"; sql clone 'PDBC101' "alter database datafile 8 online"; sql clone 'PDBC101' "alter database datafile 9 online"; sql clone 'PDBC101' "alter database datafile 10 online"; sql clone "alter database datafile 6 online"; # recover pdb recover clone database tablespace "SYSTEM", "UNDOTBS1", "SYSAUX", "USERS" pluggable database 'PDBC101' delete archivelog; sql clone 'alter database open read only'; plsql <<>>; plsql << >>; # shutdown clone before import shutdown clone abort plsql << 'PDBC101'); end; >>>; } executing Memory Script executing command: SET until clause sql statement: alter database datafile 1 online sql statement: alter database datafile 4 online sql statement: alter database datafile 3 online sql statement: alter database datafile 8 online sql statement: alter database datafile 9 online sql statement: alter database datafile 10 online sql statement: alter database datafile 6 online Starting recover at 02-JUL-2013 12:08:28 using channel ORA_AUX_DISK_1 starting media recovery archived log for thread 1 with sequence 16 is already on disk as file /u02/nfs_share/reco_area/CDBC101/archivelog/2013_07_01/o1_mf_1_16_8x39jq8g_.arc archived log for thread 1 with sequence 17 is already on disk as file /u02/nfs_share/reco_area/CDBC101/archivelog/2013_07_01/o1_mf_1_17_8x3r1zf6_.arc archived log for thread 1 with sequence 18 is already on disk as file /u02/nfs_share/reco_area/CDBC101/archivelog/2013_07_01/o1_mf_1_18_8x3r6pqc_.arc archived log for thread 1 with sequence 19 is already on disk as file /u02/nfs_share/reco_area/CDBC101/archivelog/2013_07_01/o1_mf_1_19_8x3rcrrv_.arc archived log for thread 1 with sequence 20 is already on disk as file /u02/nfs_share/reco_area/CDBC101/archivelog/2013_07_02/o1_mf_1_20_8x4620tk_.arc archived log file name=/u02/nfs_share/reco_area/CDBC101/archivelog/2013_07_01/o1_mf_1_16_8x39jq8g_.arc thread=1 sequence=16 archived log file name=/u02/nfs_share/reco_area/CDBC101/archivelog/2013_07_01/o1_mf_1_17_8x3r1zf6_.arc thread=1 sequence=17 archived log file name=/u02/nfs_share/reco_area/CDBC101/archivelog/2013_07_01/o1_mf_1_18_8x3r6pqc_.arc thread=1 sequence=18 archived log file name=/u02/nfs_share/reco_area/CDBC101/archivelog/2013_07_01/o1_mf_1_19_8x3rcrrv_.arc thread=1 sequence=19 archived log file name=/u02/nfs_share/reco_area/CDBC101/archivelog/2013_07_02/o1_mf_1_20_8x4620tk_.arc thread=1 sequence=20 media recovery complete, elapsed time: 00:00:21 Finished recover at 02-JUL-2013 12:08:52 sql statement: alter database open read only Oracle instance shut down Removing automatic instance Automatic instance removed auxiliary instance file /u02/nfs_share/ora_data/CDBC101/datafile/o1_mf_sysaux_8x59ljf6_.dbf deleted auxiliary instance file /u02/nfs_share/ora_data/CDBC101/controlfile/o1_mf_8x59l3sl_.ctl deleted Finished recover at 02-JUL-2013 12:09:02 Statement processed Recovery Manager complete.
If you want to have more control on the Auxiliary instance configuration, than you can use an Auxiliary parameter file. This should include atleast the main parameters as shown below :
db_name=CDBC101 <--- needs to be the same as the name of the original Container database db_unique_name=sDdj_pitr_pdbc101_CDBC101 <--- Unique name, must be unique in this host. compatible=12.1.0.0.0 <--- needs to be the same as for the original Container database db_block_size=8192 <--- needs to be the same as for the original Container database db_files=200 <--- needs to be the same or higher as for the original Container database sga_target=1G <--- Configurable processes=80 <--- needs to be high enough. Keep in mind that when ASM is being used, additional processes are required diagnostic_dest=/u01/app/oracle <--- Configurable enable_pluggable_database=true <--- Mandatory !! _clone_one_pdb_recovery=true <--- Mandatory !!
The commands will than be like :
RMAN> ALTER PLUGGABLE DATABASE pdbc101 CLOSE; run { SET AUXILIARY INSTANCE PARAMETER FILE TO '/tmp/auxpfile.ora'; SET UNTIL sequence 21 thread 1; RESTORE PLUGGABLE DATABASE pdbc101; RECOVER PLUGGABLE DATABASE pdbc101 AUXILIARY DESTINATION '/u02/nfs_share/ora_data'; } ALTER PLUGGABLE DATABASE pdbc101 OPEN RESETLOGS;