OGG復制進程Not found處理


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文件需要更新。

 


免責聲明!

本站轉載的文章為個人學習借鑒使用,本站對版權不負任何法律責任。如果侵犯了您的隱私權益,請聯系本站郵箱yoyou2525@163.com刪除。



 
粵ICP備18138465號   © 2018-2025 CODEPRJ.COM