1、确定增备scn范围,通过alert日志获取gap日志序列
GAP - thread 1 sequence 109631-117170
2、根据序列获取增备起点SCN
提示最小gap序列为109631, 往前推一个序列,然后获得scn号
select THREAD#,SEQUENCE#,FIRST_CHANGE#,NEXT_CHANGE# from v$archived_log where SEQUENCE#=109630;
THREAD# SEQUENCE# FIRST_CHANGE# NEXT_CHANGE#
---------- ---------- ------------- ------------
1 109630 1606624354 1606624958
3、在primary做基于该scn的增量备份及生成新的备库控制文件
##增量备份数据库
export ORACLE_SID=xxx
CONFIGURE CHANNEL DEVICE TYPE DISK MAXPIECESIZE 1000 M;
backup incremental from scn 1606624354 database format '/oradata/dgbackup/xxx/xxx_1606624354%U.bak';
--在primary创建standby controlfile
alter database create standby controlfile as '/oradata/dgbackup/xxx/xxx01.ctl';
4、备库关闭数据库,替换控制文件
--关闭备库,备份当前备库控制文件
shutdown immediate
mv /oradata/xxx/control01.ctl /oradata/xxx/control01.ctl.bak
替换当前备库控制文件
cp /oradata/dgbackup/xxx/xxx01.ctl /oradata/xxx/control01.ctl
5、启动备库进行增量恢复
-----启动数据库到nomount
startup nomount;
----启动数据库到mount
alter database mount standby database;
##rman增量恢复
catalog start with '/oradata/dgbackup/inscndbkf';
recover database noredo;
6、启动备库复制应用
-----启动恢复
sqlplus / as sysdba
ALTER DATABASE RECOVER MANAGED STANDBY DATABASE USING CURRENT LOGFILE DISCONNECT FROM SESSION;