OGG缺失日志导致进程中断

有时候ogg出现中断,日志里会提示如下错误信息:

ERROR OGG-00868 Oracle GoldenGate Capture for Oracle, eprisk.prm: Error code 1291, error message: ORA-01291: 缺失日志文件

(Missing Log File WAITING FOR REDO: FILE NA, THREAD 2, SEQUENCE 290359, SCN 0x0000002c59bd0176. Read Position SCN: 44.1505736448 (190484297472))

在这种情况下,是因为日志出现了gap,但好消息是通常我们都有这些归档日志的备份。

OGG通过dba_registered_archived_log 里提到的logfile来进行redo日志的挖掘,因此我们需要确定出基于SCN号所需要的所有归档日志(参考 ‘Minimum Archive Log Necessary to Restart Integrated Extract’ - in the Streams’ Healthcheck report output (Note 1448324.1))。

  • 查询抽取进程的当前中断时的APPLIED_SCN
1
2
3
4
5
SQL> Select to_char(first_Scn), to_char(start_scn), capture_name, to_char(Applied_scn) from dba_capture;

TO_CHAR(FIRST_SCN) TO_CHAR(START_SCN) CAPTURE_NAME TO_CHAR(APPLIED_SCN)
---------------------------------------- ---------------------------------------- -------------------------------------------------- ----------------------------------------
189593328361 189593328361 OGG$CAP_EPRISK 190484119926
  • 检查是否所需要的归档日志是否都可用并且有注册
1
2
3
4
5
sql > select name, thread#, sequence#, status, first_time, next_time, first_change#, next_change# from v$archived_log
where 190484119926 between first_change# and next_change#;

1 417084 D 2022/2/21 8:18:24 2022/2/21 8:25:12 190484059031 190484560204
2 290359 D 2022/2/21 8:18:23 2022/2/21 8:26:17 190484054919 190484743638

要恢复的起始scn号为这里first_change#的最小值,也就是190484054919。

这里的status为”D”, 表示已经被删除

Status of the archived log:
A - Available

D - Deleted

U - Unavailable

X - Expired

1
2
3
connect / as sysdba 
alter database register or replace logical logfile '<new_location> arch1_258_611031260.dbf' for '<Integrated_Extract_Name>';
alter database register or replace logical logfile '<new_location> arch1_260_611031260.dbf' for '<Integrated_Extract_Name>';

对于每个涉及到的日志,’register or replace logical’ 命令做了以下操作:

system.logmnr_log$删除日志条目,然后将新日志的存放路径进行插入替换。

根据前面查到的SCN号,可以查出需要从哪个归档日志开始进行恢复

1
2
select * from v$archived_log where first_change# >= 190484054919 and deleted = 'YES';
select * from dba_registered_archived_log where first_scn = 190484054919

根据查到的已经删除的归档日志编号进行恢复

1
RMAN> restore archivelog from logseq=417084 until logseq=417417 thread=1;

重启ogg进程

1
GGSCI> Start extract <OGG extract name>
作者

xbdba

发布于

2022-02-23

更新于

2022-10-31

许可协议

评论