需求:
请在生产库执行下面的脚本
--删除主键并新增复合主键
alter table XXXXX drop constraint PK_USERCHNL cascade;
alter table XXXXX add constraint PK_USERCHNL primary key (USERCODE, SALECHNL, STR1);
目标端ogg异常:
2019-04-03 09:54:38 WARNING OGG-01004 Oracle GoldenGate Delivery for Oracle, rep_1b.prm: Aborted grouped transaction on 'XXXXX', Database error 1 (OCI Error ORA-00001: unique constraint (PK_USERCHNL) violated (status = 1). INSERT /*+ RESTRICT_ALL_REF_CONS */ INTO "XX"."XXXX" ("USERCODE","SALECHNL","STR1","STR2","STR3","DATE1","DATE2","DATE3") VALUES (:a0,:a1,:a2,:a3,:a4,:a5,:a6,:a7)).
2019-04-03 09:54:38 WARNING OGG-01154 Oracle GoldenGate Delivery for Oracle, rep_1b.prm: SQL error 1 mapping XX.XXXXto LIS.USERCHNL OCI Error ORA-00001: unique constraint (XXX.PK_USERCHNL) violated (status = 1). INSERT /*+ RESTRICT_ALL_REF_CONS */ INTO "XX"."XXXX" ("USERCODE","SALECHNL","STR1","STR2","STR3","DATE1","DATE2","DATE3") VALUES (:a0,:a1,:a2,:a3,:a4,:a5,:a6,:a7).
2019-04-03 09:54:38 ERROR OGG-01296 Oracle GoldenGate Delivery for Oracle, rep_1b.prm: Error mapping from LIS.USERCHNL to XX.XXXXX.
2019-04-03 09:54:38 ERROR OGG-01668 Oracle GoldenGate Delivery for Oracle, rep_1b.prm: PROCESS ABENDING.
2019-04-03 09:57:49 WARNING OGG-00869 Oracle GoldenGate Delivery for Oracle, rep_1b.prm: OCI Error ORA-00001: unique constraint (XX.PK_USERCHNL) violated (status = 1). INSERT /*+ RESTRICT_ALL_REF_CONS */ INTO "XX"."XXXXX" ("USERCODE","SALECHNL","STR1","STR2","STR3","DATE1","DATE2","DATE3") VALUES (:a0,:a1,:a2,:a3,:a4,:a5,:a6,:a7).
2019-04-03 09:57:49 WARNING OGG-01004 Oracle GoldenGate Delivery for Oracle, rep_1b.prm: Aborted grouped transaction on 'XX.XXXX', Database error 1 (OCI Error ORA-00001: unique constraint (XX.PK_USERCHNL) violated (status = 1). INSERT /*+ RESTRICT_ALL_REF_CONS */ INTO "XX"."XXXXX" ("USERCODE","SALECHNL","STR1","STR2","STR3","DATE1","DATE2","DATE3") VALUES (:a0,:a1,:a2,:a3,:a4,:a5,:a6,:a7)).
2019-04-03 09:57:49 WARNING OGG-01154 Oracle GoldenGate Delivery for Oracle, rep_1b.prm: SQL error 1 mapping LIS.USERCHNL to XX.XXXXXX OCI Error ORA-00001: unique constraint (XXX.PK_USERCHNL) violated (status = 1). INSERT /*+ RESTRICT_ALL_REF_CONS */ INTO "XX"."XXXXX" ("USERCODE","SALECHNL","STR1","STR2","STR3","DATE1","DATE2","DATE3") VALUES (:a0,:a1,:a2,:a3,:a4,:a5,:a6,:a7).
2019-04-03 09:57:49 ERROR OGG-01296 Oracle GoldenGate Delivery for Oracle, rep_1b.prm: Error mapping from LIS.USERCHNL to XX.XXXXXX.
2019-04-03 09:57:49 ERROR OGG-01668 Oracle GoldenGate Delivery for Oracle, rep_1b.prm: PROCESS ABENDING.
--对比源端与目标端约束是否一致
select owner, constraint_name, constraint_type, status, validated from dba_constraints where owner='FLORACLE' and TABLE_NAME = 'TBL_BRH_KEY_INDEX';
解决方案:
在目标端删除多余的约束