Oracle DataGuard的日志间隙处理

  1. 目前情况,DG正常

  2. 模拟事件发生

2.1 停止备库的recover
SYS@stddb> alter database recover managed standby database cancel;

2.2 主库,做操作,切换日志
SYS@prod> conn hr/hr
Connected.
HR@prod> update e set salary=salary+1;

107 rows updated.

HR@prod> commit;

Commit complete.

HR@prod> conn / as sysdba
Connected.
SYS@prod> alter system switch logfile;

System altered.

重复上述行为,多切换几次

2.3 查看主库的日志状态
SYS@prod> archive log list;
Database log mode Archive Mode
Automatic archival Enabled
Archive destination /u01/app/oracle/arch/pridb
Oldest online log sequence 129
Next log sequence to archive 131
Current log sequence 131

2.4 查看备库日志状态
SYS@stddb> archive log list;
Database log mode Archive Mode
Automatic archival Enabled
Archive destination /u01/app/oracle/arch/stddb
Oldest online log sequence 129
Next log sequence to archive 0
Current log sequence 131

SYS@stddb> select sequence#,applied from v$archived_log where applied=‘NO’;

SEQUENCE# APPLIED


123 NO
124 NO
125 NO
126 NO
127 NO
128 NO
129 NO
130 NO

8 rows selected.

2.5 删除主库的127号归档日志
[oracle@vm01 pridb]$ rm -f 1_127_1018101739.dbf

RMAN> crosscheck archivelog all;
RMAN> delete expired archivelog all;

2.6 删除备库的127号归档日志
[oracle@vm02 stddb]$ rm -f 1_127_1018101739.dbf

RMAN> crosscheck archivelog all;
RMAN> delete expired archivelog all;

  1. 启动备库的recover动作

SYS@stddb> alter database recover managed standby database disconnect;

SYS@stddb> select process,status,sequence# from v$managed_standby;

PROCESS STATUS SEQUENCE#


ARCH CLOSING 129
ARCH CLOSING 130
ARCH CONNECTED 0
ARCH CLOSING 128
RFS IDLE 0
RFS IDLE 0
RFS IDLE 131
RFS IDLE 0
MRP0 WAIT_FOR_GAP 127

9 rows selected.

  1. 备库停止recover

SYS@stddb> alter database recover managed standby database cancel;

  1. 查看主库的对应断档log的scn信息

SYS@prod> select sequence#,first_change# from v$archived_log where sequence#=127;

SEQUENCE# FIRST_CHANGE#


127 1550291
127 1550291

  1. 在主库从1550291开始,进行增量备份

RMAN> backup incremental from scn 1550291 database format ‘/home/oracle/backup/lost_arc_%U’;

  1. 将增量备份传输到备库

[oracle@vm01 backup]$ scp lost_arc_0* 172.16.0.247:/home/oracle/backup

  1. 备库重新启动到mount

SYS@stddb> shutdown abort;
SYS@stddb> startup mount;

  1. 恢复增量备份

[oracle@vm02 stddb]$ rman target /

RMAN> catalog backuppiece ‘/home/oracle/backup/lost_arc_0eubn2v0_1_1’;
RMAN> catalog backuppiece ‘/home/oracle/backup/lost_arc_0fubn2vg_1_1’;

RMAN> recover database noredo;

  1. 主库重新生成一个控制文件传输给备库

SYS@prod> alter database create standby controlfile as ‘/home/oracle/backup/std_con01.ctl’;
[oracle@vm01 backup]$ scp std_con01.ctl 172.16.0.247:/home/oracle/backup

  1. 备库重新恢复控制文件

RMAN> shutdown immediate;
RMAN> startup nomount;
RMAN> restore controlfile from ‘/home/oracle/backup/std_con01.ctl’;

RMAN> shutdown immediate;

Oracle instance shut down

RMAN> startup;

  1. 重新启动adg

SYS@stddb> alter database recover managed standby database cancel;

SYS@stddb> alter database recover managed standby database using current logfile disconnect;

SYS@stddb> select name,open_mode from v$database;

NAME OPEN_MODE


PROD READ ONLY WITH APPLY

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值