ORA-01841: (full) year must be between -4713 and +9999,
OGG报错日志:
2018-09-21 08:52:39 WARNING OGG-01003 Oracle GoldenGate Delivery for Oracle, rep_1b.prm: Repositioning to rba 39885024 in seqno 14371.
2018-09-21 08:52:39 WARNING OGG-01154 Oracle GoldenGate Delivery for Oracle, rep_1b.prm:
SQL error 1841 mapping L.TABLE to L.TABLE OCI Error ORA-01841: (full) year must be between -4713 and +9999,
and not be 0 (status = 1841). INSERT /*+ RESTRICT_ALL_REF_CONS */ INTO "L"."TABLE" ("CONTNO","POLNO","PAYTODATE","CURRENTPAYCOUNT") VALUES (:a0,:a1,:a2,:a3).
2018-09-21 08:52:39 ERROR OGG-01296 Oracle GoldenGate Delivery for Oracle, rep_1b.prm:
环境:OGG源端10g,目标端11g。初步判断日期格式异常导致。
根据日志,查找源库中年份为0的数据:
SQL> select l.*,to_number(to_char(PAYTODATE,'yyyy')) from L.TABLE l where to_number(to_char(PAYTODATE,'yyyy')) =0;
CONTNO PAYTODATE TO_NUMBER(TO_CHAR(PAYTODATE,'YYYY'))
------------------------------ ------------ ------------------------------------
2017E11122000055 21-DEC-00 0
查找年份为2000的数据:
SQL> select l.*,to_number(to_char(PAYTODATE,'yyyy')) from L.TABLE l where to_number(to_char(PAYTODATE,'yyyy')) =2000;
CONTNO PAYTODATE TO_NUMBER(TO_CHAR(PAYTODATE,'YYYY'))
------------------------------ ------------ ------------------------------------
2017E11122000055 21-DEC-00 2000
2018E11082800005 29-AUG-00 2000
2018E11052400048 25-MAY-00 2000
2018E11011500070 01-JAN-00 2000
2018E11060500007 01-JUN-00 2000
2018E11061600010 17-JUN-00 2000
对比发现 PAYTODATE列同为00年份,但格式化后,一条数据位0,其他条数据为2000.异常数据浮出水面。