OGG-00918 错误处理

Posted nadian-li

tags:

篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了OGG-00918 错误处理相关的知识,希望对你有一定的参考价值。

废话不多说,先来看ggserr.log报错部分

是replicate进程应用的时候报错

2020-07-09 17:05:31 INFO OGG-00996 Oracle GoldenGate Delivery for Oracle, rep_zwa.prm: REPLICAT REP_ZWA started.
2020-07-09 17:05:31 INFO OGG-02243 Oracle GoldenGate Delivery for Oracle, rep_zwa.prm: Opened trail file ./dirdat/accta/zw000000014 at 2020-07-09 17:05:31.730231.
2020-07-09 17:05:31 WARNING OGG-02760 Oracle GoldenGate Delivery for Oracle, rep_zwa.prm: ASSUMETARGETDEFS is ignored because trail file ./dirdat/accta/zw000000014 contains table definitions.
2020-07-09 17:05:31 INFO OGG-03522 Oracle GoldenGate Delivery for Oracle, rep_zwa.prm: Setting session time zone to source database time zone ‘+08:00‘.
2020-07-09 17:05:31 INFO OGG-03506 Oracle GoldenGate Delivery for Oracle, rep_zwa.prm: The source database character set, as determined from the trail file, is we8iso8859p1.
2020-07-09 17:05:31 INFO OGG-06505 Oracle GoldenGate Delivery for Oracle, rep_zwa.prm: MAP resolved (entry rateparam.BILLING_DEF): map "RATEPARAM"."BILLING_DEF" target "CCJH".rateparam.BILLING_DEF.
2020-07-09 17:05:31 WARNING OGG-06439 Oracle GoldenGate Delivery for Oracle, rep_zwa.prm: No unique key is defined for table BILLING_DEF. All viable columns will be used to represent the key, but may not guarantee uniqueness. KEYCOLS may be used to define the key.
2020-07-09 17:05:31 INFO OGG-02756 Oracle GoldenGate Delivery for Oracle, rep_zwa.prm: The definition for table RATEPARAM.BILLING_DEF is obtained from the trail file.
2020-07-09 17:05:31 INFO OGG-06511 Oracle GoldenGate Delivery for Oracle, rep_zwa.prm: Using following columns in default map by name: EVENT_ID, BILLING_COND, EXPR_TYPE, ITEM_EXPR, ITEMCODE, ITEMTYPE, ITEMADD_TYPE, ITEMADD_EXPR, START_CYCLE, END_CYCLE, TEMPITEM_FLAG, ITEM_UNIT, PAYPLAN_FLAG, G_BILLING_COND, G_ITEMADD_EXPR, G_ITEM_EXPR, RULEID, NEXTRULEID, PROCSCHEMAID, PROCEVENTID, RULENAME, FEE_ID, SPLITTYPE, UNIQUE_ID, ROUNDTYPE.
2020-07-09 17:05:31 ERROR OGG-00918 Oracle GoldenGate Delivery for Oracle, rep_zwa.prm: Key column SHOW_ZERO_FEE_FLAG is missing from map.
2020-07-09 17:05:31 ERROR OGG-01668 Oracle GoldenGate Delivery for Oracle, rep_zwa.prm: PROCESS ABENDING.
2020-07-09 17:05:31 INFO OGG-00975 Oracle GoldenGate Manager for Oracle, mgr.prm: Cannot create process ‘/openv/ogg/ogg12/replicat‘. Child process is no longer alive.
2020-07-09 17:05:31 INFO OGG-00975 Oracle GoldenGate Manager for Oracle, mgr.prm: startER failed.
2020-07-09 17:05:31 WARNING OGG-01742 Oracle GoldenGate Command Interpreter for Oracle: Command sent to MGR MGR returned with an ERROR response.

 

OGG-06511,OGG-00918是常见的表结构不一致问题

日志中也明显报出列名 Key column SHOW_ZERO_FEE_FLAG is missing from map.

 

在数据库中查看该表结构
SQL> @desc RATEPARAM.BILLING_DEF
Name Null? Type
------------------------------- -------- ----------------------------
1 EVENT_ID NOT NULL NUMBER(8)
2 BILLING_COND VARCHAR2(512)
3 EXPR_TYPE NOT NULL NUMBER(1)
4 ITEM_EXPR NOT NULL VARCHAR2(128)
5 ITEMCODE NOT NULL VARCHAR2(32)
6 ITEMTYPE NOT NULL NUMBER(1)
7 ITEMADD_TYPE NOT NULL NUMBER(1)
8 ITEMADD_EXPR VARCHAR2(128)
9 START_CYCLE NOT NULL NUMBER(8)
10 END_CYCLE NOT NULL NUMBER(8)
11 TEMPITEM_FLAG NOT NULL NUMBER(1)
12 ITEM_UNIT NOT NULL NUMBER(2)
13 PAYPLAN_FLAG NOT NULL NUMBER(1)
14 G_BILLING_COND VARCHAR2(512)
15 G_ITEMADD_EXPR VARCHAR2(128)
16 G_ITEM_EXPR VARCHAR2(512)
17 RULEID NOT NULL NUMBER(4)
18 NEXTRULEID NOT NULL NUMBER(4)
19 PROCSCHEMAID NOT NULL NUMBER(5)
20 PROCEVENTID NOT NULL NUMBER(4)
21 RULENAME VARCHAR2(32)
22 FEE_ID NUMBER(9)
23 SPLITTYPE NOT NULL NUMBER(1)
24 UNIQUE_ID NOT NULL NUMBER(10)
25 ROUNDTYPE NUMBER(1)
26 SHOW_ZERO_FEE_FLAG NUMBER(1)

 

查看最后一次DDL时间   dba_objects视图

SQL> @o rateparam.BILLING_DEF

owner object_name SUBOBJECT_NAME object_type status OID D_OID CREATED LAST_DDL_TIME
------------------------- ------------------------------ -------------------------------------------------------------------------------------------------------------------------------- ------------------ --------- ---------- ---------- ----------------- -----------------
RATEPARAM BILLING_DEF TABLE VALID 142586 142586 20200623 03:49:29 20200624 09:14:09

 

查看源端该表的结构和最后一次DDL时间

SQL> @desc rateparam.BILLING_DEF
Name Null? Type
------------------------------- -------- ----------------------------
1 EVENT_ID NOT NULL NUMBER(8)
2 BILLING_COND VARCHAR2(512)
3 EXPR_TYPE NOT NULL NUMBER(1)
4 ITEM_EXPR NOT NULL VARCHAR2(128)
5 ITEMCODE NOT NULL VARCHAR2(32)
6 ITEMTYPE NOT NULL NUMBER(1)
7 ITEMADD_TYPE NOT NULL NUMBER(1)
8 ITEMADD_EXPR VARCHAR2(128)
9 START_CYCLE NOT NULL NUMBER(8)
10 END_CYCLE NOT NULL NUMBER(8)
11 TEMPITEM_FLAG NOT NULL NUMBER(1)
12 ITEM_UNIT NOT NULL NUMBER(2)
13 PAYPLAN_FLAG NOT NULL NUMBER(1)
14 G_BILLING_COND VARCHAR2(512)
15 G_ITEMADD_EXPR VARCHAR2(128)
16 G_ITEM_EXPR VARCHAR2(512)
17 RULEID NOT NULL NUMBER(4)
18 NEXTRULEID NOT NULL NUMBER(4)
19 PROCSCHEMAID NOT NULL NUMBER(5)
20 PROCEVENTID NOT NULL NUMBER(4)
21 RULENAME VARCHAR2(32)
22 FEE_ID NUMBER(9)
23 SPLITTYPE NOT NULL NUMBER(1)
24 UNIQUE_ID NOT NULL NUMBER(10)
25 ROUNDTYPE NUMBER(1)
26 SHOW_ZERO_FEE_FLAG NUMBER(1)

SQL> @o rateparam.BILLING_DEF

owner object_name object_type status OID D_OID CREATED LAST_DDL_TIME
------------------------- ------------------------------ ------------------ --------- ---------- ---------- ----------------- -----------------
RATEPARAM BILLING_DEF TABLE VALID 1930555 2257144 20140322 22:54:00 20200623 00:30:15

 

可以发现源端表结构和目标端是一致的,但源端最后一次ddl时间是20200623 00:30:15   目标端是20200624 09:14:09  相差8个多小时

由此可以推测到是目标端应用trail日志时,未追上部分trail日志中还没有SHOW_ZERO_FEE_FLAG 列的信息,所以报错

解决办法是,我们先在目标端删掉该列

SQL> alter table rateparam.BILLING_DEF drop column SHOW_ZERO_FEE_FLAG;

Table altered.

再尝试启动应用进程,发现依旧报错

 

020-07-09 17:18:28 INFO OGG-00996 Oracle GoldenGate Delivery for Oracle, rep_zwa.prm: REPLICAT REP_ZWA started.
2020-07-09 17:18:28 INFO OGG-02243 Oracle GoldenGate Delivery for Oracle, rep_zwa.prm: Opened trail file ./dirdat/accta/zw000000014 at 2020-07-09 17:18:28.735043.
2020-07-09 17:18:28 WARNING OGG-02760 Oracle GoldenGate Delivery for Oracle, rep_zwa.prm: ASSUMETARGETDEFS is ignored because trail file ./dirdat/accta/zw000000014 contains table definitions.
2020-07-09 17:18:28 INFO OGG-03522 Oracle GoldenGate Delivery for Oracle, rep_zwa.prm: Setting session time zone to source database time zone ‘+08:00‘.
2020-07-09 17:18:28 INFO OGG-03506 Oracle GoldenGate Delivery for Oracle, rep_zwa.prm: The source database character set, as determined from the trail file, is we8iso8859p1.
2020-07-09 17:18:28 INFO OGG-06505 Oracle GoldenGate Delivery for Oracle, rep_zwa.prm: MAP resolved (entry rateparam.BILLING_DEF): map "RATEPARAM"."BILLING_DEF" target "CCJH".rateparam.BILLING_DEF.
2020-07-09 17:18:28 WARNING OGG-06439 Oracle GoldenGate Delivery for Oracle, rep_zwa.prm: No unique key is defined for table BILLING_DEF. All viable columns will be used to represent the key, but may not guarantee uniqueness. KEYCOLS may be used to define the key.
2020-07-09 17:18:28 INFO OGG-02756 Oracle GoldenGate Delivery for Oracle, rep_zwa.prm: The definition for table RATEPARAM.BILLING_DEF is obtained from the trail file.
2020-07-09 17:18:28 INFO OGG-06511 Oracle GoldenGate Delivery for Oracle, rep_zwa.prm: Using following columns in default map by name: EVENT_ID, BILLING_COND, EXPR_TYPE, ITEM_EXPR, ITEMCODE, ITEMTYPE, ITEMADD_TYPE, ITEMADD_EXPR, START_CYCLE, END_CYCLE, TEMPITEM_FLAG, ITEM_UNIT, PAYPLAN_FLAG, G_BILLING_COND, G_ITEMADD_EXPR, G_ITEM_EXPR, RULEID, NEXTRULEID, PROCSCHEMAID, PROCEVENTID, RULENAME, FEE_ID, SPLITTYPE, UNIQUE_ID, ROUNDTYPE.
2020-07-09 17:18:28 INFO OGG-06510 Oracle GoldenGate Delivery for Oracle, rep_zwa.prm: Using the following key columns for target table CCJH.RATEPARAM.BILLING_DEF: EVENT_ID, BILLING_COND, EXPR_TYPE, ITEM_EXPR, ITEMCODE, ITEMTYPE, ITEMADD_TYPE, ITEMADD_EXPR, START_CYCLE, END_CYCLE, TEMPITEM_FLAG, ITEM_UNIT, PAYPLAN_FLAG, G_BILLING_COND, G_ITEMADD_EXPR, G_ITEM_EXPR, RULEID, NEXTRULEID, PROCSCHEMAID, PROCEVENTID, RULENAME, FEE_ID, SPLITTYPE, UNIQUE_ID, ROUNDTYPE.
2020-07-09 17:18:28 WARNING OGG-01503 Oracle GoldenGate Delivery for Oracle, rep_zwa.prm: Aborting BATCHSQL transaction. Mapping error.
2020-07-09 17:18:28 WARNING OGG-01137 Oracle GoldenGate Delivery for Oracle, rep_zwa.prm: BATCHSQL suspended, continuing in normal mode.
2020-07-09 17:18:28 WARNING OGG-01003 Oracle GoldenGate Delivery for Oracle, rep_zwa.prm: Repositioning to rba 182206555 in seqno 14.
2020-07-09 17:18:28 WARNING OGG-01431 Oracle GoldenGate Delivery for Oracle, rep_zwa.prm: Aborted grouped transaction on ‘CCJH.RATEPARAM.BILLING_DEF‘, Mapping error.
2020-07-09 17:18:28 WARNING OGG-01003 Oracle GoldenGate Delivery for Oracle, rep_zwa.prm: Repositioning to rba 182206555 in seqno 14.
2020-07-09 17:18:28 WARNING OGG-01151 Oracle GoldenGate Delivery for Oracle, rep_zwa.prm: Error mapping from RATEPARAM.BILLING_DEF to CCJH.RATEPARAM.BILLING_DEF.
2020-07-09 17:18:28 ERROR OGG-01296 Oracle GoldenGate Delivery for Oracle, rep_zwa.prm: Error mapping from RATEPARAM.BILLING_DEF to CCJH.RATEPARAM.BILLING_DEF.
2020-07-09 17:18:28 ERROR OGG-01668 Oracle GoldenGate Delivery for Oracle, rep_zwa.prm: PROCESS ABENDING.
2020-07-09 17:18:28 INFO OGG-00975 Oracle GoldenGate Manager for Oracle, mgr.prm: Cannot create process ‘/openv/ogg/ogg12/replicat‘. Child process is no longer alive.
2020-07-09 17:18:28 INFO OGG-00975 Oracle GoldenGate Manager for Oracle, mgr.prm: startER failed.
2020-07-09 17:18:28 WARNING OGG-01742 Oracle GoldenGate Command Interpreter for Oracle: Command sent to MGR MGR returned with an ERROR response.

这次连列名都不报了

 

停止源断抽取进程后

 

尝试映射列名应用,修改应用进程配置文件

使用KEYCOLS参数将每个列写进去排除SHOW_ZERO_FEE_FLAG

map rateparam.SUBJECT_DEF               target rateparam.SUBJECT_DEF, KEYCOLS(EVENT_ID, BILLING_COND, EXPR_TYPE, ITEM_EXPR, ITEMCODE, ITEMTYPE, ITEMADD_TYPE, ITEMADD_EXPR, START_CYCLE, END_CYCLE, TEMPITEM_FLAG, ITEM_UNIT, PAYPLAN_FLAG, G_BILLING_COND, G_ITEMADD_EXPR, G_ITEM_EXPR, RULEID, NEXTRULEID, PROCSCHEMAID, PROCEVENTID, RULENAME, FEE_ID, SPLITTYPE, UNIQUE_ID, ROUNDTYPE);

再尝试启动应用进程就可以了

 

在源断重新添加该表trandata

GGSCI (kdzwa1) 12> dblogin userid ggadmin,password ******
Successfully logged into database.

GGSCI (kdzwa1 as ggadmin@accta1) 13> delete trandata rateparam.BILLING_DEF

Logging of supplemental redo log data disabled for table RATEPARAM.BILLING_DEF.
TRANDATA for scheduling columns has been disabled on table ‘RATEPARAM.BILLING_DEF‘.
GGSCI (kdzwa1 as ggadmin@accta1) 14> add trandata rateparam.BILLING_DEF

Logging of supplemental redo data enabled for table RATEPARAM.BILLING_DEF.
TRANDATA for scheduling columns has been added on table ‘RATEPARAM.BILLING_DEF‘.
TRANDATA for instantiation CSN has been added on table ‘RATEPARAM.BILLING_DEF‘.
GGSCI (kdzwa1 as ggadmin@accta1) 15>

 

追上后停止应用进程

添加列

SQL> alter table rateparam.BILLING_DEF add (SHOW_ZERO_FEE_FLAG NUMBER(1) DEFAULT 0);

Table altered.

再改回来应用进程的配置文件

map rateparam.BILLING_DEF               target rateparam.BILLING_DEF          ;

启动抽取进程和应用进程观察

 

以上操作并不适用于所有情况,强制指定列去应用,可能导致目标端后期添加列数据不一致

我操作之前检查了该表

get_ddl查看建表语句以及表中数据,发现最后一列都是默认值0,表很小,且业务量很少,直接加就是了,若是值不同且很多,就需要logdump分析日志,找到增加列的rba号,同步到该位置再停止,加上列同步后边的

 

类似问题可以参考ANBOB https://www.anbob.com/archives/5882.html

 

以上是关于OGG-00918 错误处理的主要内容,如果未能解决你的问题,请参考以下文章

17)错误处理

Lua 错误处理

PHP:自定义错误处理程序 - 处理解析和致命错误

python错误处理之try...except...finally...错误处理机制。

python错误处理之try...except...finally...错误处理机制。

MySql错误处理-错误处理的例子