GoldenGate OGG-01004 ORA-01400 Cannot insert null into ...

OGG出现故障, ORA-01400, cannot insert null into “TEST“.“TEST“
目标端复制进程使用了配置HANDLECOLLISIONS, 此配置在目标端更新时,如果更新不到数据,会将UPDATE转换成insert
但是因为源端并没有配置所有列的附加日志,所以,没有被更新的列并不会包含在insert中,从而导致错误

做了以下步骤, 这里是临时解决方案:
1. 将列修改成null: alter table test modify col1 null;
2. 启动复制进程
3. 检查数据:select count(*) from test where col1 is null (发现有八条)
4. 处理并手工同步这八条数据
5. 将字段改成not null : alter table test modify col1 not null;

最终解决: 需要加入表的所有列的附加日志: alter table test add supplemental log data (ALL) columns;
DDL操作在生产环境较为危险, 暂缓动作


MOS文档ID: Replicat Abends With Errror ORA-01400: Cannot Insert NULL Into Table for Not Null Columns When Specifying INSERTALLRECORDS (文档 ID 1994869.1)

                      REPLICAT Reports ORA-01400: Cannot Insert NULL When Using HANDLECOLLISIONS (文档 ID 1576900.1)

REPLICAT tried to UPDATE an existing row, but none was found, so due to parameter HANDLECOLLISIONS, the failed UPDATE was converted into an INSERT.
That INSERT then failed because the Trail file did not have all the columns, because the record was for an UPDATE for 5 out of 15 columns, where the table on the Oracle database had the NOT NULL constraint set for all columns.

The cause of the problem has been determined from the following points;

  • The REPLICAT report shows the message "... inserting a row into USER1.TABLE1 due to missing target row for a key update operation. " 
    where the key words are " missing target row for a key update ". 
    This means there was no row to UPDATE, for the change record found in the Trail file.
  • The REPLICAT had the HANDLECOLLISIONS parameter set.
  • The GoldenGate Reference Guide shows that when HANDLECOLLISIONS is used, failed UPDATE's will be converted into INSERT's 
    "If the row with the old key is not found in the target, the change record in the trail is converted to an insert".
  • The REPLICAT report finally shows that after the failed UPDATE was reported, the INSERT also failed.  
    The INSERT failed because the Trail file record only had 5 out of 15 columns, where the table is defined with NOT NULL on all the columns.  
    This then caused the Oracle database error: ORA-01400: cannot insert NULL...



来自 “ ITPUB博客 ” ,链接:http://blog.itpub.net/8520577/viewspace-2652792/,如需转载,请注明出处,否则将追究法律责任。

转载于:http://blog.itpub.net/8520577/viewspace-2652792/

你可能感兴趣的:(GoldenGate OGG-01004 ORA-01400 Cannot insert null into ...)