编者按:
本文作者系大连健哥, POSTGRESQL、ORACLE 数据库资深从业人员、IT 技术的深度爱好者。相信科学改变人类、技术创造未来。个人主页:https://www.cnblogs.com/gaojian/,经其本人授权发布。
【免责声明】本公众号文章仅代表个人观点,与任何公司无关。
在两个数据库之间进行备份恢复同步,其实还有一个变形版本:就是利用增分更新备份方式,增分更新备份本身,就是每一次都对 image copy 执行 apply,这样会节省recover 执行的时间。
比如,如果我1月1日进行 level 0 的备份,1月2日进行 level 1 的备份,1月3日进行 level 1 的备份.... 1 月 31 日进行 level 1 的备份;2月1日我想恢复到 1月31日为止的状态时,我需要进行如下的操作:
(1) restore 1月1日的备份
(2) recover 1月2日的备份
(3) recover 1月3日的备份
.....
(31) recover 1月31日的备份。
这样,recover 的时间就会比较长。
而采用 增分更新备份,我可以在每次备份时,顺手执行 recover copy 命令,把作为基础的 level 0 备份(image copy),变成apply 了昨天备份的状态。
典型的操作是这样的
run{RECOVER COPY OF DATABASE WITH TAG 'incr_update';BACKUP INCREMENTAL LEVEL 1 FOR RECOVER OF COPY WITH TAG 'incr_update' DATABASE format '/refresh/home/bak/%U';}
我要执行的操作是这样的:
首先,在 source 端,进行 第一次增分备份,以及控制文件和spfile的备份。
-bash-4.1$ rman target /Recovery Manager: Release 11.2.0.4.0 - Production on Sun Apr 4 08:04:34 2021Copyright (c) 1982, 2011, Oracle and/or its affiliates. All rights reserved.connected to target database: ORCL1120 (DBID=3640541495)RMAN> BACKUP INCREMENTAL LEVEL 1 FOR RECOVER OF COPY WITH TAG 'incr_update' DATABASE format '/refresh/home/bak/%U';Starting backup at 20210404_08:04:52using target database control file instead of recovery catalogallocated channel: ORA_DISK_1channel ORA_DISK_1: SID=45 device type=DISKno parent backup or copy of datafile 1 foundno parent backup or copy of datafile 2 foundno parent backup or copy of datafile 3 foundno parent backup or copy of datafile 4 foundchannel ORA_DISK_1: starting datafile copyinput datafile file number=00001 name=/refresh/home/app/11.2.0.4/oracle/oradata/orcl11204/system01.dbfoutput file name=/refresh/home/app/11.2.0.4/oracle/product/11.2.0.4/dbhome_4/dbs/data_D-ORCL1120_I-3640541495_TS-SYSTEM_FNO-1_0qvrebt4 tag=INCR_UPDATE RECID=20 STAMP=1068969896channel ORA_DISK_1: datafile copy complete, elapsed time: 00:00:07channel ORA_DISK_1: starting datafile copyinput datafile file number=00002 name=/refresh/home/app/11.2.0.4/oracle/oradata/orcl11204/sysaux01.dbfoutput file name=/refresh/home/app/11.2.0.4/oracle/product/11.2.0.4/dbhome_4/dbs/data_D-ORCL1120_I-3640541495_TS-SYSAUX_FNO-2_0rvrebtb tag=INCR_UPDATE RECID=21 STAMP=1068969902channel ORA_DISK_1: datafile copy complete, elapsed time: 00:00:03channel ORA_DISK_1: starting datafile copyinput datafile file number=00003 name=/refresh/home/app/11.2.0.4/oracle/oradata/orcl11204/undotbs01.dbfoutput file name=/refresh/home/app/11.2.0.4/oracle/product/11.2.0.4/dbhome_4/dbs/data_D-ORCL1120_I-3640541495_TS-UNDOTBS1_FNO-3_0svrebte tag=INCR_UPDATE RECID=22 STAMP=1068969903channel ORA_DISK_1: datafile copy complete, elapsed time: 00:00:01channel ORA_DISK_1: starting incremental level 1 datafile backup setchannel ORA_DISK_1: specifying datafile(s) in backup setincluding current control file in backup setincluding current SPFILE in backup setchannel ORA_DISK_1: starting piece 1 at 20210404_08:05:05channel ORA_DISK_1: finished piece 1 at 20210404_08:05:06piece handle=/refresh/home/bak/0tvrebtg_1_1 tag=INCR_UPDATE comment=NONEchannel ORA_DISK_1: backup set complete, elapsed time: 00:00:01channel ORA_DISK_1: starting datafile copyinput datafile file number=00004 name=/refresh/home/app/11.2.0.4/oracle/oradata/orcl11204/users01.dbfoutput file name=/refresh/home/app/11.2.0.4/oracle/product/11.2.0.4/dbhome_4/dbs/data_D-ORCL1120_I-3640541495_TS-USERS_FNO-4_0uvrebti tag=INCR_UPDATE RECID=23 STAMP=1068969906channel ORA_DISK_1: datafile copy complete, elapsed time: 00:00:01Finished backup at 20210404_08:05:07RMAN>
对于增分更新备份,第一次执行时,相当于生成 level 0 的增分备份,它实际上会形成 image coy 。
RMAN> list copy;specification does not match any control file copy in the repositoryspecification does not match any archived log in the repositoryList of Datafile Copies=======================Key File S Completion Time Ckp SCN Ckp Time------- ---- - ----------------- ---------- -----------------20 1 A 20210404_08:04:56 1047627 20210404_08:04:52Name: /refresh/home/app/11.2.0.4/oracle/product/11.2.0.4/dbhome_4/dbs/data_D-ORCL1120_I-3640541495_TS-SYSTEM_FNO-1_0qvrebt4Tag: INCR_UPDATE21 2 A 20210404_08:05:02 1047631 20210404_08:04:59Name: /refresh/home/app/11.2.0.4/oracle/product/11.2.0.4/dbhome_4/dbs/data_D-ORCL1120_I-3640541495_TS-SYSAUX_FNO-2_0rvrebtbTag: INCR_UPDATE22 3 A 20210404_08:05:03 1047633 20210404_08:05:02Name: /refresh/home/app/11.2.0.4/oracle/product/11.2.0.4/dbhome_4/dbs/data_D-ORCL1120_I-3640541495_TS-UNDOTBS1_FNO-3_0svrebteTag: INCR_UPDATE23 4 A 20210404_08:05:06 1047635 20210404_08:05:06Name: /refresh/home/app/11.2.0.4/oracle/product/11.2.0.4/dbhome_4/dbs/data_D-ORCL1120_I-3640541495_TS-USERS_FNO-4_0uvrebtiTag: INCR_UPDATERMAN> list backup;List of Backup Sets===================BS Key Type LV Size Device Type Elapsed Time Completion Time------- ---- -- ---------- ----------- ------------ -----------------27 Incr 1 9.36M DISK 00:00:01 20210404_08:05:05BP Key: 27 Status: AVAILABLE Compressed: NO Tag: INCR_UPDATEPiece Name: /refresh/home/bak/0tvrebtg_1_1SPFILE Included: Modification time: 20210403_07:39:00SPFILE db_unique_name: ORCL11204Control File Included: Ckp SCN: 1047633 Ckp time: 20210404_08:05:02RMAN>
对控制文件和spfile的备份,方法与之前一样:
backup current controlfile format '/refresh/home/bak/control.bks';Starting backup at 20210404_08:11:01using channel ORA_DISK_1channel ORA_DISK_1: starting full datafile backup setchannel ORA_DISK_1: specifying datafile(s) in backup setincluding current control file in backup setchannel ORA_DISK_1: starting piece 1 at 20210404_08:11:02channel ORA_DISK_1: finished piece 1 at 20210404_08:11:03piece handle=/refresh/home/bak/control.bks tag=TAG20210404T081101 comment=NONEchannel ORA_DISK_1: backup set complete, elapsed time: 00:00:01Finished backup at 20210404_08:11:03backup spfile format '/refresh/home/bak/spfile.bks';Starting backup at 20210404_08:11:11using channel ORA_DISK_1channel ORA_DISK_1: starting full datafile backup setchannel ORA_DISK_1: specifying datafile(s) in backup setincluding current SPFILE in backup setchannel ORA_DISK_1: starting piece 1 at 20210404_08:11:11channel ORA_DISK_1: finished piece 1 at 20210404_08:11:12piece handle=/refresh/home/bak/spfile.bks tag=TAG20210404T081111 comment=NONEchannel ORA_DISK_1: backup set complete, elapsed time: 00:00:01Finished backup at 20210404_08:11:12RMAN>
第一次备份完成,我把这些备份内容拷贝到 dest 端,然后执行 restore 操作。
scp /refresh/home/bak/* <anotherhost>:/refresh/home/bak/rman target /Recovery Manager: Release 11.2.0.4.0 - Production on Sun Apr 4 08:14:26 2021Copyright (c) 1982, 2011, Oracle and/or its affiliates. All rights reserved.connected to target database (not started)startup nomount force;startup failed: ORA-01078: failure in processing system parameters: could not open parameter file '/refresh/home/app/11.2.0.4/oracle/product/11.2.0.4/dbhome_4/dbs/initorcl11204.ora'starting Oracle instance without parameter file for retrieval of spfileOracle instance startedTotal System Global Area 1068937216 bytesFixed Size 2260088 bytesVariable Size 281019272 bytesDatabase Buffers 780140544 bytesRedo Buffers 5517312 bytesrestore spfile from '/refresh/home/bak/spfile.bks';Starting restore at 04-APR-21using target database control file instead of recovery catalogallocated channel: ORA_DISK_1channel ORA_DISK_1: SID=19 device type=DISKchannel ORA_DISK_1: restoring spfile from AUTOBACKUP /refresh/home/bak/spfile.bkschannel ORA_DISK_1: SPFILE restore from AUTOBACKUP completeFinished restore at 04-APR-21restore spfile to pfile '/tmp/initnewdb.ora' from '/refresh/home/bak/spfile.bks';Starting restore at 04-APR-21using channel ORA_DISK_1channel ORA_DISK_1: restoring spfile from AUTOBACKUP /refresh/home/bak/spfile.bkschannel ORA_DISK_1: SPFILE restore from AUTOBACKUP completeFinished restore at 04-APR-21exit
查看生成的 /tmp/initnewdb.ora ,看看其中内容中有关于各个目录的,如果 dest 端没有这些目录,那么要建立好。特别是 audit 相关目录:
-bash-4.1$ grep audit /tmp/initnewdb.ora*.audit_file_dest='/refresh/home/app/11.2.0.4/oracle/admin/orcl11204/adump'*.audit_trail='db'-bash-4.1$
如果各目录已经建立好了,那么就可以设置mount 状态:
rman target /Recovery Manager: Release 11.2.0.4.0 - Production on Sun Apr 4 02:42:50 2021Copyright (c) 1982, 2011, Oracle and/or its affiliates. All rights reserved.connected to target database: DUMMY (not mounted)shutdown immediateusing target database control file instead of recovery catalogOracle instance shut downstartup nomount;connected to target database (not started)Oracle instance startedTotal System Global Area 1570009088 bytesFixed Size 2253584 bytesVariable Size 452988144 bytesDatabase Buffers 1107296256 bytesRedo Buffers 7471104 bytesrestore controlfile from '/refresh/home/bak/control.bks';Starting restore at 04-APR-21allocated channel: ORA_DISK_1channel ORA_DISK_1: SID=19 device type=DISKchannel ORA_DISK_1: restoring control filechannel ORA_DISK_1: restore complete, elapsed time: 00:00:01output file name=/refresh/home/app/11.2.0.4/oracle/oradata/orcl11204/control01.ctloutput file name=/refresh/home/app/11.2.0.4/oracle/oradata/orcl11204/control02.ctlFinished restore at 04-APR-21alter database mount;database mountedreleased channel: ORA_DISK_1RMAN>
这里,我们不进行数据库本身的 restore/ recover, 而是进行 level 0 的增量备份(image copy) 的 appy:
我在 source 端得到到第一次增分更新备份所得的,是 image copy:
RMAN> list copy;specification does not match any control file copy in the repositoryspecification does not match any archived log in the repositoryList of Datafile Copies=======================Key File S Completion Time Ckp SCN Ckp Time------- ---- - --------------- ---------- ---------------20 1 A 04-APR-21 1047627 04-APR-21Name: /refresh/home/app/11.2.0.4/oracle/product/11.2.0.4/dbhome_4/dbs/data_D-ORCL1120_I-3640541495_TS-SYSTEM_FNO-1_0qvrebt4Tag: INCR_UPDATE21 2 A 04-APR-21 1047631 04-APR-21Name: /refresh/home/app/11.2.0.4/oracle/product/11.2.0.4/dbhome_4/dbs/data_D-ORCL1120_I-3640541495_TS-SYSAUX_FNO-2_0rvrebtbTag: INCR_UPDATE22 3 A 04-APR-21 1047633 04-APR-21Name: /refresh/home/app/11.2.0.4/oracle/product/11.2.0.4/dbhome_4/dbs/data_D-ORCL1120_I-3640541495_TS-UNDOTBS1_FNO-3_0svrebteTag: INCR_UPDATE23 4 A 04-APR-21 1047635 04-APR-21Name: /refresh/home/app/11.2.0.4/oracle/product/11.2.0.4/dbhome_4/dbs/data_D-ORCL1120_I-3640541495_TS-USERS_FNO-4_0uvrebtiTag: INCR_UPDATE
我把它们拷贝到 dest 端:
-bash-4.1$ scp /refresh/home/app/11.2.0.4/oracle/product/11.2.0.4/dbhome_4/dbs/data* \> <anotherhost>:/refresh/home/app/11.2.0.4/oracle/product/11.2.0.4/dbhome_4/dbs/我可以在 dest 端执行第一次的 recover copy 命令,来对 image copy 进行 apply:RMAN> RECOVER COPY OF DATABASE WITH TAG 'incr_update';Starting recover at 20210404_09:40:30using channel ORA_DISK_1no copy of datafile 1 found to recoverno copy of datafile 2 found to recoverno copy of datafile 3 found to recoverno copy of datafile 4 found to recoverFinished recover at 20210404_09:40:30RMAN>
在 source 端,进行第一回 level 的增分更新备份:
create table tab001 as select * from dba_objects;Table created.exitDisconnected from Oracle Database 11g Enterprise Edition Release 11.2.0.4.0 - 64bit ProductionWith the Partitioning, OLAP, Data Mining and Real Application Testing options-bash-4.1$rman target /Recovery Manager: Release 11.2.0.4.0 - Production on Sun Apr 4 09:42:49 2021Copyright (c) 1982, 2011, Oracle and/or its affiliates. All rights reserved.connected to target database: ORCL1120 (DBID=3640541495)BACKUP INCREMENTAL LEVEL 1 FOR RECOVER OF COPY WITH TAG 'incr_update' DATABASE format '/refresh/home/bak/%U';Starting backup at 04-APR-21using target database control file instead of recovery catalogallocated channel: ORA_DISK_1channel ORA_DISK_1: SID=1 device type=DISKchannel ORA_DISK_1: starting incremental level 1 datafile backup setchannel ORA_DISK_1: specifying datafile(s) in backup setinput datafile file number=00001 name=/refresh/home/app/11.2.0.4/oracle/oradata/orcl11204/system01.dbfinput datafile file number=00002 name=/refresh/home/app/11.2.0.4/oracle/oradata/orcl11204/sysaux01.dbfinput datafile file number=00003 name=/refresh/home/app/11.2.0.4/oracle/oradata/orcl11204/undotbs01.dbfinput datafile file number=00004 name=/refresh/home/app/11.2.0.4/oracle/oradata/orcl11204/users01.dbfchannel ORA_DISK_1: starting piece 1 at 04-APR-21channel ORA_DISK_1: finished piece 1 at 04-APR-21piece handle=/refresh/home/bak/11vrehl7_1_1 tag=INCR_UPDATE comment=NONEchannel ORA_DISK_1: backup set complete, elapsed time: 00:00:01channel ORA_DISK_1: starting incremental level 1 datafile backup setchannel ORA_DISK_1: specifying datafile(s) in backup setincluding current control file in backup setincluding current SPFILE in backup setchannel ORA_DISK_1: starting piece 1 at 04-APR-21channel ORA_DISK_1: finished piece 1 at 04-APR-21piece handle=/refresh/home/bak/12vrehl8_1_1 tag=INCR_UPDATE comment=NONEchannel ORA_DISK_1: backup set complete, elapsed time: 00:00:01Finished backup at 04-APR-21exit
把这次产生的备份,也拷贝到 dest 端:
-bash-4.1$ scp /refresh/home/bak/* <anotherhost>:/refresh/home/bak/回到 dest 端,注册新产生的备份,然后执行 recover copy 命令:
RMAN> catalog start with '/refresh/home/bak';searching for all files that match the pattern /refresh/home/bakList of Files Unknown to the Database=====================================File Name: /refresh/home/bak/12vrehl8_1_1File Name: /refresh/home/bak/11vrehl7_1_1File Name: /refresh/home/bak/control.bksFile Name: /refresh/home/bak/spfile.bksDo you really want to catalog the above files (enter YES or NO)? yescataloging files...cataloging doneList of Cataloged Files=======================File Name: /refresh/home/bak/12vrehl8_1_1File Name: /refresh/home/bak/11vrehl7_1_1File Name: /refresh/home/bak/control.bksFile Name: /refresh/home/bak/spfile.bksRMAN> RECOVER COPY OF DATABASE WITH TAG 'incr_update';Starting recover at 20210404_09:47:23using channel ORA_DISK_1channel ORA_DISK_1: starting incremental datafile backup set restorechannel ORA_DISK_1: specifying datafile copies to recoverrecovering datafile copy file number=00001 name=/refresh/home/app/11.2.0.4/oracle/product/11.2.0.4/dbhome_4/dbs/data_D-ORCL1120_I-3640541495_TS-SYSTEM_FNO-1_0qvrebt4recovering datafile copy file number=00002 name=/refresh/home/app/11.2.0.4/oracle/product/11.2.0.4/dbhome_4/dbs/data_D-ORCL1120_I-3640541495_TS-SYSAUX_FNO-2_0rvrebtbrecovering datafile copy file number=00003 name=/refresh/home/app/11.2.0.4/oracle/product/11.2.0.4/dbhome_4/dbs/data_D-ORCL1120_I-3640541495_TS-UNDOTBS1_FNO-3_0svrebterecovering datafile copy file number=00004 name=/refresh/home/app/11.2.0.4/oracle/product/11.2.0.4/dbhome_4/dbs/data_D-ORCL1120_I-3640541495_TS-USERS_FNO-4_0uvrebtichannel ORA_DISK_1: reading from backup piece /refresh/home/bak/11vrehl7_1_1channel ORA_DISK_1: piece handle=/refresh/home/bak/11vrehl7_1_1 tag=INCR_UPDATEchannel ORA_DISK_1: restored backup piece 1channel ORA_DISK_1: restore complete, elapsed time: 00:00:01Finished recover at 20210404_09:47:24RMAN-06497: WARNING: control file is not current, control file AUTOBACKUP skippedRMAN>
回到 source 端,执行第二次更新增分备份:
sqlplus / as sysdba: Release 11.2.0.4.0 Production on Sun Apr 4 09:48:44 2021Copyright (c) 1982, 2013, Oracle. All rights reserved.Connected to:Oracle Database 11g Enterprise Edition Release 11.2.0.4.0 - 64bit ProductionWith the Partitioning, OLAP, Data Mining and Real Application Testing optionscreate table tab002 as select * from dba_objects;Table created.exitDisconnected from Oracle Database 11g Enterprise Edition Release 11.2.0.4.0 - 64bit ProductionWith the Partitioning, OLAP, Data Mining and Real Application Testing optionsrman target /Recovery Manager: Release 11.2.0.4.0 - Production on Sun Apr 4 09:49:04 2021Copyright (c) 1982, 2011, Oracle and/or its affiliates. All rights reserved.connected to target database: ORCL1120 (DBID=3640541495)BACKUP INCREMENTAL LEVEL 1 FOR RECOVER OF COPY WITH TAG 'incr_update' DATABASE format '/refresh/home/bak/%U';Starting backup at 04-APR-21using target database control file instead of recovery catalogallocated channel: ORA_DISK_1channel ORA_DISK_1: SID=42 device type=DISKchannel ORA_DISK_1: starting incremental level 1 datafile backup setchannel ORA_DISK_1: specifying datafile(s) in backup setinput datafile file number=00001 name=/refresh/home/app/11.2.0.4/oracle/oradata/orcl11204/system01.dbfinput datafile file number=00002 name=/refresh/home/app/11.2.0.4/oracle/oradata/orcl11204/sysaux01.dbfinput datafile file number=00003 name=/refresh/home/app/11.2.0.4/oracle/oradata/orcl11204/undotbs01.dbfinput datafile file number=00004 name=/refresh/home/app/11.2.0.4/oracle/oradata/orcl11204/users01.dbfchannel ORA_DISK_1: starting piece 1 at 04-APR-21channel ORA_DISK_1: finished piece 1 at 04-APR-21piece handle=/refresh/home/bak/13vrei16_1_1 tag=INCR_UPDATE comment=NONEchannel ORA_DISK_1: backup set complete, elapsed time: 00:00:01channel ORA_DISK_1: starting incremental level 1 datafile backup setchannel ORA_DISK_1: specifying datafile(s) in backup setincluding current control file in backup setincluding current SPFILE in backup setchannel ORA_DISK_1: starting piece 1 at 04-APR-21channel ORA_DISK_1: finished piece 1 at 04-APR-21piece handle=/refresh/home/bak/14vrei17_1_1 tag=INCR_UPDATE comment=NONEchannel ORA_DISK_1: backup set complete, elapsed time: 00:00:01Finished backup at 04-APR-21exitRecovery Manager complete.-bash-4.1$
再次拷贝到 dest 端:把这次产生的备份,也拷贝到 dest 端。
-bash-4.1$ scp /refresh/home/bak/* <anotherhost>:/refresh/home/bak/回到 dest 端,注册新产生的备份,然后执行 recover copy 命令:
RMAN> catalog start with '/refresh/home/bak';searching for all files that match the pattern /refresh/home/bakList of Files Unknown to the Database=====================================File Name: /refresh/home/bak/13vrei16_1_1File Name: /refresh/home/bak/14vrei17_1_1Do you really want to catalog the above files (enter YES or NO)? yescataloging files...cataloging doneList of Cataloged Files=======================File Name: /refresh/home/bak/13vrei16_1_1File Name: /refresh/home/bak/14vrei17_1_1RMAN> RECOVER COPY OF DATABASE WITH TAG 'incr_update';Starting recover at 20210404_09:52:29using channel ORA_DISK_1channel ORA_DISK_1: starting incremental datafile backup set restorechannel ORA_DISK_1: specifying datafile copies to recoverrecovering datafile copy file number=00001 name=/refresh/home/app/11.2.0.4/oracle/product/11.2.0.4/dbhome_4/dbs/data_D-ORCL1120_I-3640541495_TS-SYSTEM_FNO-1_0qvrebt4recovering datafile copy file number=00002 name=/refresh/home/app/11.2.0.4/oracle/product/11.2.0.4/dbhome_4/dbs/data_D-ORCL1120_I-3640541495_TS-SYSAUX_FNO-2_0rvrebtbrecovering datafile copy file number=00003 name=/refresh/home/app/11.2.0.4/oracle/product/11.2.0.4/dbhome_4/dbs/data_D-ORCL1120_I-3640541495_TS-UNDOTBS1_FNO-3_0svrebterecovering datafile copy file number=00004 name=/refresh/home/app/11.2.0.4/oracle/product/11.2.0.4/dbhome_4/dbs/data_D-ORCL1120_I-3640541495_TS-USERS_FNO-4_0uvrebtichannel ORA_DISK_1: reading from backup piece /refresh/home/bak/13vrei16_1_1channel ORA_DISK_1: piece handle=/refresh/home/bak/13vrei16_1_1 tag=INCR_UPDATEchannel ORA_DISK_1: restored backup piece 1channel ORA_DISK_1: restore complete, elapsed time: 00:00:01Finished recover at 20210404_09:52:30RMAN-06497: WARNING: control file is not current, control file AUTOBACKUP skippedRMAN>
好了,现在开始执行最重要的步骤,从source 端作出最新的控制文件备份和 archive log,拷贝到 dest 端:
alter system switch logfile;System altered.exitDisconnected from Oracle Database 11g Enterprise Edition Release 11.2.0.4.0 - 64bit ProductionWith the Partitioning, OLAP, Data Mining and Real Application Testing options-bash-4.1$rman target /Recovery Manager: Release 11.2.0.4.0 - Production on Sun Apr 4 09:54:10 2021Copyright (c) 1982, 2011, Oracle and/or its affiliates. All rights reserved.connected to target database: ORCL1120 (DBID=3640541495)backup current controlfile format '/refresh/home/bak/newcontrol.bks';Starting backup at 04-APR-21using target database control file instead of recovery catalogallocated channel: ORA_DISK_1channel ORA_DISK_1: SID=42 device type=DISKchannel ORA_DISK_1: starting full datafile backup setchannel ORA_DISK_1: specifying datafile(s) in backup setincluding current control file in backup setchannel ORA_DISK_1: starting piece 1 at 04-APR-21channel ORA_DISK_1: finished piece 1 at 04-APR-21piece handle=/refresh/home/bak/newcontrol.bks tag=TAG20210404T095437 comment=NONEchannel ORA_DISK_1: backup set complete, elapsed time: 00:00:01Finished backup at 04-APR-21exitRecovery Manager complete.sqlplus / as sysdba: Release 11.2.0.4.0 Production on Sun Apr 4 09:54:47 2021Copyright (c) 1982, 2013, Oracle. All rights reserved.Connected to:Oracle Database 11g Enterprise Edition Release 11.2.0.4.0 - 64bit ProductionWith the Partitioning, OLAP, Data Mining and Real Application Testing optionsalter system switch logfile;System altered.exit
拷贝新生成的 archive log,到 dest 端:
-bash-4.1$ rman target /Recovery Manager: Release 11.2.0.4.0 - Production on Sun Apr 4 09:59:25 2021Copyright (c) 1982, 2011, Oracle and/or its affiliates. All rights reserved.connected to target database: ORCL1120 (DBID=3640541495)RMAN> list archivelog all;using target database control file instead of recovery catalogList of Archived Log Copies for database with db_unique_name ORCL11204=====================================================================Key Thrd Seq S Low Time------- ---- ------- - ---------14 1 5 A 04-APR-21Name: /refresh/home/app/11.2.0.4/oracle/product/11.2.0.4/dbhome_4/dbs/arch1_5_1068881903.dbf15 1 6 A 04-APR-21Name: /refresh/home/app/11.2.0.4/oracle/product/11.2.0.4/dbhome_4/dbs/arch1_6_1068881903.dbf16 1 7 A 04-APR-21Name: /refresh/home/app/11.2.0.4/oracle/product/11.2.0.4/dbhome_4/dbs/arch1_7_1068881903.dbfRMAN> exit-bash-4.1$ scp /refresh/home/app/11.2.0.4/oracle/product/11.2.0.4/dbhome_4/dbs/arch* <annotherhost>:/refresh/home/bak/
在拷贝最新的控制文件的备份,到 dest 端:
-bash-4.1$ scp /refresh/home/bak/* <anotherhost>:/refresh/home/bak/回到 dest 端,我需要重新使得数据库从 nomount 启动:
shutdown immediatedatabase dismountedOracle instance shut downstartup nomount;connected to target database (not started)Oracle instance startedTotal System Global Area 1570009088 bytesFixed Size 2253584 bytesVariable Size 452988144 bytesDatabase Buffers 1107296256 bytesRedo Buffers 7471104 bytesrestore controlfile from '/refresh/home/bak/newcontrol.bks';Starting restore at 20210404_10:05:15allocated channel: ORA_DISK_1channel ORA_DISK_1: SID=19 device type=DISKchannel ORA_DISK_1: restoring control filechannel ORA_DISK_1: restore complete, elapsed time: 00:00:01output file name=/refresh/home/app/11.2.0.4/oracle/oradata/orcl11204/control01.ctloutput file name=/refresh/home/app/11.2.0.4/oracle/oradata/orcl11204/control02.ctlFinished restore at 20210404_10:05:17alter database mount;database mountedreleased channel: ORA_DISK_1RMAN>
使得新引入的控制文件和实际情况相符:
RMAN> crosscheck copy;allocated channel: ORA_DISK_1channel ORA_DISK_1: SID=19 device type=DISKspecification does not match any control file copy in the repositoryvalidation failed for datafile copydatafile copy file name=/refresh/home/app/11.2.0.4/oracle/product/11.2.0.4/dbhome_4/dbs/data_D-ORCL1120_I-3640541495_TS-SYSTEM_FNO-1_0qvrebt4 RECID=20 STAMP=1068969896validation failed for datafile copydatafile copy file name=/refresh/home/app/11.2.0.4/oracle/product/11.2.0.4/dbhome_4/dbs/data_D-ORCL1120_I-3640541495_TS-SYSAUX_FNO-2_0rvrebtb RECID=21 STAMP=1068969902validation failed for datafile copydatafile copy file name=/refresh/home/app/11.2.0.4/oracle/product/11.2.0.4/dbhome_4/dbs/data_D-ORCL1120_I-3640541495_TS-UNDOTBS1_FNO-3_0svrebte RECID=22 STAMP=1068969903validation failed for datafile copydatafile copy file name=/refresh/home/app/11.2.0.4/oracle/product/11.2.0.4/dbhome_4/dbs/data_D-ORCL1120_I-3640541495_TS-USERS_FNO-4_0uvrebti RECID=23 STAMP=1068969906validation failed for archived logarchived log file name=/refresh/home/app/11.2.0.4/oracle/product/11.2.0.4/dbhome_4/dbs/arch1_5_1068881903.dbf RECID=14 STAMP=1068976138validation failed for archived logarchived log file name=/refresh/home/app/11.2.0.4/oracle/product/11.2.0.4/dbhome_4/dbs/arch1_6_1068881903.dbf RECID=15 STAMP=1068976445Crosschecked 6 objectsRMAN> delete expired copy;released channel: ORA_DISK_1allocated channel: ORA_DISK_1channel ORA_DISK_1: SID=19 device type=DISKspecification does not match any control file copy in the repositoryList of Datafile Copies=======================Key File S Completion Time Ckp SCN Ckp Time------- ---- - ----------------- ---------- -----------------20 1 X 20210404_08:04:56 1047627 20210404_08:04:52Name: /refresh/home/app/11.2.0.4/oracle/product/11.2.0.4/dbhome_4/dbs/data_D-ORCL1120_I-3640541495_TS-SYSTEM_FNO-1_0qvrebt4Tag: INCR_UPDATE21 2 X 20210404_08:05:02 1047631 20210404_08:04:59Name: /refresh/home/app/11.2.0.4/oracle/product/11.2.0.4/dbhome_4/dbs/data_D-ORCL1120_I-3640541495_TS-SYSAUX_FNO-2_0rvrebtbTag: INCR_UPDATE22 3 X 20210404_08:05:03 1047633 20210404_08:05:02Name: /refresh/home/app/11.2.0.4/oracle/product/11.2.0.4/dbhome_4/dbs/data_D-ORCL1120_I-3640541495_TS-UNDOTBS1_FNO-3_0svrebteTag: INCR_UPDATE23 4 X 20210404_08:05:06 1047635 20210404_08:05:06Name: /refresh/home/app/11.2.0.4/oracle/product/11.2.0.4/dbhome_4/dbs/data_D-ORCL1120_I-3640541495_TS-USERS_FNO-4_0uvrebtiTag: INCR_UPDATEList of Archived Log Copies for database with db_unique_name ORCL11204=====================================================================Key Thrd Seq S Low Time------- ---- ------- - -----------------14 1 5 X 20210404_03:10:11Name: /refresh/home/app/11.2.0.4/oracle/product/11.2.0.4/dbhome_4/dbs/arch1_5_1068881903.dbf15 1 6 X 20210404_09:48:58Name: /refresh/home/app/11.2.0.4/oracle/product/11.2.0.4/dbhome_4/dbs/arch1_6_1068881903.dbfDo you really want to delete the above objects (enter YES or NO)? yesdeleted datafile copydatafile copy file name=/refresh/home/app/11.2.0.4/oracle/product/11.2.0.4/dbhome_4/dbs/data_D-ORCL1120_I-3640541495_TS-SYSTEM_FNO-1_0qvrebt4 RECID=20 STAMP=1068969896deleted datafile copydatafile copy file name=/refresh/home/app/11.2.0.4/oracle/product/11.2.0.4/dbhome_4/dbs/data_D-ORCL1120_I-3640541495_TS-SYSAUX_FNO-2_0rvrebtb RECID=21 STAMP=1068969902deleted datafile copydatafile copy file name=/refresh/home/app/11.2.0.4/oracle/product/11.2.0.4/dbhome_4/dbs/data_D-ORCL1120_I-3640541495_TS-UNDOTBS1_FNO-3_0svrebte RECID=22 STAMP=1068969903deleted datafile copydatafile copy file name=/refresh/home/app/11.2.0.4/oracle/product/11.2.0.4/dbhome_4/dbs/data_D-ORCL1120_I-3640541495_TS-USERS_FNO-4_0uvrebti RECID=23 STAMP=1068969906deleted archived logarchived log file name=/refresh/home/app/11.2.0.4/oracle/product/11.2.0.4/dbhome_4/dbs/arch1_5_1068881903.dbf RECID=14 STAMP=1068976138deleted archived logarchived log file name=/refresh/home/app/11.2.0.4/oracle/product/11.2.0.4/dbhome_4/dbs/arch1_6_1068881903.dbf RECID=15 STAMP=1068976445Deleted 6 EXPIRED objectsRMAN> crosscheck backup;using channel ORA_DISK_1crosschecked backup piece: found to be 'AVAILABLE'backup piece handle=/refresh/home/bak/0tvrebtg_1_1 RECID=27 STAMP=1068969905crosschecked backup piece: found to be 'AVAILABLE'backup piece handle=/refresh/home/bak/control.bks RECID=28 STAMP=1068970262crosschecked backup piece: found to be 'AVAILABLE'backup piece handle=/refresh/home/bak/spfile.bks RECID=29 STAMP=1068970271crosschecked backup piece: found to be 'AVAILABLE'backup piece handle=/refresh/home/bak/11vrehl7_1_1 RECID=30 STAMP=1068975783crosschecked backup piece: found to be 'AVAILABLE'backup piece handle=/refresh/home/bak/12vrehl8_1_1 RECID=31 STAMP=1068975785crosschecked backup piece: found to be 'AVAILABLE'backup piece handle=/refresh/home/bak/13vrei16_1_1 RECID=32 STAMP=1068976166crosschecked backup piece: found to be 'AVAILABLE'backup piece handle=/refresh/home/bak/14vrei17_1_1 RECID=33 STAMP=1068976168Crosschecked 7 objectsRMAN> delete expired backup;using channel ORA_DISK_1specification does not match any backup in the repositoryRMAN> catalog start with '/refresh/home/bak';searching for all files that match the pattern /refresh/home/bakList of Files Unknown to the Database=====================================File Name: /refresh/home/bak/arch1_6_1068881903.dbfFile Name: /refresh/home/bak/arch1_7_1068881903.dbfFile Name: /refresh/home/bak/arch1_5_1068881903.dbfFile Name: /refresh/home/bak/newcontrol.bksDo you really want to catalog the above files (enter YES or NO)? yescataloging files...cataloging doneList of Cataloged Files=======================File Name: /refresh/home/bak/arch1_6_1068881903.dbfFile Name: /refresh/home/bak/arch1_7_1068881903.dbfFile Name: /refresh/home/bak/arch1_5_1068881903.dbfFile Name: /refresh/home/bak/newcontrol.bksRMAN> catalog start with '/refresh/home/app/11.2.0.4/oracle/product/11.2.0.4/dbhome_4/dbs';searching for all files that match the pattern /refresh/home/app/11.2.0.4/oracle/product/11.2.0.4/dbhome_4/dbsList of Files Unknown to the Database=====================================File Name: /refresh/home/app/11.2.0.4/oracle/product/11.2.0.4/dbhome_4/dbs/cntrlorcl11204.dbfFile Name: /refresh/home/app/11.2.0.4/oracle/product/11.2.0.4/dbhome_4/dbs/data_D-ORCL1120_I-3640541495_TS-SYSAUX_FNO-2_0rvrebtbFile Name: /refresh/home/app/11.2.0.4/oracle/product/11.2.0.4/dbhome_4/dbs/lkORCL1120File Name: /refresh/home/app/11.2.0.4/oracle/product/11.2.0.4/dbhome_4/dbs/hc_orcl11204.datFile Name: /refresh/home/app/11.2.0.4/oracle/product/11.2.0.4/dbhome_4/dbs/data_D-ORCL1120_I-3640541495_TS-SYSTEM_FNO-1_0qvrebt4File Name: /refresh/home/app/11.2.0.4/oracle/product/11.2.0.4/dbhome_4/dbs/data_D-ORCL1120_I-3640541495_TS-UNDOTBS1_FNO-3_0svrebteFile Name: /refresh/home/app/11.2.0.4/oracle/product/11.2.0.4/dbhome_4/dbs/data_D-ORCL1120_I-3640541495_TS-USERS_FNO-4_0uvrebtiFile Name: /refresh/home/app/11.2.0.4/oracle/product/11.2.0.4/dbhome_4/dbs/init.oraFile Name: /refresh/home/app/11.2.0.4/oracle/product/11.2.0.4/dbhome_4/dbs/lkORCL11204File Name: /refresh/home/app/11.2.0.4/oracle/product/11.2.0.4/dbhome_4/dbs/lkDUMMYFile Name: /refresh/home/app/11.2.0.4/oracle/product/11.2.0.4/dbhome_4/dbs/spfileorcl11204.oraFile Name: /refresh/home/app/11.2.0.4/oracle/product/11.2.0.4/dbhome_4/dbs/orapworcl11204Do you really want to catalog the above files (enter YES or NO)? yescataloging files...cataloging doneList of Cataloged Files=======================File Name: /refresh/home/app/11.2.0.4/oracle/product/11.2.0.4/dbhome_4/dbs/cntrlorcl11204.dbfFile Name: /refresh/home/app/11.2.0.4/oracle/product/11.2.0.4/dbhome_4/dbs/data_D-ORCL1120_I-3640541495_TS-SYSAUX_FNO-2_0rvrebtbFile Name: /refresh/home/app/11.2.0.4/oracle/product/11.2.0.4/dbhome_4/dbs/data_D-ORCL1120_I-3640541495_TS-SYSTEM_FNO-1_0qvrebt4File Name: /refresh/home/app/11.2.0.4/oracle/product/11.2.0.4/dbhome_4/dbs/data_D-ORCL1120_I-3640541495_TS-UNDOTBS1_FNO-3_0svrebteFile Name: /refresh/home/app/11.2.0.4/oracle/product/11.2.0.4/dbhome_4/dbs/data_D-ORCL1120_I-3640541495_TS-USERS_FNO-4_0uvrebtiList of Files Which Where Not Cataloged=======================================File Name: /refresh/home/app/11.2.0.4/oracle/product/11.2.0.4/dbhome_4/dbs/lkORCL1120RMAN-07517: Reason: The file header is corruptedFile Name: /refresh/home/app/11.2.0.4/oracle/product/11.2.0.4/dbhome_4/dbs/hc_orcl11204.datRMAN-07517: Reason: The file header is corruptedFile Name: /refresh/home/app/11.2.0.4/oracle/product/11.2.0.4/dbhome_4/dbs/init.oraRMAN-07517: Reason: The file header is corruptedFile Name: /refresh/home/app/11.2.0.4/oracle/product/11.2.0.4/dbhome_4/dbs/lkORCL11204RMAN-07517: Reason: The file header is corruptedFile Name: /refresh/home/app/11.2.0.4/oracle/product/11.2.0.4/dbhome_4/dbs/lkDUMMYRMAN-07517: Reason: The file header is corruptedFile Name: /refresh/home/app/11.2.0.4/oracle/product/11.2.0.4/dbhome_4/dbs/spfileorcl11204.oraRMAN-07518: Reason: Foreign database file DBID: 0 Database Name:File Name: /refresh/home/app/11.2.0.4/oracle/product/11.2.0.4/dbhome_4/dbs/orapworcl11204RMAN-07517: Reason: The file header is corruptedRMAN> list copy;List of Datafile Copies=======================Key File S Completion Time Ckp SCN Ckp Time------- ---- - ----------------- ---------- -----------------26 1 A 20210404_10:07:49 1050660 20210404_09:49:26Name: /refresh/home/app/11.2.0.4/oracle/product/11.2.0.4/dbhome_4/dbs/data_D-ORCL1120_I-3640541495_TS-SYSTEM_FNO-1_0qvrebt4Tag: INCR_UPDATE25 2 A 20210404_10:07:49 1050660 20210404_09:49:26Name: /refresh/home/app/11.2.0.4/oracle/product/11.2.0.4/dbhome_4/dbs/data_D-ORCL1120_I-3640541495_TS-SYSAUX_FNO-2_0rvrebtbTag: INCR_UPDATE27 3 A 20210404_10:07:49 1050660 20210404_09:49:26Name: /refresh/home/app/11.2.0.4/oracle/product/11.2.0.4/dbhome_4/dbs/data_D-ORCL1120_I-3640541495_TS-UNDOTBS1_FNO-3_0svrebteTag: INCR_UPDATE28 4 A 20210404_10:07:49 1050660 20210404_09:49:26Name: /refresh/home/app/11.2.0.4/oracle/product/11.2.0.4/dbhome_4/dbs/data_D-ORCL1120_I-3640541495_TS-USERS_FNO-4_0uvrebtiTag: INCR_UPDATEList of Control File Copies===========================Key S Completion Time Ckp SCN Ckp Time------- - ----------------- ---------- -----------------24 A 20210404_10:07:49 1034598 20210404_02:16:07Name: /refresh/home/app/11.2.0.4/oracle/product/11.2.0.4/dbhome_4/dbs/cntrlorcl11204.dbfTag: TAG20210404T021607List of Archived Log Copies for database with db_unique_name ORCL11204=====================================================================Key Thrd Seq S Low Time------- ---- ------- - -----------------18 1 5 A 20210404_03:10:11Name: /refresh/home/bak/arch1_5_1068881903.dbf16 1 6 A 20210404_09:48:58Name: /refresh/home/bak/arch1_6_1068881903.dbf17 1 7 A 20210404_09:54:05Name: /refresh/home/bak/arch1_7_1068881903.dbfRMAN> list backup;List of Backup Sets===================BS Key Type LV Size Device Type Elapsed Time Completion Time------- ---- -- ---------- ----------- ------------ -----------------27 Incr 1 9.36M DISK 00:00:01 20210404_08:05:05BP Key: 27 Status: AVAILABLE Compressed: NO Tag: INCR_UPDATEPiece Name: /refresh/home/bak/0tvrebtg_1_1SPFILE Included: Modification time: 20210403_07:39:00SPFILE db_unique_name: ORCL11204Control File Included: Ckp SCN: 1047633 Ckp time: 20210404_08:05:02BS Key Type LV Size Device Type Elapsed Time Completion Time------- ---- -- ---------- ----------- ------------ -----------------28 Full 9.33M DISK 00:00:01 20210404_08:11:02BP Key: 28 Status: AVAILABLE Compressed: NO Tag: TAG20210404T081101Piece Name: /refresh/home/bak/control.bksControl File Included: Ckp SCN: 1048038 Ckp time: 20210404_08:11:01BS Key Type LV Size Device Type Elapsed Time Completion Time------- ---- -- ---------- ----------- ------------ -----------------29 Full 80.00K DISK 00:00:00 20210404_08:11:11BP Key: 29 Status: AVAILABLE Compressed: NO Tag: TAG20210404T081111Piece Name: /refresh/home/bak/spfile.bksSPFILE Included: Modification time: 20210403_07:39:00SPFILE db_unique_name: ORCL11204BS Key Type LV Size Device Type Elapsed Time Completion Time------- ---- -- ---------- ----------- ------------ -----------------30 Incr 1 13.84M DISK 00:00:01 20210404_09:43:04BP Key: 30 Status: AVAILABLE Compressed: NO Tag: INCR_UPDATEPiece Name: /refresh/home/bak/11vrehl7_1_1List of Datafiles in backup set 30File LV Type Ckp SCN Ckp Time Name---- -- ---- ---------- ----------------- ----1 1 Incr 1050428 20210404_09:43:03 /refresh/home/app/11.2.0.4/oracle/oradata/orcl11204/system01.dbf2 1 Incr 1050428 20210404_09:43:03 /refresh/home/app/11.2.0.4/oracle/oradata/orcl11204/sysaux01.dbf3 1 Incr 1050428 20210404_09:43:03 /refresh/home/app/11.2.0.4/oracle/oradata/orcl11204/undotbs01.dbf4 1 Incr 1050428 20210404_09:43:03 /refresh/home/app/11.2.0.4/oracle/oradata/orcl11204/users01.dbfBS Key Type LV Size Device Type Elapsed Time Completion Time------- ---- -- ---------- ----------- ------------ -----------------31 Incr 1 9.36M DISK 00:00:01 20210404_09:43:05BP Key: 31 Status: AVAILABLE Compressed: NO Tag: INCR_UPDATEPiece Name: /refresh/home/bak/12vrehl8_1_1SPFILE Included: Modification time: 20210403_07:39:00SPFILE db_unique_name: ORCL11204Control File Included: Ckp SCN: 1050429 Ckp time: 20210404_09:43:04BS Key Type LV Size Device Type Elapsed Time Completion Time------- ---- -- ---------- ----------- ------------ -----------------32 Incr 1 10.21M DISK 00:00:01 20210404_09:49:27BP Key: 32 Status: AVAILABLE Compressed: NO Tag: INCR_UPDATEPiece Name: /refresh/home/bak/13vrei16_1_1List of Datafiles in backup set 32File LV Type Ckp SCN Ckp Time Name---- -- ---- ---------- ----------------- ----1 1 Incr 1050660 20210404_09:49:26 /refresh/home/app/11.2.0.4/oracle/oradata/orcl11204/system01.dbf2 1 Incr 1050660 20210404_09:49:26 /refresh/home/app/11.2.0.4/oracle/oradata/orcl11204/sysaux01.dbf3 1 Incr 1050660 20210404_09:49:26 /refresh/home/app/11.2.0.4/oracle/oradata/orcl11204/undotbs01.dbf4 1 Incr 1050660 20210404_09:49:26 /refresh/home/app/11.2.0.4/oracle/oradata/orcl11204/users01.dbfBS Key Type LV Size Device Type Elapsed Time Completion Time------- ---- -- ---------- ----------- ------------ -----------------33 Incr 1 9.36M DISK 00:00:01 20210404_09:49:28BP Key: 33 Status: AVAILABLE Compressed: NO Tag: INCR_UPDATEPiece Name: /refresh/home/bak/14vrei17_1_1SPFILE Included: Modification time: 20210403_07:39:00SPFILE db_unique_name: ORCL11204Control File Included: Ckp SCN: 1050660 Ckp time: 20210404_09:49:26BS Key Type LV Size Device Type Elapsed Time Completion Time------- ---- -- ---------- ----------- ------------ -----------------34 Full 9.33M DISK 00:00:00 20210404_09:54:37BP Key: 34 Status: AVAILABLE Compressed: NO Tag: TAG20210404T095437Piece Name: /refresh/home/bak/newcontrol.bksControl File Included: Ckp SCN: 1050826 Ckp time: 20210404_09:54:37RMAN>
在我准备在 dest 端,进行数据库的真正的 recover之前,需要提到一点,有时候,客户环境的 image copy 很大,达到好几个TB,这时候,可以考虑用 switch copy 命令,这个命令跳过了 restore 过程,把 image copy 直接在当前的位置转换为数据文件。
RMAN> switch database to copy;datafile 1 switched to datafile copy "/refresh/home/app/11.2.0.4/oracle/product/11.2.0.4/dbhome_4/dbs/data_D-ORCL1120_I-3640541495_TS-SYSTEM_FNO-1_0qvrebt4"datafile 2 switched to datafile copy "/refresh/home/app/11.2.0.4/oracle/product/11.2.0.4/dbhome_4/dbs/data_D-ORCL1120_I-3640541495_TS-SYSAUX_FNO-2_0rvrebtb"datafile 3 switched to datafile copy "/refresh/home/app/11.2.0.4/oracle/product/11.2.0.4/dbhome_4/dbs/data_D-ORCL1120_I-3640541495_TS-UNDOTBS1_FNO-3_0svrebte"datafile 4 switched to datafile copy "/refresh/home/app/11.2.0.4/oracle/product/11.2.0.4/dbhome_4/dbs/data_D-ORCL1120_I-3640541495_TS-USERS_FNO-4_0uvrebti"RMAN> list copy;List of Datafile Copies=======================Key File S Completion Time Ckp SCN Ckp Time------- ---- - ----------------- ---------- -----------------29 1 A 20210404_10:11:36 1047627 20210404_08:04:52Name: /refresh/home/app/11.2.0.4/oracle/oradata/orcl11204/system01.dbfTag: INCR_UPDATE30 2 A 20210404_10:11:36 1047631 20210404_08:04:59Name: /refresh/home/app/11.2.0.4/oracle/oradata/orcl11204/sysaux01.dbfTag: INCR_UPDATE31 3 A 20210404_10:11:36 1047633 20210404_08:05:02Name: /refresh/home/app/11.2.0.4/oracle/oradata/orcl11204/undotbs01.dbfTag: INCR_UPDATE32 4 A 20210404_10:11:36 1047635 20210404_08:05:06Name: /refresh/home/app/11.2.0.4/oracle/oradata/orcl11204/users01.dbfTag: INCR_UPDATEList of Control File Copies===========================Key S Completion Time Ckp SCN Ckp Time------- - ----------------- ---------- -----------------24 A 20210404_10:07:49 1034598 20210404_02:16:07Name: /refresh/home/app/11.2.0.4/oracle/product/11.2.0.4/dbhome_4/dbs/cntrlorcl11204.dbfTag: TAG20210404T021607List of Archived Log Copies for database with db_unique_name ORCL11204=====================================================================Key Thrd Seq S Low Time------- ---- ------- - -----------------18 1 5 A 20210404_03:10:11Name: /refresh/home/bak/arch1_5_1068881903.dbf16 1 6 A 20210404_09:48:58Name: /refresh/home/bak/arch1_6_1068881903.dbf17 1 7 A 20210404_09:54:05Name: /refresh/home/bak/arch1_7_1068881903.dbfRMAN> recover database;Starting recover at 20210404_10:11:49using channel ORA_DISK_1starting media recoveryarchived log for thread 1 with sequence 6 is already on disk as file /refresh/home/bak/arch1_6_1068881903.dbfarchived log for thread 1 with sequence 7 is already on disk as file /refresh/home/bak/arch1_7_1068881903.dbfarchived log file name=/refresh/home/bak/arch1_6_1068881903.dbf thread=1 sequence=6archived log file name=/refresh/home/bak/arch1_7_1068881903.dbf thread=1 sequence=7unable to find archived logarchived log thread=1 sequence=8RMAN-00571: ===========================================================RMAN-00569: =============== ERROR MESSAGE STACK FOLLOWS ===============RMAN-00571: ===========================================================RMAN-03002: failure of recover command at 04/04/2021 10:11:49RMAN-06054: media recovery requesting unknown archived log for thread 1 with sequence 8 and starting SCN of 1050839RMAN> alter database open resetlogs;database openedRMAN>
至此,数据库的 restore/recover 成功了,我们再看看新的数据库文件的数据文件状况:
select name from v$datafile;NAME--------------------------------------------------------------------------------/refresh/home/app/11.2.0.4/oracle/product/11.2.0.4/dbhome_4/dbs/data_D-ORCL1120_I-3640541495_TS-SYSTEM_FNO-1_0qvrebt4/refresh/home/app/11.2.0.4/oracle/product/11.2.0.4/dbhome_4/dbs/data_D-ORCL1120_I-3640541495_TS-SYSAUX_FNO-2_0rvrebtb/refresh/home/app/11.2.0.4/oracle/product/11.2.0.4/dbhome_4/dbs/data_D-ORCL1120_I-3640541495_TS-UNDOTBS1_FNO-3_0svrebte/refresh/home/app/11.2.0.4/oracle/product/11.2.0.4/dbhome_4/dbs/data_D-ORCL1120_I-3640541495_TS-USERS_FNO-4_0uvrebtiNAME--------------------------------------------------------------------------------SQL>
后续文章更加精彩,欢迎关注本公众号或访问【阅读原文】。
——End——
专注于技术不限于技术!
用碎片化的时间,一点一滴地提高数据库技术和个人能力。
欢迎关注!
备份恢复系列:
原文作者:SQL和数据库技术;如有侵权,请联系管理员删除。