代码改变世界

GOLDEN GATE关于更新主键值的问题

2017-02-25 23:23  Hunter123  阅读(724)  评论(0)    收藏  举报
对于更新主键值的时候如果使用类似
update table set col = col +1;
这样的语句,在OGG 11.1版本是不能同步的。但是在OGG 12版本已经可以正常同步
 
实验:
create table hxsts.lrcstest (id number primary key);
create table hxsts.lrcptest (id number primary key);
insert into hxsts.lrcstest values(1);
insert into hxsts.lrcstest values(2);
commit;
select * from hxsts.lrcstest;
select * from hxsts.lrcptest;
 
update hxsts.lrcstest set id = id+1;
commit;
select * from hxsts.lrcstest;
select * from hxsts.lrcptest;
 
会发现DISCARD文件中也有报错
Current time: 2017-02-07 18:23:19
 
OCI Error ORA-00001: unique constraint (HXSTS.SYS_C0063856) violated (status = 1). UPDATE "HXSTS"."LRCPTEST" SET "ID" = :a1 WHERE "ID" = :b0
Operation failed at seqno 0 rba 1384
Discarding record on action DISCARD on error 1
Problem replicating HXSTS.LRCSTEST to HXSTS.LRCPTEST
Mapping problem with compressed key update record (target format)...
*
ID = 1
ID = 2
 
oracle MOS中也提到了该问题
Why Do I Get the Ora-00001 When Doing Multi-Row PK/Unique_Key Update by Single Statement in Oracle? (文档 ID 1060437.1)