配置增量刷新偶遇ERROR OGG-01163

Posted tonnytangy

tags:

篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了配置增量刷新偶遇ERROR OGG-01163相关的知识,希望对你有一定的参考价值。

1.从源端拷贝表定义语句,在目标端执行,确保两边表定义一致,另外需要增加三个字段(INC_ID--记录序列值,ACP_TIME--记录接受时间,FLAG--记录操作类型)

2.在源端表增加补充日志trandata(因为源端已经有该表的抽取,所以该步骤可以省略)

3.目标端添加replicat进程

add replicat inccert,exttrail ./dirdat/cust11/la,checkpointtable OGGNEW.CHECKPOINT

4.编辑配置

REPLICAT inccert
setenv (NLS_LANG="AMERICAN_AMERICA.ZHS16GBK")
setenv (ORACLE_SID=xxoo)
setenv (ORACLE_HOME=/opt/oracle/product/11.2)
userid ogg, password xxoo

nohandlecollisions
checksequencevalue
discardrollover
assumetargetdefs
applynoopupdates
--getupdatebefores
reperror default, discard
discardfile /dat/dirrpt/rpcert_001.dsc, append, megabytes 1024
eofdelaycsecs 10
batchsql opsperbatch 2000

MAP CRM20.tb_pty_certif_id_var_info, TARGET test.INC_VAR_INFO,& 
INSERTALLRECORDS,& 
SQLEXEC (id tb_pty_certif_id_var_info, query "select test.SEQ_INC_INFO.nextval id from dual",noparams,ERROR RAISE),& 
SQLEXEC (id tb_pty_certif_id_var_infot,query "select sysdate id from dual",noparams,ERROR RAISE),& 
colmap (
FLAG[email protected] (@GETENV("GGHEADER","OPTYPE"), "UPDATE", "M", "ENSCRIBE COMPUPDATE", "M", "SQL COMPUPDATE", "M", "PK UPDATE", "M", "DELETE", "D", "INSERT", "A", "TRUN
CATE", "T"),& 
INC_ID=tb_pty_certif_id_var_info.id,& 
ACP_TIME=tb_pty_certif_id_var_infot.id,& 
IDENTITY=IDENTITY,&
GENDER=GENDER,&
BIRTHDAY=BIRTHDAY,&
NATIONALITY=NATIONALITY,&
ADDRESS=ADDRESS,&
SIGN_UNIT=SIGN_UNIT,&
DEGREE=DEGREE,&
CAREER=CAREER,&
ADDR_CD=ADDR_CD,&
ADDRESS_COUNT=ADDRESS_COUNT,&
LATN_ID=LATN_ID,&
NAME=NAME,&
CRT_DATE=CRT_DATE,&
PHOTO=PHOTO,&
DATA_SOURCE=DATA_SOURCE,&
CERT_ORG=CERT_ORG,&
EFF_DATE=EFF_DATE,&
EXP_DATE=EXP_DATE
);

5.目标端表添加自增序列

create sequence  crm40.SEQ_INC_INFO
minvalue 1
maxvalue 9999999999999999999999999999
start with 1
increment by 1
cache 2000;

6.起复制进行

alter REPLICAT inccert,begin now

启动后就append了,报错如下

ERROR   OGG-01163  Bad column length (8) specified for column GENDER in table test.INC_VAR_INFO, maximum allowable length is 5.

检查两边表的定义确实都是一致的,所以出现这个问题比较奇怪

解决思路:

在源端生成表的定义,并传送到目标端

$vi source.prm
defsfile ./dirdef/certif.def,purge userid ogg, PASSWORD xxoo table username.tablename;
$defgen paramfile source.prm

在目标端的配置文件中修改相应参数

--assumetargetdefs
sourcedefs ./dirdef/certif.def

重启复制进程后恢复正常

 

 

 

 

 

 

 

 

 

 

 

 

REPLICAT inccertsetenv (NLS_LANG="AMERICAN_AMERICA.ZHS16GBK")setenv (ORACLE_SID=odsb12)setenv (ORACLE_HOME=/opt/oracle/product/11.2)userid oggnew, password ogg#132
nohandlecollisionschecksequencevaluediscardrolloverassumetargetdefsapplynoopupdates--getupdatebeforesreperror default, discarddiscardfile /opt/ogg/dirrpt/rpcert_001.dsc, append, megabytes 1024eofdelaycsecs 10batchsql opsperbatch 2000

MAP CRM20.tb_pty_certif_id_var_info, TARGET crm40.INC_TB_PTY_CERTIF_ID_VAR_INFO,& INSERTALLRECORDS,& SQLEXEC (id tb_pty_certif_id_var_info, query "select crm40.SEQ_INC_TB_PTY_CIV_INFO.nextval id from dual",noparams,ERROR RAISE),& SQLEXEC (id tb_pty_certif_id_var_infot,query "select sysdate id from dual",noparams,ERROR RAISE),& colmap ([email protected] (@GETENV("GGHEADER","OPTYPE"), "UPDATE", "M", "ENSCRIBE COMPUPDATE", "M", "SQL COMPUPDATE", "M", "PK UPDATE", "M", "DELETE", "D", "INSERT", "A", "TRUNCATE", "T"),& INC_ID=tb_pty_certif_id_var_info.id,& ACP_TIME=tb_pty_certif_id_var_infot.id,& IDENTITY=IDENTITY,&GENDER=GENDER,&BIRTHDAY=BIRTHDAY,&NATIONALITY=NATIONALITY,&ADDRESS=ADDRESS,&SIGN_UNIT=SIGN_UNIT,&DEGREE=DEGREE,&CAREER=CAREER,&ADDR_CD=ADDR_CD,&ADDRESS_COUNT=ADDRESS_COUNT,&LATN_ID=LATN_ID,&NAME=NAME,&CRT_DATE=CRT_DATE,&PHOTO=PHOTO,&DATA_SOURCE=DATA_SOURCE,&CERT_ORG=CERT_ORG,&EFF_DATE=EFF_DATE,&EXP_DATE=EXP_DATE);

以上是关于配置增量刷新偶遇ERROR OGG-01163的主要内容,如果未能解决你的问题,请参考以下文章

Oracle案例13—— OGG-01163 Oracle GoldenGate Delivery for Oracle, reprpt01.prm

Linux7硬件时间偶遇扯淡Powerpath启动报错

小白偶遇Sublime Text 3

休眠(mysql)刷新与提交中的自动增量

如何避免 BigQuery 中的 Power BI 增量刷新重复查询?

从另一个配置单元表刷新一个配置单元表