ITPub博客

首页 > 数据库 > 数据库开发技术 > Oracle数据库工程师手记:备份恢复双城记(二)

Oracle数据库工程师手记:备份恢复双城记(二)

原创 数据库开发技术 作者:lukeunique 时间:2021-04-28 08:18:00 0 删除 编辑

编者按:

本文作者系大连健哥, POSTGRESQL、ORACLE 数据库资深从业人员、IT 技术的深度爱好者。相信科学改变人类、技术创造未来。个人主页:https://www.cnblogs.com/gaojian/,经其本人授权发布。


【免责声明】本公众号文章仅代表个人观点,与任何公司无关。

Oracle数据库工程师手记:备份恢复双城记(一)

现在,我真的开始进行两台机器之间的备份、恢复试验了。


    首先,在source 端,进行第一次备份(level 0 增分备份 +  控制文件备份+ SPFILE 增分备份):


RMAN> backup incremental level 0 database format '/refresh/home/bak00/%U'; Starting backup at 20210404_02:13:32using target database control file instead of recovery catalogallocated channel: ORA_DISK_1channel ORA_DISK_1: SID=39 device type=DISKchannel ORA_DISK_1: starting incremental level 0 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 20210404_02:13:32channel ORA_DISK_1: finished piece 1 at 20210404_02:13:39piece handle=/refresh/home/bak00/0cvrdnac_1_1 tag=TAG20210404T021332 comment=NONEchannel ORA_DISK_1: backup set complete, elapsed time: 00:00:07channel ORA_DISK_1: starting incremental level 0 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_02:13:40channel ORA_DISK_1: finished piece 1 at 20210404_02:13:41piece handle=/refresh/home/bak00/0dvrdnaj_1_1 tag=TAG20210404T021332 comment=NONEchannel ORA_DISK_1: backup set complete, elapsed time: 00:00:01Finished backup at 20210404_02:13:42 RMAN> backup current controlfile format '/refresh/home/bak00/control.bks'; Starting backup at 20210404_02:16:07using 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_02:16:08channel ORA_DISK_1: finished piece 1 at 20210404_02:16:09piece handle=/refresh/home/bak00/control.bks tag=TAG20210404T021607 comment=NONEchannel ORA_DISK_1: backup set complete, elapsed time: 00:00:01Finished backup at 20210404_02:16:09 RMAN> backup spfile format '/refresh/home/bak00/spfile.bks'; Starting backup at 20210404_02:16:31using 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_02:16:31channel ORA_DISK_1: finished piece 1 at 20210404_02:16:32piece handle=/refresh/home/bak00/spfile.bks tag=TAG20210404T021631 comment=NONEchannel ORA_DISK_1: backup set complete, elapsed time: 00:00:01Finished backup at 20210404_02:16:32 RMAN>


 接下来,拷贝这些备份到新数据库:


-bash-4.1$ scp /refresh/home/bak00/* <anotherhost>:/refresh/home/bak00/

 登录到 dest 端,进行初步的恢复动作:

RMAN> restore spfile from '/refresh/home/bak00/spfile.bks'; Starting restore at 04-APR-21allocated channel: ORA_DISK_1channel ORA_DISK_1: SID=19 device type=DISK channel ORA_DISK_1: restoring spfile from AUTOBACKUP /refresh/home/bak00/spfile.bkschannel ORA_DISK_1: SPFILE restore from AUTOBACKUP completeFinished restore at 04-APR-21 RMAN> restore spfile to pfile '/tmp/initnewdb.ora' from '/refresh/home/bak00/spfile.bks'; Starting restore at 04-APR-21using channel ORA_DISK_1 channel ORA_DISK_1: restoring spfile from AUTOBACKUP /refresh/home/bak00/spfile.bkschannel ORA_DISK_1: SPFILE restore from AUTOBACKUP completeFinished restore at 04-APR-21 RMAN>exit


 查看生成的 /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$


 如果各目录已经建立好了,那么就可以进行 restore 操作:


-bash-4.1$ rman target / Recovery Manager: Release 11.2.0.4.0 - Production on Sun Apr 4 02:42:50 2021 Copyright (c) 1982, 2011, Oracle and/or its affiliates.  All rights reserved. connected to target database: DUMMY (not mounted) RMAN> shutdown immediate using target database control file instead of recovery catalogOracle instance shut down RMAN> startup nomount; connected to target database (not started)Oracle instance started Total System Global Area    1570009088 bytes Fixed Size                     2253584 bytesVariable Size                452988144 bytesDatabase Buffers            1107296256 bytesRedo Buffers                   7471104 bytes RMAN> restore controlfile from '/refresh/home/bak00/control.bks'; Starting restore at 04-APR-21allocated channel: ORA_DISK_1channel ORA_DISK_1: SID=19 device type=DISK channel 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-21 RMAN> alter database mount; database mountedreleased channel: ORA_DISK_1 RMAN>


利用 level 0 的增量备份,进行 restore 操作:


RMAN> restore database; Starting restore at 04-APR-21using channel ORA_DISK_1 channel ORA_DISK_1: starting datafile backup set restorechannel ORA_DISK_1: specifying datafile(s) to restore from backup setchannel ORA_DISK_1: restoring datafile 00001 to /refresh/home/app/11.2.0.4/oracle/oradata/orcl11204/system01.dbfchannel ORA_DISK_1: restoring datafile 00002 to /refresh/home/app/11.2.0.4/oracle/oradata/orcl11204/sysaux01.dbfchannel ORA_DISK_1: restoring datafile 00003 to /refresh/home/app/11.2.0.4/oracle/oradata/orcl11204/undotbs01.dbfchannel ORA_DISK_1: restoring datafile 00004 to /refresh/home/app/11.2.0.4/oracle/oradata/orcl11204/users01.dbfchannel ORA_DISK_1: reading from backup piece /refresh/home/bak00/0cvrdnac_1_1channel ORA_DISK_1: piece handle=/refresh/home/bak00/0cvrdnac_1_1 tag=TAG20210404T021332channel ORA_DISK_1: restored backup piece 1channel ORA_DISK_1: restore complete, elapsed time: 00:00:07Finished restore at 04-APR-21 RMAN>


回到 source 端,进行 level 1 增分备份:

SQL> create table tab001 as select * from dba_objects; Table created. SQL> 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 02:46:19 2021 Copyright (c) 1982, 2011, Oracle and/or its affiliates.  All rights reserved. connected to target database: ORCL1120 (DBID=3640541495) RMAN> backup incremental level 1 database format '/refresh/home/bak01/%U'; Starting backup at 20210404_02:46:48using target database control file instead of recovery catalogallocated channel: ORA_DISK_1channel ORA_DISK_1: SID=39 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 20210404_02:46:48channel ORA_DISK_1: finished piece 1 at 20210404_02:46:51piece handle=/refresh/home/bak01/0gvrdp8o_1_1 tag=TAG20210404T024648 comment=NONEchannel ORA_DISK_1: backup set complete, elapsed time: 00:00:03channel 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_02:46:52channel ORA_DISK_1: finished piece 1 at 20210404_02:46:53piece handle=/refresh/home/bak01/0hvrdp8r_1_1 tag=TAG20210404T024648 comment=NONEchannel ORA_DISK_1: backup set complete, elapsed time: 00:00:01Finished backup at 20210404_02:46:53 RMAN> exit

 将第一次 level 1 增分备份,拷贝到 dest 端:


-bash-4.1$ scp /refresh/home/bak01/* <anotherhost>:/refresh/home/bak01/

 在 dest 端,进行第一次 recover 操作:


RMAN> catalog start with '/refresh/home/bak01'; searching for all files that match the pattern /refresh/home/bak01 List of Files Unknown to the Database=====================================File Name: /refresh/home/bak01/0gvrdp8o_1_1File Name: /refresh/home/bak01/0hvrdp8r_1_1 Do you really want to catalog the above files (enter YES or NO)? yescataloging files...cataloging done List of Cataloged Files=======================File Name: /refresh/home/bak01/0gvrdp8o_1_1File Name: /refresh/home/bak01/0hvrdp8r_1_1 RMAN> recover database; Starting recover at 04-APR-21using channel ORA_DISK_1channel ORA_DISK_1: starting incremental datafile backup set restorechannel ORA_DISK_1: specifying datafile(s) to restore from backup setdestination for restore of datafile 00001: /refresh/home/app/11.2.0.4/oracle/oradata/orcl11204/system01.dbfdestination for restore of datafile 00002: /refresh/home/app/11.2.0.4/oracle/oradata/orcl11204/sysaux01.dbfdestination for restore of datafile 00003: /refresh/home/app/11.2.0.4/oracle/oradata/orcl11204/undotbs01.dbfdestination for restore of datafile 00004: /refresh/home/app/11.2.0.4/oracle/oradata/orcl11204/users01.dbfchannel ORA_DISK_1: reading from backup piece /refresh/home/bak01/0gvrdp8o_1_1channel ORA_DISK_1: piece handle=/refresh/home/bak01/0gvrdp8o_1_1 tag=TAG20210404T024648channel ORA_DISK_1: restored backup piece 1channel ORA_DISK_1: restore complete, elapsed time: 00:00:01 starting media recovery unable to find archived logarchived log thread=1 sequence=3RMAN-00571: ===========================================================RMAN-00569: =============== ERROR MESSAGE STACK FOLLOWS ===============RMAN-00571: ===========================================================RMAN-03002: failure of recover command at 04/04/2021 02:56:50RMAN-06054: media recovery requesting unknown archived log for thread 1 with sequence 3 and starting SCN of 1034598 RMAN>

对出现的错误不用管。


回到 source 端,进行第二次的 level 1 增分备份:

SQL> create table tab002 as select * from dba_objects; Table created. SQL> exit  RMAN> backup incremental level 1 database format '/refresh/home/bak02/%U'; Starting backup at 20210404_03:02:46using channel ORA_DISK_1channel 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 20210404_03:02:46channel ORA_DISK_1: finished piece 1 at 20210404_03:02:49piece handle=/refresh/home/bak02/0jvrdq6m_1_1 tag=TAG20210404T030246 comment=NONEchannel ORA_DISK_1: backup set complete, elapsed time: 00:00:03channel 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_03:02:51channel ORA_DISK_1: finished piece 1 at 20210404_03:02:52piece handle=/refresh/home/bak02/0kvrdq6q_1_1 tag=TAG20210404T030246 comment=NONEchannel ORA_DISK_1: backup set complete, elapsed time: 00:00:01Finished backup at 20210404_03:02:52 RMAN>

 再次拷贝第二次的level 1 增分备份到 dest 端去。


-bash-4.1$ scp /refresh/home/bak02/* <anotherhost>:/refresh/home/bak02/

 回到 dest 端,执行第二次 recover:


RMAN> catalog start with '/refresh/home/bak02'; searching for all files that match the pattern /refresh/home/bak02 List of Files Unknown to the Database=====================================File Name: /refresh/home/bak02/0kvrdq6q_1_1File Name: /refresh/home/bak02/0jvrdq6m_1_1 Do you really want to catalog the above files (enter YES or NO)? yescataloging files...cataloging done List of Cataloged Files=======================File Name: /refresh/home/bak02/0kvrdq6q_1_1File Name: /refresh/home/bak02/0jvrdq6m_1_1 RMAN> recover database; Starting recover at 04-APR-21using channel ORA_DISK_1channel ORA_DISK_1: starting incremental datafile backup set restorechannel ORA_DISK_1: specifying datafile(s) to restore from backup setdestination for restore of datafile 00001: /refresh/home/app/11.2.0.4/oracle/oradata/orcl11204/system01.dbfdestination for restore of datafile 00002: /refresh/home/app/11.2.0.4/oracle/oradata/orcl11204/sysaux01.dbfdestination for restore of datafile 00003: /refresh/home/app/11.2.0.4/oracle/oradata/orcl11204/undotbs01.dbfdestination for restore of datafile 00004: /refresh/home/app/11.2.0.4/oracle/oradata/orcl11204/users01.dbfchannel ORA_DISK_1: reading from backup piece /refresh/home/bak02/0jvrdq6m_1_1channel ORA_DISK_1: piece handle=/refresh/home/bak02/0jvrdq6m_1_1 tag=TAG20210404T030246channel ORA_DISK_1: restored backup piece 1channel ORA_DISK_1: restore complete, elapsed time: 00:00:01 starting media recovery unable to find archived logarchived log thread=1 sequence=3RMAN-00571: ===========================================================RMAN-00569: =============== ERROR MESSAGE STACK FOLLOWS ===============RMAN-00571: ===========================================================RMAN-03002: failure of recover command at 04/04/2021 03:07:16RMAN-06054: media recovery requesting unknown archived log for thread 1 with sequence 3 and starting SCN of 1034598 RMAN>

 对错误不必在意。


现在到了最关键的一步了。我要从 source端,获得最新的 controlfile 备份,拷贝到 dest 端去:


SQL> alter system switch logfile; System altered. SQL> 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 03:09:20 2021 Copyright (c) 1982, 2011, Oracle and/or its affiliates.  All rights reserved. connected to target database: ORCL1120 (DBID=3640541495) RMAN> backup current controlfile format '/refresh/home/bak03/newcontrol.bks'; Starting backup at 20210404_03:09:49using target database control file instead of recovery catalogallocated channel: ORA_DISK_1channel ORA_DISK_1: SID=41 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 20210404_03:09:51channel ORA_DISK_1: finished piece 1 at 20210404_03:09:52piece handle=/refresh/home/bak03/newcontrol.bks tag=TAG20210404T030950 comment=NONEchannel ORA_DISK_1: backup set complete, elapsed time: 00:00:01Finished backup at 20210404_03:09:52 RMAN> exit  Recovery Manager complete.-bash-4.1$-bash-4.1$ sqlplus / as sysdba SQL*Plus: Release 11.2.0.4.0 Production on Sun Apr 4 03:09:59 2021 Copyright (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 options SQL> alter system switch logfile; System altered. SQL> 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 03:10:21 2021 Copyright (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------- ---- ------- - -----------------12      1    3       A 20210404_02:04:27        Name: /refresh/home/app/11.2.0.4/oracle/product/11.2.0.4/dbhome_4/dbs/arch1_3_1068881903.dbf 13      1    4       A 20210404_03:09:14        Name: /refresh/home/app/11.2.0.4/oracle/product/11.2.0.4/dbhome_4/dbs/arch1_4_1068881903.dbf  RMAN>

 拷贝我刚才生成的archive log 和 controlfile 备份到 dest端:


-bash-4.1$ scp /refresh/home/app/11.2.0.4/oracle/product/11.2.0.4/dbhome_4/dbs/arch* <anotherhost>:/refresh/home/bak03-bash-4.1$ scp /refresh/home/bak03/* <anotherhost>:/refresh/home/bak03/

 回到 dest 端,先恢复 control file,再重新注册这些备份和 archivelog:


-bash-4.1$ rman target / Recovery Manager: Release 11.2.0.4.0 - Production on Sun Apr 4 03:17:23 2021 Copyright (c) 1982, 2011, Oracle and/or its affiliates.  All rights reserved. connected to target database: ORCL1120 (DBID=3640541495, not open) RMAN> shutdown immediate using target database control file instead of recovery catalogdatabase dismountedOracle instance shut down RMAN> startup nomount; connected to target database (not started)Oracle instance started Total System Global Area    1570009088 bytes Fixed Size                     2253584 bytesVariable Size                452988144 bytesDatabase Buffers            1107296256 bytesRedo Buffers                   7471104 bytes RMAN> restore controlfile from '/refresh/home/bak03/newcontrol.bks'; Starting restore at 04-APR-21allocated channel: ORA_DISK_1channel ORA_DISK_1: SID=19 device type=DISK channel 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-21 RMAN> alter database mount; database mountedreleased channel: ORA_DISK_1 RMAN> crosscheck copy; allocated channel: ORA_DISK_1channel ORA_DISK_1: SID=19 device type=DISKspecification does not match any datafile copy in the repositoryspecification does not match any control file copy in the repositoryvalidation failed for archived logarchived log file name=/refresh/home/app/11.2.0.4/oracle/product/11.2.0.4/dbhome_4/dbs/arch1_3_1068881903.dbf RECID=12 STAMP=1068952155Crosschecked 1 objects  RMAN> delete expired copy; released channel: ORA_DISK_1allocated channel: ORA_DISK_1channel ORA_DISK_1: SID=19 device type=DISKspecification does not match any datafile copy in the repositoryspecification does not match any control file copy in the repositoryList of Archived Log Copies for database with db_unique_name ORCL11204===================================================================== Key     Thrd Seq     S Low Time------- ---- ------- - ---------12      1    3       X 04-APR-21        Name: /refresh/home/app/11.2.0.4/oracle/product/11.2.0.4/dbhome_4/dbs/arch1_3_1068881903.dbf  Do you really want to delete the above objects (enter YES or NO)? yesdeleted archived logarchived log file name=/refresh/home/app/11.2.0.4/oracle/product/11.2.0.4/dbhome_4/dbs/arch1_3_1068881903.dbf RECID=12 STAMP=1068952155Deleted 1 EXPIRED objects  RMAN> crosscheck backup; using channel ORA_DISK_1crosschecked backup piece: found to be 'AVAILABLE'backup piece handle=/refresh/home/bak00/0cvrdnac_1_1 RECID=18 STAMP=1068948812crosschecked backup piece: found to be 'AVAILABLE'backup piece handle=/refresh/home/bak00/0dvrdnaj_1_1 RECID=19 STAMP=1068948820crosschecked backup piece: found to be 'AVAILABLE'backup piece handle=/refresh/home/bak00/control.bks RECID=20 STAMP=1068948968crosschecked backup piece: found to be 'AVAILABLE'backup piece handle=/refresh/home/bak00/spfile.bks RECID=21 STAMP=1068948991crosschecked backup piece: found to be 'AVAILABLE'backup piece handle=/refresh/home/bak01/0gvrdp8o_1_1 RECID=22 STAMP=1068950808crosschecked backup piece: found to be 'AVAILABLE'backup piece handle=/refresh/home/bak01/0hvrdp8r_1_1 RECID=23 STAMP=1068950812crosschecked backup piece: found to be 'AVAILABLE'backup piece handle=/refresh/home/bak02/0jvrdq6m_1_1 RECID=24 STAMP=1068951767crosschecked backup piece: found to be 'AVAILABLE'backup piece handle=/refresh/home/bak02/0kvrdq6q_1_1 RECID=25 STAMP=1068951771Crosschecked 8 objects  RMAN> delete expired backup; using channel ORA_DISK_1specification does not match any backup in the repository RMAN> catalog start with '/refres/home/bak00'; searching for all files that match the pattern /refres/home/bak00no files found to be unknown to the database  RMAN> catalog start with '/refresh/home/bak00'; searching for all files that match the pattern /refresh/home/bak00no files found to be unknown to the database RMAN> catalog start with '/refresh/home/bak01'; searching for all files that match the pattern /refresh/home/bak01no files found to be unknown to the database RMAN> catalog start with '/refresh/home/bak02'; searching for all files that match the pattern /refresh/home/bak02no files found to be unknown to the database RMAN> catalog start with '/refresh/home/bak03'; searching for all files that match the pattern /refresh/home/bak03 List of Files Unknown to the Database=====================================File Name: /refresh/home/bak03/arch1_3_1068881903.dbfFile Name: /refresh/home/bak03/newcontrol.bksFile Name: /refresh/home/bak03/arch1_4_1068881903.dbf Do you really want to catalog the above files (enter YES or NO)? yescataloging files...cataloging done List of Cataloged Files=======================File Name: /refresh/home/bak03/arch1_3_1068881903.dbfFile Name: /refresh/home/bak03/newcontrol.bksFile Name: /refresh/home/bak03/arch1_4_1068881903.dbf

 然后,执行最后的 recover 操作:


RMAN> recover database; Starting recover at 04-APR-21using channel ORA_DISK_1 starting media recovery archived log for thread 1 with sequence 3 is already on disk as file /refresh/home/bak03/arch1_3_1068881903.dbfarchived log for thread 1 with sequence 4 is already on disk as file /refresh/home/bak03/arch1_4_1068881903.dbfarchived log file name=/refresh/home/bak03/arch1_3_1068881903.dbf thread=1 sequence=3archived log file name=/refresh/home/bak03/arch1_4_1068881903.dbf thread=1 sequence=4unable to find archived logarchived log thread=1 sequence=5RMAN-00571: ===========================================================RMAN-00569: =============== ERROR MESSAGE STACK FOLLOWS ===============RMAN-00571: ===========================================================RMAN-03002: failure of recover command at 04/04/2021 03:20:16RMAN-06054: media recovery requesting unknown archived log for thread 1 with sequence 5 and starting SCN of 1036145  RMAN> alter database open resetlogs; database opened RMAN>

 可以看到,已经成功恢复了。


也就是说,可以在 source 端和 target 端,多次传递备份,进行多次的 recover 操作,这样,对用户而言,down time 只发生在 source 端停机后,直到 dest 端最后一次 recover 后 alter database open resetlogs 结束为止。


后续文章更加精彩,欢迎关注本公众号或访问【阅读原文】。

——End——


专注于技术不限于技术!

用碎片化的时间,一点一滴地提高数据库技术和个人能力。

欢迎关注!



备份恢复系列:

Oracle数据库工程师手记:备份恢复双城记(一)



原文作者:SQL和数据库技术;如有侵权,请联系管理员删除。

请登录后发表评论 登录
全部评论

注册时间:2017-07-21

  • 博文量
    107
  • 访问量
    63571