goldengate映射不同字段以及OGG-00513

映射不同字段
1、使用

GGSCI (test1) 1> edit params degfen

defsfile /home/oracle/ogg/test.p
userid ggs_admin,password ggs_admin
table test.yrename;
2、生成结构文件
/home/oracle/ogg/defgen paramfile /home/oracle/ogg/dirprm/defgen.prm
3、拷贝到远端

scp test.p 192.168.190.7:/home/oracle/ogg  
4、修改REPLICAT配置文件如下 -- 行为新加

replicat rt01
setenv (ORACLE_SID=OLAP)
userid ggs_admin, password ggs_admin
discardfile ./dirrpt/rolap01.dsc,purge
ALLOWDUPTARGETMAP                        --
NODYNAMICRESOLUTION                      --
WILDCARDRESOLVE IMMEDIATE                --
sourcedefs /home/oracle/ogg/test.p       --
MAP test.yrename, TARGET test.yrename,&  --
colmap(usedefaults,ic = im);             --
DYNAMICRESOLUTION
assumetargetdefs
MAPEXCLUDE test.b;
MAPEXCLUDE test.yrename;
MAPEXCLUDE test.c;
map test.*, target test.*;
map ppzhu.d, target ppzhu.d;

同时需要配置DEGFEN文件,这种情况下不允许删除字段等改变结构的DDL,如果更改了表的结构也就是我这里的test.yrename需要按照如下步骤做
Now we can – at the exact right point in the trail – perform the required steps:
- Add the same column to our target table (so that our USEDEFAULTS mapping keeps working)
- Obtain a new source definitions file from the source DB of its current state
- Modify mappings if required
- Restart Replicat with ggsci command START REPLICAT SKIPTRANSACTION
colmap(usedefaults,ic = im)需要修改为colmap(usedefaults),并且重新生成文件,如果已经相同我们完成可以删除
ALLOWDUPTARGETMAP
NODYNAMICRESOLUTION
WILDCARDRESOLVE IMMEDIATE
sourcedefs /home/oracle/ogg/test.p
MAP test.yrename, TARGET test.yrename,&
colmap(usedefaults,ic = im);

我这里修改步骤为
1、重新生成DEGFEN
2、删除表中已经删除的字段对应的字段
3、修改colmap(usedefaults)
4、START REPLICAT SKIPTRANSACTION
当然最好不要在colmap对应的表中进行DDL,也就是说不同结构的表的同步不允许DDL
相应的报错
2014-01-31 13:38:47  ERROR   OGG-00513  Oracle GoldenGate Delivery for Oracle, rt01.prm:  Table with SOURCEDEF cannot have DDL operations (table [test.yrename]). Either remove SOURCEDEF or filter out table from DDL operations.
同时注意一下assumetargetdefs在源端和目标端表结构一致的情况下可用,如果不一致需要使用sourcedefs指定源端的表结构

上一篇:Hibernate更新某些字段的几种update方法


下一篇:spring+hibernate里面操作clob字段