处理一个dg gap同步问题

有一套10g的DG发现不同步,备库显示MRP进程正在等待gap的归档日志,需要从387105-387676

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
SQL> SELECT PROCESS, STATUS, THREAD#, SEQUENCE#, BLOCK#, BLOCKS FROM V$MANAGED_STANDBY;

PROCESS STATUS THREAD# SEQUENCE# BLOCK# BLOCKS
--------- ------------ ---------- ---------- ---------- ----------
ARCH CLOSING 1 387677 2033665 1047
ARCH CLOSING 1 387676 2033665 1048
MRP0 WAIT_FOR_GAP 1 387105 0 0
RFS IDLE 0 0 0 0
RFS IDLE 1 387678 638776 1

SQL> SELECT max(sequence#) from v$archived_log where applied='YES';

MAX(SEQUENCE#)
--------------
387104

而主库的归档日志已经被删除,则只能通过增量备份的方式

根据当前scn对主库进行增量备份

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
-- 查询备库当前scn
SQL> select to_char(current_scn) from v$database;

TO_CHAR(CURRENT_SCN)
----------------------------------------
9164156262

run{
allocate channel t1 type disk;
allocate channel t2 type disk;
allocate channel t3 type disk;
allocate channel t4 type disk;
allocate channel t5 type disk;
allocate channel t6 type disk;
backup INCREMENTAL from scn 9164156262 database format '/u01/arch/incre_%U';
release channel t1;
release channel t2;
release channel t3;
release channel t4;
release channel t5;
release channel t6;
}

创建备库控制文件

1
2
3
SQL> alter database create standby controlfile as '/u01/arch/standby.ctl';

Database altered.

然后替换掉备库的控制文件

1
2
3
SQL> startup nomount

RMAN> restore standby controlfile from '/u01/backup/standby.ctl';

备库恢复增量备份

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
RMAN> catalog start with '/u01/backup';

searching for all files that match the pattern /u01/backup

List of Files Unknown to the Database
=====================================
File Name: /u01/backup/incre_1itso2at_1_1
File Name: /u01/backup/incre_1jtso2av_1_1
File Name: /u01/backup/incre_1htso1vf_1_1
File Name: /u01/backup/incre_1etso1vf_1_1
File Name: /u01/backup/incre_1ftso1vf_1_1
File Name: /u01/backup/incre_1ctso1vf_1_1
File Name: /u01/backup/incre_1dtso1vf_1_1
File Name: /u01/backup/incre_1gtso1vf_1_1

Do you really want to catalog the above files (enter YES or NO)? yes
cataloging files...
cataloging done

List of Cataloged Files
=======================
File Name: /u01/backup/incre_1itso2at_1_1
File Name: /u01/backup/incre_1jtso2av_1_1
File Name: /u01/backup/incre_1htso1vf_1_1
File Name: /u01/backup/incre_1etso1vf_1_1
File Name: /u01/backup/incre_1ftso1vf_1_1
File Name: /u01/backup/incre_1ctso1vf_1_1
File Name: /u01/backup/incre_1dtso1vf_1_1
File Name: /u01/backup/incre_1gtso1vf_1_1

RMAN> recover database noredo;

备库应用日志

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
SQL> alter database recover managed standby database using current logfile disconnect from session;

Database altered.

-- 备库
SQL> SELECT max(sequence#) from v$archived_log where applied='YES';

MAX(SEQUENCE#)
--------------
387684 >>>>====现在与主库一致

SQL> SELECT PROCESS, STATUS, THREAD#, SEQUENCE#, BLOCK#, BLOCKS FROM V$MANAGED_STANDBY;

PROCESS STATUS THREAD# SEQUENCE# BLOCK# BLOCKS
--------- ------------ ---------- ---------- ---------- ----------
ARCH CLOSING 1 387684 1 1004
ARCH CLOSING 1 387683 30721 1068
RFS IDLE 0 0 0 0
RFS IDLE 1 387685 944650 1
MRP0 APPLYING_LOG 1 387685 944649 2097152 >>>>====状态正常

基本上碰到gap处理的步骤就是这样简单几步就行。


处理一个dg gap同步问题
https://www.xbdba.com/2019/03/18/dg-gap/
作者
xbdba
发布于
2019年3月18日
许可协议