• (转)goldengate 复制进程replicat出现ORA01403 错误


    最近,在goldengate的应用场景中,replicat进程经常出现append,start也启动不起来,查看日志,发现出现ora-01403错误,日志内容如下:

     

    1. 2012-09-27 19:06:39  INFO    OGG-00996  Oracle GoldenGate Delivery for Oracle, C_R_C6.prm:  REPLICAT C_R_C6 started. 
    2. 2012-09-27 19:06:40  WARNING OGG-01004  Oracle GoldenGate Delivery for Oracle, C_R_C6.prm:  Aborted grouped transaction on '***.TB_COMMON_CUSTEMPRELATION'Database error 1403 (OCI Error ORA-01403: no data found, SQL <UPDATE "***"."TB_COMMON_CUSTEMPRELATION" SET "PK" = :a0,"FK" = :a1,"CREATETIME" = :a2,"LASTMODIFYTIME" = :a3,"LINEID" = :a5,"DELETEFLAG" = :a6,"NOTE" = :a7,"VERSION" = :a11 WHERE "BRANCHID" = :b0 AND "CUSTID" = :b1 AND "BUSINESTYPECODE" = :b2 AND "STAFFID" = :b3>). 
    3. 2012-09-27 19:06:40  WARNING OGG-01003  Oracle GoldenGate Delivery for Oracle, C_R_C6.prm:  Repositioning to rba 1829839 in seqno 19. 
    4. 2012-09-27 19:06:40  WARNING OGG-01154  Oracle GoldenGate Delivery for Oracle, C_R_C6.prm:  SQL error 1403 mapping ***.TB_COMMON_CUSTEMPRELATION to ***.TB_COMMON_CUSTEMPRELATION OCI Error ORA-01403: no data found, SQL <UPDATE "***"."TB_COMMON_CUSTEMPRELATION" SET "PK" = :a0,"FK" = :a1,"CREATETIME" = :a2,"LASTMODIFYTIME" = :a3,"LINEID" = :a5,"DELETEFLAG" = :a6,"NOTE" = :a7,"VERSION" = :a11 WHERE "BRANCHID" = :b0 AND "CUSTID" = :b1 AND "BUSINESTYPECODE" = :b2 AND "STAFFID" = :b3>. 
    5. 2012-09-27 19:06:40  WARNING OGG-01003  Oracle GoldenGate Delivery for Oracle, C_R_C6.prm:  Repositioning to rba 1829839 in seqno 19. 
    6. 2012-09-27 19:06:41  ERROR   OGG-01296  Oracle GoldenGate Delivery for Oracle, C_R_C6.prm:  Error mapping from ***.TB_COMMON_CUSTEMPRELATION to ***.TB_COMMON_CUSTEMPRELATION. 
    7. 2012-09-27 19:06:41  ERROR   OGG-01668  Oracle GoldenGate Delivery for Oracle, C_R_C6.prm:  PROCESS ABENDING. 

       从日志中分析,发现关键信息处为:

    Database error 1403 (OCI Error ORA-01403: no data found, SQL <UPDATE "***"."TB_COMMON_CUSTEMPRELATION" SET "PK" = :a0,"FK" = :a1,"CREATETIME" = :a2,"LASTMODIFYTIME" = :a3,"LINEID" = :a5,"DELETEFLAG" = :a6,"NOTE" = :a7,"VERSION" = :a11 WHERE "BRANCHID" = :b0 AND "CUSTID" = :b1 AND "BUSINESTYPECODE" = :b2 AND "STAFFID" = :b3>)

    于是使用logdump来分析,分析过程如下:

     

     

    1. GGSCI (WIN-O6ODS01HLMM) 119> info c_r_c6 
    2.  
    3. REPLICAT   C_R_C6    Last Started 2012-09-27 10:29   Status ABENDED 
    4. Checkpoint Lag       00:00:00 (updated 01:53:55 ago) 
    5. Log Read Checkpoint  File ./dirdat/cm000019 
    6.                      2012-09-27 04:00:47.720000  RBA 1771589 
    7. 然后用logdump查看: 
    8. Logdump 48 >open ./dirdat/cm000019 
    9.  
    10. LogTrail ***dirdat\cm000015 closed 
    11.  
    12. Current LogTrail is ***\dirdat\cm000019 
    13.  
    14. Logdump 49 >pos 1771589 
    15.  
    16. Reading forward from RBA 1771589 
    17.  
    18. Logdump 50 >n 

     

    1. 2012/09/27 08:36:10.858.000 FieldComp            Len   194 RBA 1776078 
    2. Name: ***.TB_COMMON_CUSTEMPRELATION 
    3. After  Image:                                             Partition 4   G  m 
    4.  0000 000d 0000 0009 3937 3035 3130 3030 3100 0100 | ........970510001... 
    5.  0c00 0000 0833 3039 3130 3030 3600 0200 1500 0032 | .....30910006......2 
    6.  3031 322d 3038 2d32 383a 3130 3a33 303a 3037 0003 | 012-08-28:10:30:07.. 
    7.  0015 0000 3230 3132 2d30 392d 3237 3a30 383a 3336 | ....2012-09-27:08:36 
    8.  3a30 3900 0400 0700 0000 0346 5741 0005 000a 0000 | :09........FWA...... 
    9.  0000 0000 0000 0000 0006 000a 0000 0000 0000 0000 | .................... 
    10.  0000 0007 0004 ffff 0000 0008 000f 0000 000b 4457 | ..................DW 
    11. Column     0 (x0000), Len    13 (x000d) 
    12.  0000 0009 3937 3035 3130 3030 31                  | ....970510001 
    13. Column     1 (x0001), Len    12 (x000c) 
    14.  0000 0008 3330 3931 3030 3036                     | ....30910006 
    15. Column     2 (x0002), Len    21 (x0015) 
    16.  0000 3230 3132 2d30 382d 3238 3a31 303a 3330 3a30 | ..2012-08-28:10:30:0 
    17.  37                                                | 7 
    18. Column     3 (x0003), Len    21 (x0015) 
    19.  0000 3230 3132 2d30 392d 3237 3a30 383a 3336 3a30 | ..2012-09-27:08:36:0 
    20.  39                                                | 9 
    21. Column     4 (x0004), Len     7 (x0007) 
    22.  0000 0003 4657 41                                 | ....FWA 
    23. Column     5 (x0005), Len    10 (x000a) 
    24.  0000 0000 0000 0000 0000                          | .......... 
    25. Column     6 (x0006), Len    10 (x000a) 
    26.  0000 0000 0000 0000 0000                          | .......... 
    27. Column     7 (x0007), Len     4 (x0004) 
    28.  ffff 0000                                         | .... 
    29. Column     8 (x0008), Len    15 (x000f) 
    30.  0000 000b 4457 4930 3030 3531 3138 37             | ....DWI00051187 
    31. Column     9 (x0009), Len     8 (x0008) 
    32.  0000 0004 4253 3036                               | ....BS06 
    33. Column    10 (x000a), Len    15 (x000f) 
    34.  0000 000b 5a49 5930 3030 3031 3836 36             | ....ZIY00001866 
    35. Column    11 (x000b), Len    10 (x000a) 
    36.  0000 0000 0000 0000 0002                          | .......... 
    37.  
    38. Logdump 67 > 

    从上面的信息看,发现记录update操作时数据 信息不全,有的列没有值(这种情况要关注更新主键时goldengate的处理,此文暂不讨论),接着在target端查看要update的这条记录,发现没有(这情况是target端缺失update数据),再看replicat配置文件 信息:

    1. REPLICAT c_r_c6 
    2. SETENV (NLS_LANG = "AMERICAN_AMERICA.ZHS16GBK")  
    3. GETENV (NLS_LANG) 
    4. USERID ************ 
    5. --HANDLECOLLISIONS 
    6. ASSUMETARGETDEFS 
    7. --DDLERROR DEFAULT IGNORE RETRYOP 
    8. --REPERROR DEFAULT, DISCARD 
    9. MAP ***.TB_COMMON_CUSTEMPRELATION ,TARGET ***.TB_COMMON_CUSTEMPRELATION , keycols (BRANCHID, CUSTID, BUSINESTYPECODE, STAFFID); 

    handcollisions被 注释了,也就是说当target端缺失delete 、update数据时,target端无法自动处理。

    解决:

    停止replicat进程,先将要同步的表tb_common_custemprelation给跳过,然后将在目标端上重新初始化此表,保证源和目标上此表的数据是一致,然后再在replicat进程中将tb_commmon_custemprelation加进去,然后启动进程。

    总结:此案例中是源目标端表中数据不一致导致的。

    但是在goldengate应用场景中出现ORA-01403的原因有3个:

     

    1) 如果是表字段不一致,需要修改表字段,异构数据库还需要重新生成表结构定义文件,再重启进程。

    2) 如果是索引不一致,需要重建索引,异构数据库还需要重新生成表结构定义文件,再重启进程。

    3) 遇到这种情况,不能先去对比两端的表结构(可能修改表结构的sql在后面执行),而应该先去查明原因。若是数据问题,可以跳过该表的同步,然后重新同步该表。

    本文出自 “oracle研习” 博客,请务必保留此出处http://2874575.blog.51cto.com/2864575/1009786

  • 相关阅读:
    在ubuntu9中安装配置java postgresql pljava tsearch2
    Zend中配置Memcached
    PHP 截取字符串专题(转)
    网络执法官.P2P终结者等监控网络流量控制软件的原理和防范
    C++中的浮点数格式控制
    HTML教程
    网络执法官.P2P终结者等监控网络流量控制软件的原理和防范
    CodeGear RADstudio 2007+Sp3下载地址及破解
    HTML教程
    CodeGear RADstudio 2007+Sp3下载地址及破解
  • 原文地址:https://www.cnblogs.com/jimeper/p/2972682.html
Copyright © 2020-2023  润新知