资讯

精准传达 • 有效沟通

从品牌网站建设到网络营销策划,从策略到执行的一站式服务

ogg参数之handlecollisions

本文主要探讨 handlecollisions 参数的作用。

创新互联专注于峰峰矿企业网站建设,成都响应式网站建设公司,商城网站开发。峰峰矿网站建设公司,为峰峰矿等地区提供建站服务。全流程按需策划设计,专业设计,全程项目跟踪,创新互联专业和态度为您提供的服务

 

环境

ogg12c 版本。

源端目标端都在 a 列上有主键。

 

准备工作

停掉抽取进程和投递进程

源端插入几条数据

源端抽取进程跳过这些 insert , alter extract EXT_MI01,begin now

启动抽取进程和投递进程

 

Delete 实验

目标端

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  

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

 "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

 

 

Update 实验

去掉 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

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

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.

 

 

Insert 实验

目标端插入一条数据并提交

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 .

 

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

"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

: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 ,目标端将按照源端数据,修改目标端违反唯一性约束的数据。

 


分享题目:ogg参数之handlecollisions
本文路径:http://cdkjz.cn/article/jojsce.html
多年建站经验

多一份参考,总有益处

联系快上网,免费获得专属《策划方案》及报价

咨询相关问题或预约面谈,可以通过以下方式与我们联系

大客户专线   成都:13518219792   座机:028-86922220