OGG运维,经常遇到复制进程ORA-01403: no data found, SQL error 进程报错~
如下进行学习测试
1.数据重新初始化;
2.使用 HANDLECOLLISIONS;
3.手工查询差异数据,手工补数据。
1.测试数据准备
SQL> select * from dd; ID CC_NAME WITTIME ---------- -------------------- ---------------------------------------- 2 2 03-JUN-20 02.34.37.000000 PM SQL> create table d1 as select * from dd; SQL> create table d2 as select * from dd; SQL> create table d3 as select * from dd; 源端 GGSCI (t1) 46> stop exta GGSCI (t1) 48> edit param exta table yz.d1; table yz.d2; table yz.d3; GGSCI (t1) 50> start exta GGSCI (t1) 49> stop dpea GGSCI (t1) 51> edit param dpea table yz.d1; table yz.d2; table yz.d3; GGSCI (t1) 52> start dpea 目标端 SQL> create table d1 as select * from dd; SQL> create table d2 as select * from dd; SQL> create table d3 as select * from dd; GGSCI (t2) 18> edit param repa MAP YZ.D1,TARGET BAK_YZ.D1; MAP YZ.D2,TARGET BAK_YZ.D2; MAP YZ.D3,TARGET BAK_YZ.D3; GGSCI (t2) 19> start repa
2.测试
情况1,源端add trandata之前存在数据变更导致OGG同步的表数据不一致,后续对这些数据update or delete操作时报错
源端插入数据
SQL> insert into d1 values(3,3,sysdate); SQL> commit;
目标端查询
SQL> select * from d1 where id=3;
no rows selected
源端此时对需要同步的表进行add trandata操作
GGSCI (t1) 57> dblogin USERID ogg,PASSWORD ogg
Successfully logged into database.
GGSCI (t1 as ogg@t1) 58> info trandata yz.d1
Logging of supplemental redo log data is disabled for table YZ.D1.
GGSCI (t1 as ogg@t1) 59> add trandata yz.d1
2020-07-28 10:16:33 WARNING OGG-06439 No unique key is defined for table D1. All viable columns will be used
to represent the key, but may not guarantee uniqueness. KEYCOLS may be used to define the key
GGSCI (t1 as ogg@t1) 60> info trandata yz.d1
Logging of supplemental redo log data is enabled for table YZ.D1.
Columns supplementally logged for table YZ.D1: "CC_NAME", "ID", "WITTIME".
Prepared CSN for table YZ.D1: 2717019
源端修改数据
SQL> update d1 set id=4 where id=3;
SQL> commit;
目标端复制进程Abend
GGSCI (t2) 48> info all
Program Status Group Lag at Chkpt Time Since Chkpt
MANAGER RUNNING
REPLICAT ABENDED REPA 00:00:00 00:00:25
观察报错,数据未找到
GGSCI (t2) 51> view report repa
2020-07-29 02:25:17 WARNING OGG-01004 Aborted grouped transaction on BAK_YZ.D1, Database error 1403 (No data found).
2020-07-29 02:25:17 ERROR OGG-01296 Error mapping from YZ.D1 to BAK_YZ.D1.
观察报错信息
[root@t2 ~]# tail -200f /u01/ogg/base/dirrpt/repa.dsc
Oracle GoldenGate Delivery for Oracle process started, group REPA discard file opened: 2020-07-29 02:24:36.856622
Current time: 2020-07-29 02:25:17
Discarded record from action ABEND on error 1403
No data found
Aborting transaction on /u01/ogg/base/dirdat/t1 beginning at seqno 29 rba 1,996
error at seqno 29 rba 1996
Problem replicating YZ.D1 to BAK_YZ.D1.
Record not found
Mapping problem with unified PK update record (target format) SCN:0.6.20.1573...
*
ID = 3
000000: 33 |3 |
CC_NAME = 3
000000: 33 |3 |
WITTIME = 2020-07-29 02:23:32.000000000
000000: 32 30 32 30 2d 30 37 2d 32 39 20 30 32 3a 32 33 |2020-07-29 02:23|
000010: 3a 33 32 2e 30 30 30 30 30 30 30 30 30 |:32.000000000 |
ID = 4
000000: 34 |4 |
CC_NAME = 3
000000: 33 |3 |
WITTIME = 2020-07-29 02:23:32.000000000
000000: 32 30 32 30 2d 30 37 2d 32 39 20 30 32 3a 32 33 |2020-07-29 02:23|
000010: 3a 33 32 2e 30 30 30 30 30 30 30 30 30 |:32.000000000 |
*
Process Abending : 2020-07-29 02:25:17.942993
处理方法:1.目标端手工插入缺少的数据,实际运维中比较少用,比较繁琐;
2.重新初始化整个表数据;
3.使用参数 HANDLECOLLISIONS
目标端再次查询,可以发现update 非主键数据不存在,则直接插入update修改后的值。
SQL> select * from d1;
ID CC_NAME WITTIME
---------- ---------- ---------------------------------------------------------------------------
2 2 03-JUN-20 02.34.37.000000 PM
4 3 29-JUL-20 02.23.32.000000 AM
情况2,目标端存在程序或人为对数据进行调整,后续对这些数据update or delete操作时报错
模拟人为调整数据,删除目标端环境数据
SQL> delete d1 where id=4;
1 row deleted.
SQL> commit;
目标端ogg进程,注释HANDLECOLLISIONS参数
源端此时对数据进行delete操作
SQL> delete d1 where id=4;
1 row deleted.
SQL> commit; 源端存在id=4的值,但是目标端id=4的值已经被删除。
果然,目标端OGG进程abend
REPLICAT ABENDED REPA
[root@t2 ~]# tail -20f /u01/ogg/base/dirrpt/repa.dsc
Aborting transaction on /u01/ogg/base/dirdat/t1 beginning at seqno 29 rba 2,723
error at seqno 29 rba 2723
Problem replicating YZ.D1 to BAK_YZ.D1.
Record not found
Mapping problem with delete record (target format) SCN:0.10.30.2405...
*
ID = 4
000000: 34 |4 |
CC_NAME = 3
000000: 33 |3 |
WITTIME = 2020-07-29 02:40:06.000000000
000000: 32 30 32 30 2d 30 37 2d 32 39 20 30 32 3a 34 30 |2020-07-29 02:40|
000010: 3a 30 36 2e 30 30 30 30 30 30 30 30 30 |:06.000000000 |
*
Process Abending : 2020-07-29 02:41:26.862051
再次使用HANDLECOLLISIONS 参数
目标端再次查询,可以发现delete 非主键数据不存在,则直接忽略该Delete操作。
情况3,源端新增字段,但是操作不规范,导致OGG not found
参考 https://www.cnblogs.com/lvcha001/p/13426495.html
1) 复制进程assumetargetdefs时,源端新增字段,并未重新add trandata,导致部分新增字段的数据,并未同步至目标端;
后续对目标端手工添加字段,源端重新add trandata后,应用部分SQL 涉及新增字段的数据,复制进程报错;
重新初始化 Or 使用HANDLECOLLISIONS 参数
2)使用DEF文件,delete trandata 之前存在insert数据,重启复制进程后,OGG abend insert插入源端def文件需要更新。