用于解决存档日志文件丢失或损坏、无法解决的存档间隙或需要在不应用大量存档日志文件的情况下及时前滚备用数据库的问题。
备库关闭mrp后确认当前scn RECOVER MANAGED STANDBY DATABASE CANCEL; SELECT CURRENT_SCN FROM V$DATABASE;
主库发起增量备份(依据上面查出来的scn) BACKUP INCREMENTAL FROM SCN 3162298 DATABASE FORMAT '/tmp/ForStandby_%U' tag 'FORSTANDBY'; scp /tmp/ForStandby_* 备库:/tmp
备库应用增量 CATALOG START WITH '/tmp/ForStandby'; recover database noredo;
刷新备库的控制文件 主库:BACKUP CURRENT CONTROLFILE FOR STANDBY FORMAT '/tmp/ForStandbyCTRL.bck'; scp /tmp/ForStandbyCTRL.bck 备库:/tmp
备库: spool standby_datafile_names.txt set pagesize 1000; set lines 200 col name format a60 select file#, name from v$datafile order by file# ; spool off
rmant target / SHUTDOWN IMMEDIATE ; STARTUP NOMOUNT; RESTORE STANDBY CONTROLFILE FROM '/tmp/ForStandbyCTRL.bck'; ALTER DATABASE MOUNT; CATALOG START WITH '备库文件位置';
SELECT FILE#, NAME FROM V$DATAFILE WHERE CREATION_CHANGE# >3162298; SWITCH DATABASE TO COPY;
如果备库需要配置闪回 ALTER DATABASE FLASHBACK OFF; ALTER DATABASE FLASHBACK ON; select 'ALTER DATABASE CLEAR LOGFILE GROUP '||GROUP#||';' c from v$logfile where TYPE='STANDBY' group by GROUP#; 执行输出
RECOVER MANAGED STANDBY DATABASE DISCONNECT;
参考:好买网goodmai。com 使用 RMAN 增量备份前滚物理备用数据库的步骤。