您好,登錄后才能下訂單哦!
本文主要探討 handlecollisions 參數的作用。
ogg12c 版本。
源端目標端都在 a 列上有主鍵。
停掉抽取進程和投遞進程
源端插入幾條數據
源端抽取進程跳過這些 insert , alter extract EXT_MI01,begin now
啟動抽取進程和投遞進程
目標端
SQL> select * from t3;
A EUTIME B ---------- --------------- ---------- 1 3 2 22-OCT-18 3 3 22-OCT-18 3
3 rows selected. |
源端:
SQL> select * from t3;
A EUTIME B ---------- --------------- ---------- 1 3 2 22-OCT-18 3 3 22-OCT-18 3 4 23-OCT-18 3 5 23-OCT-18 3
5 rows selected.
|
源端 delete ,并提交
SQL> delete from t3 where a=4; |
復制進程 abend :
2018-10-23 14:39:05 WARNING OGG-01004 Aborted grouped transaction on 'MING.T3', Database error 1403 (OCI Error ORA-01403: no data found, SQL <DELETE FROM "MING"."T3" WHERE "A" = :b0 A ND "EUTIME" = :b1 AND "B" = :b2 AND ROWNUM = 1>).
2018-10-23 14:39:05 WARNING OGG-01003 Repositioning to rba 2135 in seqno 7.
2018-10-23 14:39:05 WARNING OGG-01154 SQL error 1403 mapping MING.T3 to MING.T3 OCI Error ORA-01403: no data found, SQL <DELETE FROM "MING"."T3" WHERE "A" = :b0 AND "EUTIME" = :b1 AND "B" = :b2 AND ROWNUM = 1>.
Source Context : SourceModule : [er.errors] SourceID : [/scratch/aime/adestore/views/aime_adc4150330/oggcore/OpenSys/src/app/er/errors.cpp] SourceFunction : [take_rep_err_action] SourceLine : [941] ThreadBacktrace : [15] elements : [/u01/app/oracle/products/ogg/libgglog.so(CMessageContext::AddThreadContext()+0x1b) [0x7f9d6f0554eb]] : [/u01/app/oracle/products/ogg/libgglog.so(CMessageFactory::CreateMessage(CSourceContext*, unsigned int, ...)+0x135) [0x7f9d6f04f5c5]] : [/u01/app/oracle/products/ogg/libgglog.so(_MSG_ERR_MAP_TO_TANDEM_FAILED(CSourceContext*, ggs::gglib::ggapp::CQualDBObjName<(DBObjType)1> const&, ggs::gglib::g gapp::CQualDBObjName<(DBObjType)1> const&, CMessageFactory::MessageDisposition)+0x50) [0x7f9d6f048c7c]] : [/u01/app/oracle/products/ogg/replicat(take_rep_err_action(short, int, char const*, extr_ptr_def*, std_rec_hdr_def*, char*, file_def*, bool)+0x17aa) [0x5b63ef ]] : [/u01/app/oracle/products/ogg/replicat(replicate_io(ggs::gglib::ggdatasource::DataSource*, file_def*, ggs::gglib::gglcr::CommonLCR const*, ggs::gglib::gglcr:: CommonLCR*, extr_ptr_def*, int*, int)+0x3847) [0x63ad27]] : [/u01/app/oracle/products/ogg/replicat(process_record(ggs::gglib::ggdatasource::DataSource*, file_def*&, ggs::gglib::gglcr::CommonLCR const*, ggs::gglib::gglc r::CommonLCR*, short&, extr_ptr_def*&, extr_ptr_def*&, int&, int&, int&, bool)+0x2f8) [0x63f018]] : [/u01/app/oracle/products/ogg/replicat(ggs::er::ReplicatContext::processReplicatLoop(ggs::Heartbeat::MapGeneratorParams&)+0x1061) [0x5f6cc1]] : [/u01/app/oracle/products/ogg/replicat(ggs::er::ReplicatContext::run(ggs::Heartbeat::MapGeneratorParams&)+0x29) [0x5eae39]] : [/u01/app/oracle/products/ogg/replicat() [0x633c7b]] : [/u01/app/oracle/products/ogg/replicat(ggs::gglib::MultiThreading::MainThread::ExecMain()+0x60) [0x6ecbe0]] : [/u01/app/oracle/products/ogg/replicat(ggs::gglib::MultiThreading::Thread::RunThread(ggs::gglib::MultiThreading::Thread::ThreadArgs*)+0x14d) [0x6edbfd]] : [/u01/app/oracle/products/ogg/replicat(ggs::gglib::MultiThreading::MainThread::Run(int, char**)+0xb1) [0x6edce1]] : [/u01/app/oracle/products/ogg/replicat(main+0x3b) [0x636c9b]] : [/lib64/libc.so.6(__libc_start_main+0xfd) [0x37cba1ed1d]] : [/u01/app/oracle/products/ogg/replicat() [0x56c559]]
2018-10-23 14:39:05 ERROR OGG-01296 Error mapping from MING.T3 to MING.T3.
|
復制進程修改參數,添加 handlecollisions
map ming.t3, target ming.t3,handlecollisions; |
啟動復制進程
start rep_mi01
GGSCI (ORADB-8955.datadept.eastmoney.com.sh) 79> stats REP_MI01,table ming.t3,total
Sending STATS request to REPLICAT REP_MI01 ...
Start of Statistics at 2018-10-23 14:53:21.
Replicating from MING.T3 to MING.T3:
*** Total statistics since 2018-10-23 14:53:03 *** Total inserts 0.00 Total updates 0.00 Total deletes 1.00 Total discards 0.00 Total operations 1.00 Total delete collisions 1.00
End of Statistics |
去掉 handlecollisions 參數,源端插入數據抽取進程并跳過這些差異數據。
源端
SQL> select * from t3;
A EUTIME B ---------- --------------- ---------- 1 3 2 22-OCT-18 3 3 22-OCT-18 3 5 23-OCT-18 3 6 23-OCT-18 3 4 23-OCT-18 3
6 rows selected. |
目標端
SQL> select * from t3;
A EUTIME B ---------- --------------- ---------- 1 3 2 22-OCT-18 3 3 22-OCT-18 3
3 rows selected.
|
源端 update 一條數據并提交:
SQL> update t3 set a=7,b=4 where a=6; |
目標端復制進程 abend
2018-10-23 15:06:20 WARNING OGG-01004 Aborted grouped transaction on 'MING.T3', Database error 1403 (OCI Error ORA-01403: no data found, SQL <UPDATE "MING"."T3" x SET x."A" = :a3,x."EU TIME" = :a4,x."B" = :a5 WHERE x."A" = :b0>).
2018-10-23 15:06:20 WARNING OGG-01003 Repositioning to rba 5635 in seqno 7.
2018-10-23 15:06:20 WARNING OGG-01154 SQL error 1403 mapping MING.T3 to MING.T3 OCI Error ORA-01403: no data found, SQL <UPDATE "MING"."T3" x SET x."A" = :a3,x."EUTIME" = :a4,x."B" = : a5 WHERE x."A" = :b0>.
Source Context : SourceModule : [er.errors] SourceID : [/scratch/aime/adestore/views/aime_adc4150330/oggcore/OpenSys/src/app/er/errors.cpp] SourceFunction : [take_rep_err_action] SourceLine : [941] ThreadBacktrace : [15] elements : [/u01/app/oracle/products/ogg/libgglog.so(CMessageContext::AddThreadContext()+0x1b) [0x7f552516e4eb]] : [/u01/app/oracle/products/ogg/libgglog.so(CMessageFactory::CreateMessage(CSourceContext*, unsigned int, ...)+0x135) [0x7f55251685c5]] : [/u01/app/oracle/products/ogg/libgglog.so(_MSG_ERR_MAP_TO_TANDEM_FAILED(CSourceContext*, ggs::gglib::ggapp::CQualDBObjName<(DBObjType)1> const&, ggs::gglib::g gapp::CQualDBObjName<(DBObjType)1> const&, CMessageFactory::MessageDisposition)+0x50) [0x7f5525161c7c]] : [/u01/app/oracle/products/ogg/replicat(take_rep_err_action(short, int, char const*, extr_ptr_def*, std_rec_hdr_def*, char*, file_def*, bool)+0x17aa) [0x5b63ef ]] : [/u01/app/oracle/products/ogg/replicat(replicate_io(ggs::gglib::ggdatasource::DataSource*, file_def*, ggs::gglib::gglcr::CommonLCR const*, ggs::gglib::gglcr:: CommonLCR*, extr_ptr_def*, int*, int)+0x3847) [0x63ad27]] : [/u01/app/oracle/products/ogg/replicat(process_record(ggs::gglib::ggdatasource::DataSource*, file_def*&, ggs::gglib::gglcr::CommonLCR const*, ggs::gglib::gglc r::CommonLCR*, short&, extr_ptr_def*&, extr_ptr_def*&, int&, int&, int&, bool)+0x2f8) [0x63f018]] : [/u01/app/oracle/products/ogg/replicat(ggs::er::ReplicatContext::processReplicatLoop(ggs::Heartbeat::MapGeneratorParams&)+0x1061) [0x5f6cc1]] : [/u01/app/oracle/products/ogg/replicat(ggs::er::ReplicatContext::run(ggs::Heartbeat::MapGeneratorParams&)+0x29) [0x5eae39]] : [/u01/app/oracle/products/ogg/replicat() [0x633c7b]] : [/u01/app/oracle/products/ogg/replicat(ggs::gglib::MultiThreading::MainThread::ExecMain()+0x60) [0x6ecbe0]] : [/u01/app/oracle/products/ogg/replicat(ggs::gglib::MultiThreading::Thread::RunThread(ggs::gglib::MultiThreading::Thread::ThreadArgs*)+0x14d) [0x6edbfd]] : [/u01/app/oracle/products/ogg/replicat(ggs::gglib::MultiThreading::MainThread::Run(int, char**)+0xb1) [0x6edce1]] : [/u01/app/oracle/products/ogg/replicat(main+0x3b) [0x636c9b]] : [/lib64/libc.so.6(__libc_start_main+0xfd) [0x37cba1ed1d]] : [/u01/app/oracle/products/ogg/replicat() [0x56c559]]
2018-10-23 15:06:20 ERROR OGG-01296 Error mapping from MING.T3 to MING.T3.
|
復制進程添加
map ming.t3, target ming.t3,handlecollisions; |
開啟復制進程
start rep_mi01 |
handlecollisions 變 update 為 insert 了
SQL> select * from t3;
A EUTIME B ---------- --------------- ---------- 1 3 2 22-OCT-18 3 3 22-OCT-18 3 7 23-OCT-18 4
4 rows selected. |
目標端插入一條數據并提交
SQL> insert into t3(a,b) values(9,9); |
源端插入主鍵為 9 的數據
SQL> insert into t3(a) values(9); SQL> commit; SQL> select * from t3;
A EUTIME B ---------- --------------- ---------- 1 3 2 22-OCT-18 3 3 22-OCT-18 3 5 23-OCT-18 4 7 23-OCT-18 4 4 23-OCT-18 3 8 23-OCT-18 3 9 23-OCT-18 3
8 rows selected. |
目標端:
SQL> select * from t3;
A EUTIME B ---------- --------------- ---------- 1 3 2 22-OCT-18 3 3 22-OCT-18 3 7 23-OCT-18 4 5 23-OCT-18 4 8 23-OCT-18 3 9 23-OCT-18 3
7 rows selected. |
目標端復制進程沒有 abend ,舊的數據被覆蓋,以源端為主。
去掉復制進程中的 handlecollisions ,源端插入數據
SQL> insert into t3(a,b) values(10,10); SQL> commit; |
源端插入數據并提交
SQL> insert into t3(a) values(10); |
源端進程 abend
2018-10-23 15:36:46 WARNING OGG-00869 OCI Error ORA-00001: (MING. (status = 1), SQL <INSERT INTO "MING"."T3" ("A","EUTIME","B") VALUES (:a0,:a1,:a2)>.
2018-10-23 15:36:46 WARNING OGG-01004 Aborted grouped transaction on 'MING.T3', Database error 1 (OCI Error ORA-00001: (MING. (status = 1), SQL <INSERT INTO "MING"."T3" ("A","EUTIME", "B") VALUES (:a0,:a1,:a2)>).
2018-10-23 15:36:46 WARNING OGG-01003 Repositioning to rba 6366 in seqno 7.
2018-10-23 15:36:46 WARNING OGG-01154 SQL error 1 mapping MING.T3 to MING.T3 OCI Error ORA-00001: (MING. (status = 1), SQL <INSERT INTO "MING"."T3" ("A","EUTIME","B") VALUES (:a0,:a1, :a2)>.
Source Context : SourceModule : [er.errors] SourceID : [/scratch/aime/adestore/views/aime_adc4150330/oggcore/OpenSys/src/app/er/errors.cpp] SourceFunction : [take_rep_err_action] SourceLine : [941] ThreadBacktrace : [15] elements : [/u01/app/oracle/products/ogg/libgglog.so(CMessageContext::AddThreadContext()+0x1b) [0x7f118d26c4eb]] : [/u01/app/oracle/products/ogg/libgglog.so(CMessageFactory::CreateMessage(CSourceContext*, unsigned int, ...)+0x135) [0x7f118d2665c5]] : [/u01/app/oracle/products/ogg/libgglog.so(_MSG_ERR_MAP_TO_TANDEM_FAILED(CSourceContext*, ggs::gglib::ggapp::CQualDBObjName<(DBObjType)1> const&, ggs::gglib::g gapp::CQualDBObjName<(DBObjType)1> const&, CMessageFactory::MessageDisposition)+0x50) [0x7f118d25fc7c]] : [/u01/app/oracle/products/ogg/replicat(take_rep_err_action(short, int, char const*, extr_ptr_def*, std_rec_hdr_def*, char*, file_def*, bool)+0x17aa) [0x5b63ef ]] : [/u01/app/oracle/products/ogg/replicat(replicate_io(ggs::gglib::ggdatasource::DataSource*, file_def*, ggs::gglib::gglcr::CommonLCR const*, ggs::gglib::gglcr:: CommonLCR*, extr_ptr_def*, int*, int)+0x3847) [0x63ad27]] : [/u01/app/oracle/products/ogg/replicat(process_record(ggs::gglib::ggdatasource::DataSource*, file_def*&, ggs::gglib::gglcr::CommonLCR const*, ggs::gglib::gglc r::CommonLCR*, short&, extr_ptr_def*&, extr_ptr_def*&, int&, int&, int&, bool)+0x2f8) [0x63f018]] : [/u01/app/oracle/products/ogg/replicat(ggs::er::ReplicatContext::processReplicatLoop(ggs::Heartbeat::MapGeneratorParams&)+0x1061) [0x5f6cc1]] : [/u01/app/oracle/products/ogg/replicat(ggs::er::ReplicatContext::run(ggs::Heartbeat::MapGeneratorParams&)+0x29) [0x5eae39]] : [/u01/app/oracle/products/ogg/replicat() [0x633c7b]] : [/u01/app/oracle/products/ogg/replicat(ggs::gglib::MultiThreading::MainThread::ExecMain()+0x60) [0x6ecbe0]] : [/u01/app/oracle/products/ogg/replicat(ggs::gglib::MultiThreading::Thread::RunThread(ggs::gglib::MultiThreading::Thread::ThreadArgs*)+0x14d) [0x6edbfd]] : [/u01/app/oracle/products/ogg/replicat(ggs::gglib::MultiThreading::MainThread::Run(int, char**)+0xb1) [0x6edce1]] : [/u01/app/oracle/products/ogg/replicat(main+0x3b) [0x636c9b]] : [/lib64/libc.so.6(__libc_start_main+0xfd) [0x37cba1ed1d]] : [/u01/app/oracle/products/ogg/replicat() [0x56c559]]
2018-10-23 15:36:46 ERROR OGG-01296 Error mapping from MING.T3 to MING.T3.
|
再次加入 handlecollisions 參數,目標端數據被修改為與源端一致。
1.handlecollisions 是復制進程參數 2. 對于 delete 操作,無 handlecollisions 參數,源端 delete 一條數據,目標端沒有符合要求,那么復制進程會 abend ; 有 handlecollisions 參數,復制進程不會 abend ,目標端會跳過 delete 3. 對于 update 操作,無 handlecollisions 參數,源端 update 一條數據,目標端沒有符合要求,那么復制進程會 abend ; 有 handlecollisions 參數,復制進程不會 abend ,目標端將 update 變為 insert ,將數據插入目標端。 4. 對于 insert 操作,無 handlecollisions 參數,源端 insert 一條數據,目標端違反了唯一性約束,那么復制進程會 abend ; 有 handlecollisions 參數,復制進程不會 abend ,目標端將按照源端數據,修改目標端違反唯一性約束的數據。 |
免責聲明:本站發布的內容(圖片、視頻和文字)以原創、轉載和分享為主,文章觀點不代表本網站立場,如果涉及侵權請聯系站長郵箱:is@yisu.com進行舉報,并提供相關證據,一經查實,將立刻刪除涉嫌侵權內容。