整个恢复的过程自动完成。恢复过程是按时间点先恢复到auxiliary库上,然后再从axiliary将要恢复的表空间通过“传输表空间”的方法传送回来。
下面的恢复的过程:
RMAN> run { recover tablespace users until time "to_date('2013-7-2 16:00','yyyy-mm-dd hh24:m2> i')" auxiliary destination '/u01/bak'; }3> 4> Starting recover at 02-JUL-13 allocated channel: ORA_DISK_1 channel ORA_DISK_1: SID=139 instance=tantest1 device type=DISK 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 Tablespace UNDOTBS2 Creating automatic instance, with SID='euui' initialization parameters used for automatic instance: db_name=TANTEST db_unique_name=euui_tspitr_TANTEST compatible=11.2.0.0.0 db_block_size=8192 db_files=200 sga_target=280M processes=50 db_create_file_dest=/u01/bak log_archive_dest_1='location=/u01/bak' #No auxiliary parameter file used starting up automatic instance TANTEST Oracle instance started Total System Global Area 292278272 bytes Fixed Size 2227744 bytes Variable Size 104858080 bytes Database Buffers 180355072 bytes Redo Buffers 4837376 bytes Automatic instance created Running TRANSPORT_SET_CHECK on recovery set tablespaces TRANSPORT_SET_CHECK completed successfully contents of Memory Script: { # set requested point in time set until time "to_date('2013-7-2 16:00','yyyy-mm-dd hh24:mi')"; # restore the controlfile restore clone controlfile; # mount the controlfile sql clone 'alter database mount clone database'; # archive current online log sql 'alter system archive log current'; # avoid unnecessary autobackups for structural changes during TSPITR sql 'begin dbms_backup_restore.AutoBackupFlag(FALSE); end;'; } executing Memory Script executing command: SET until clause Starting restore at 02-JUL-13 allocated channel: ORA_AUX_DISK_1 channel ORA_AUX_DISK_1: SID=62 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 +FRI/bak/full_36odo9rk_1_1.bkp channel ORA_AUX_DISK_1: piece handle=+FRI/bak/full_36odo9rk_1_1.bkp tag=TAG20130702T155811 channel ORA_AUX_DISK_1: restored backup piece 1 channel ORA_AUX_DISK_1: restore complete, elapsed time: 00:00:08 output file name=/u01/bak/TANTEST/controlfile/o1_mf_8x52w4rp_.ctl Finished restore at 02-JUL-13 sql statement: alter database mount clone database sql statement: alter system archive log current sql statement: begin dbms_backup_restore.AutoBackupFlag(FALSE); end; contents of Memory Script: { # set requested point in time set until time "to_date('2013-7-2 16:00','yyyy-mm-dd hh24:mi')"; plsql <<<-- tspitr_2 declare sqlstatement varchar2(512); offline_not_needed exception; pragma exception_init(offline_not_needed, -01539); begin sqlstatement := 'alter tablespace '|| 'USERS' ||' offline immediate'; krmicd.writeMsg(6162, sqlstatement); krmicd.execSql(sqlstatement); exception when offline_not_needed then null; end; >>>; # set destinations for recovery set and auxiliary set datafiles set newname for clone datafile 1 to new; set newname for clone datafile 3 to new; set newname for clone datafile 5 to new; set newname for clone datafile 2 to new; set newname for clone tempfile 1 to new; set newname for datafile 4 to "+DATA1/tantest/datafile/users.259.816103443"; # switch all tempfiles switch clone tempfile all; # restore the tablespaces in the recovery set and the auxiliary set restore clone datafile 1, 3, 5, 2, 4; switch clone datafile all; } executing Memory Script executing command: SET until clause sql statement: alter tablespace USERS offline immediate executing command: SET NEWNAME executing command: SET NEWNAME executing command: SET NEWNAME executing command: SET NEWNAME executing command: SET NEWNAME executing command: SET NEWNAME renamed tempfile 1 to /u01/bak/TANTEST/datafile/o1_mf_temp_%u_.tmp in control file Starting restore at 02-JUL-13 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 /u01/bak/TANTEST/datafile/o1_mf_system_%u_.dbf channel ORA_AUX_DISK_1: restoring datafile 00003 to /u01/bak/TANTEST/datafile/o1_mf_undotbs1_%u_.dbf channel ORA_AUX_DISK_1: restoring datafile 00005 to /u01/bak/TANTEST/datafile/o1_mf_undotbs2_%u_.dbf channel ORA_AUX_DISK_1: restoring datafile 00002 to /u01/bak/TANTEST/datafile/o1_mf_sysaux_%u_.dbf channel ORA_AUX_DISK_1: restoring datafile 00004 to +DATA1/tantest/datafile/users.259.816103443 channel ORA_AUX_DISK_1: reading from backup piece +FRI/bak/full_35odo9ok_1_1.bkp channel ORA_AUX_DISK_1: piece handle=+FRI/bak/full_35odo9ok_1_1.bkp tag=TAG20130702T155811 channel ORA_AUX_DISK_1: restored backup piece 1 channel ORA_AUX_DISK_1: restore complete, elapsed time: 00:02:15 Finished restore at 02-JUL-13 datafile 1 switched to datafile copy input datafile copy RECID=6 STAMP=819735344 file name=/u01/bak/TANTEST/datafile/o1_mf_system_8x52wzs7_.dbf datafile 3 switched to datafile copy input datafile copy RECID=7 STAMP=819735344 file name=/u01/bak/TANTEST/datafile/o1_mf_undotbs1_8x52wzsg_.dbf datafile 5 switched to datafile copy input datafile copy RECID=8 STAMP=819735345 file name=/u01/bak/TANTEST/datafile/o1_mf_undotbs2_8x52wzsp_.dbf datafile 2 switched to datafile copy input datafile copy RECID=9 STAMP=819735345 file name=/u01/bak/TANTEST/datafile/o1_mf_sysaux_8x52wzpk_.dbf contents of Memory Script: { # set requested point in time set until time "to_date('2013-7-2 16:00','yyyy-mm-dd hh24:mi')"; # online the datafiles restored or switched sql clone "alter database datafile 1 online"; sql clone "alter database datafile 3 online"; sql clone "alter database datafile 5 online"; sql clone "alter database datafile 2 online"; sql clone "alter database datafile 4 online"; # recover and open resetlogs recover clone database tablespace "USERS", "SYSTEM", "UNDOTBS1", "UNDOTBS2", "SYSAUX" delete archivelog; alter clone database open resetlogs; } executing Memory Script executing command: SET until clause sql statement: alter database datafile 1 online sql statement: alter database datafile 3 online sql statement: alter database datafile 5 online sql statement: alter database datafile 2 online sql statement: alter database datafile 4 online Starting recover at 02-JUL-13 using channel ORA_AUX_DISK_1 starting media recovery archived log for thread 1 with sequence 179 is already on disk as file +FRI/tantest/arch1/1_179_816103580.dbf archived log for thread 2 with sequence 125 is already on disk as file +FRI/tantest/arch2/2_125_816103580.dbf archived log file name=+FRI/tantest/arch1/1_179_816103580.dbf thread=1 sequence=179 archived log file name=+FRI/tantest/arch2/2_125_816103580.dbf thread=2 sequence=0 media recovery complete, elapsed time: 00:00:02 Finished recover at 02-JUL-13 database opened contents of Memory Script: { # make read only the tablespace that will be exported sql clone 'alter tablespace USERS read only'; # create directory for datapump import sql "create or replace directory TSPITR_DIROBJ_DPDIR as '' /u01/bak''"; # create directory for datapump export sql clone "create or replace directory TSPITR_DIROBJ_DPDIR as '' /u01/bak''"; } executing Memory Script sql statement: alter tablespace USERS read only sql statement: create or replace directory TSPITR_DIROBJ_DPDIR as ''/u01/bak'' sql statement: create or replace directory TSPITR_DIROBJ_DPDIR as ''/u01/bak'' Performing export of metadata... EXPDP> Starting "SYS"."TSPITR_EXP_euui": EXPDP> Processing object type TRANSPORTABLE_EXPORT/PLUGTS_BLK EXPDP> Processing object type TRANSPORTABLE_EXPORT/TABLE EXPDP> Processing object type TRANSPORTABLE_EXPORT/INDEX/INDEX EXPDP> Processing object type TRANSPORTABLE_EXPORT/CONSTRAINT/CONSTRAINT EXPDP> Processing object type TRANSPORTABLE_EXPORT/INDEX_STATISTICS EXPDP> Processing object type TRANSPORTABLE_EXPORT/CONSTRAINT/REF_CONSTRAINT EXPDP> Processing object type TRANSPORTABLE_EXPORT/TABLE_STATISTICS EXPDP> Processing object type TRANSPORTABLE_EXPORT/POST_INSTANCE/PLUGTS_BLK EXPDP> Master table "SYS"."TSPITR_EXP_euui" successfully loaded/unloaded EXPDP> ****************************************************************************** EXPDP> Dump file set for SYS.TSPITR_EXP_euui is: EXPDP> /u01/bak/tspitr_euui_97863.dmp EXPDP> ****************************************************************************** EXPDP> Datafiles required for transportable tablespace USERS: EXPDP> +DATA1/tantest/datafile/users.259.816103443 EXPDP> Job "SYS"."TSPITR_EXP_euui" successfully completed at 16:21:00 Export completed contents of Memory Script: { # shutdown clone before import shutdown clone immediate # drop target tablespaces before importing them back sql 'drop tablespace USERS including contents keep datafiles'; } executing Memory Script database closed database dismounted Oracle instance shut down sql statement: drop tablespace USERS including contents keep datafiles Performing import of metadata... IMPDP> Master table "SYS"."TSPITR_IMP_euui" successfully loaded/unloaded IMPDP> Starting "SYS"."TSPITR_IMP_euui": IMPDP> Processing object type TRANSPORTABLE_EXPORT/PLUGTS_BLK IMPDP> Processing object type TRANSPORTABLE_EXPORT/TABLE IMPDP> Processing object type TRANSPORTABLE_EXPORT/INDEX/INDEX IMPDP> Processing object type TRANSPORTABLE_EXPORT/CONSTRAINT/CONSTRAINT IMPDP> Processing object type TRANSPORTABLE_EXPORT/INDEX_STATISTICS IMPDP> Processing object type TRANSPORTABLE_EXPORT/CONSTRAINT/REF_CONSTRAINT IMPDP> Processing object type TRANSPORTABLE_EXPORT/TABLE_STATISTICS IMPDP> Processing object type TRANSPORTABLE_EXPORT/POST_INSTANCE/PLUGTS_BLK IMPDP> Job "SYS"."TSPITR_IMP_euui" successfully completed at 16:23:34 Import completed contents of Memory Script: { # make read write and offline the imported tablespaces sql 'alter tablespace USERS read write'; sql 'alter tablespace USERS offline'; # enable autobackups after TSPITR is finished sql 'begin dbms_backup_restore.AutoBackupFlag(TRUE); end;'; } executing Memory Script sql statement: alter tablespace USERS read write sql statement: alter tablespace USERS offline sql statement: begin dbms_backup_restore.AutoBackupFlag(TRUE); end; Removing automatic instance Automatic instance removed auxiliary instance file /u01/bak/TANTEST/datafile/o1_mf_temp_8x532pxs_.tmp deleted auxiliary instance file /u01/bak/TANTEST/onlinelog/o1_mf_4_8x5329gx_.log deleted auxiliary instance file /u01/bak/TANTEST/onlinelog/o1_mf_3_8x5328cq_.log deleted auxiliary instance file /u01/bak/TANTEST/onlinelog/o1_mf_2_8x5326jz_.log deleted auxiliary instance file /u01/bak/TANTEST/onlinelog/o1_mf_1_8x5324r2_.log deleted auxiliary instance file /u01/bak/TANTEST/datafile/o1_mf_sysaux_8x52wzpk_.dbf deleted auxiliary instance file /u01/bak/TANTEST/datafile/o1_mf_undotbs2_8x52wzsp_.dbf deleted auxiliary instance file /u01/bak/TANTEST/datafile/o1_mf_undotbs1_8x52wzsg_.dbf deleted auxiliary instance file /u01/bak/TANTEST/datafile/o1_mf_system_8x52wzs7_.dbf deleted auxiliary instance file /u01/bak/TANTEST/controlfile/o1_mf_8x52w4rp_.ctl deleted Finished recover at 02-JUL-13 RMAN>