Oracle Database - Enterprise Edition - 版本 18.1.0.0.0 和更高版本
在此文档中,以如下虚拟环境为例来描述这个过程:
Standby Name: SBY180
Primary Name: PRM180
Directory Name: /u01/app/oracle and all sub-directories
通常,当使用主库的增量备份对一个物理备库执行前滚操作时,需要多个步骤
确定备库上的起始SCN,从而在主库上执行增量备份
使用FROM SCN语句在主库上执行增量备份
将备份片从主库移动到备库
在备库上对备份片执行catalog
在备库上使用recover database noredo执行恢复
从主库再次刷新备库控制文件
从12.1开始,我们可以使用"RECOVER DATABASE FROM SERVICE"命令,它会自动处理一些步骤,比如在主库上执行增量备份,通过网络转移备份片到备库,以及在备库上执行恢复。然而,我们仍然必须手动刷新备库控制文件并手动还原新增加的数据文件。这些步骤需要手动执行,并且易于带来错误,尤其是当备库文件的物理位置与主库不同的时候。
从18.1开始,我们可以使用一条命令来将主库上的改变刷新到备库:
RMAN> RECOVER STANDBY DATABASE FROM SERVICE primary_connect_identifier;
这条命令会内部的追踪备库文件的位置,从主库刷新备库控制文件,用备库文件名更新新的备库控制文件,在主库执行增量备份,通过网络转移备份片到备库并且在备库执行恢复。
- 要刷新备库,确保备库上managed recovery已经停止:
SQL> recover managed standby database cancel;
复制
- 如果备库是拥有超过一个实例的RAC环境,那么确保仅仅要执行recover standby命令的实例是mount状态,而其它所有实例都被关闭,这样可避免遇到 RMAN-05157。
- 在物理备库的tnsnames.ora文件中增加一个对应主库的条目,以确保主库和备库之间的Oracle网络连接已经建立,在下面的例子中,PRM180是到主库的连接标识符.
- 使用RMAN以target模式连接到备库,运行 "RECOVER STANDBY DATABASE FROM SERVICE"命令,下面是一个运行这条命令的例子:
$ export ORACLE_SID=SBY180 $ rman target / RMAN> RECOVER STANDBY DATABASE FROM SERVICE PRM180; RMAN-03090: Starting recover at 03-AUG-18 RMAN-06009: using target database control file instead of recovery catalog RMAN-06196: Oracle instance started Total System Global Area 671086904 bytes Fixed Size 8661304 bytes Variable Size 188743680 bytes Database Buffers 465567744 bytes Redo Buffers 8114176 bytes RMAN-08161: contents of Memory Script: { restore standby controlfile from service 'PRM180'; alter database mount standby database; } RMAN-08162: executing Memory Script RMAN-03090: Starting restore at 03-AUG-18 RMAN-08030: allocated channel: ORA_DISK_1 RMAN-08500: channel ORA_DISK_1: SID=141 device type=DISK RMAN-08016: channel ORA_DISK_1: starting datafile backup set restore RMAN-08169: channel ORA_DISK_1: using network backup set from service PRM180 RMAN-08021: channel ORA_DISK_1: restoring control file RMAN-08180: channel ORA_DISK_1: restore complete, elapsed time: 00:00:01 RMAN-08505: output file name=/u01/app/oracle/oradata/SBY180/control01.ctl RMAN-03091: Finished restore at 03-AUG-18 RMAN-08031: released channel: ORA_DISK_1 RMAN-06986: Statement processed RMAN-06958: Executing: alter system set standby_file_management=manual RMAN-08161: contents of Memory Script: { recover database from service 'PRM180'; } RMAN-08162: executing Memory Script RMAN-03090: Starting recover at 03-AUG-18 RMAN-08030: allocated channel: ORA_DISK_1 RMAN-08500: channel ORA_DISK_1: SID=149 device type=DISK RMAN-06179: datafile 4 not processed because file is read-only RMAN-08039: channel ORA_DISK_1: starting incremental datafile backup set restore RMAN-08169: channel ORA_DISK_1: using network backup set from service PRM180 RMAN-08509: destination for restore of datafile 00001: /u01/app/oracle/oradata/SBY180/system01.dbf RMAN-08180: channel ORA_DISK_1: restore complete, elapsed time: 00:00:03 RMAN-08039: channel ORA_DISK_1: starting incremental datafile backup set restore RMAN-08169: channel ORA_DISK_1: using network backup set from service PRM180 RMAN-08509: destination for restore of datafile 00002: /u01/app/oracle/oradata/SBY180/sysaux01.dbf RMAN-08180: channel ORA_DISK_1: restore complete, elapsed time: 00:00:07 RMAN-08039: channel ORA_DISK_1: starting incremental datafile backup set restore RMAN-08169: channel ORA_DISK_1: using network backup set from service PRM180 RMAN-08509: destination for restore of datafile 00003: /u01/app/oracle/oradata/SBY180/undotbs01.dbf RMAN-08180: channel ORA_DISK_1: restore complete, elapsed time: 00:00:03 RMAN-08054: starting media recovery RMAN-08181: media recovery complete, elapsed time: 00:00:00 RMAN-03091: Finished recover at 03-AUG-18 RMAN-06958: Executing: alter system set standby_file_management=auto RMAN-03091: Finished recover at 03-AUG-18
复制
「喜欢这篇文章,您的关注和赞赏是给作者最好的鼓励」
关注作者
【版权声明】本文为墨天轮用户原创内容,转载时必须标注文章的来源(墨天轮),文章链接,文章作者等基本信息,否则作者和墨天轮有权追究责任。如果您发现墨天轮中有涉嫌抄袭或者侵权的内容,欢迎发送邮件至:contact@modb.pro进行举报,并提供相关证据,一经查实,墨天轮将立刻删除相关内容。