源库: 192.168.31.16 TNS=orcl 目标库: 192.168.31.113 TNS=vmsys --------------------------------------------- 表结构: SQL> desc jack.t10 --源表 Name Null? Type ----------------------------------------- -------- ---------------------------- ID NUMBER NAME VARCHAR2(800) AGE NUMBER SQL> desc jack.t10 --目标表 Name Null? Type ----------------------------------------- -------- ---------------------------- TID NUMBER TNAME VARCHAR2(800) TAGE NUMBER SQL> 源库OGG配置 1. extract进程配置: GGSCI (rac01) 2> view param lxt10 EXTRACT lxt10 ------------------------------------------ -- local extract for jack.t10 ------------------------------------------ SETENV (NLS_LANG=american_america.AL32UTF8) SETENV (ORACLE_SID=orcl) USERID ogg@orcl,PASSWORD ogg TRANLOGOPTIONS ASMUSER sys@ASM,ASMPASSWORD oracle EXTTRAIL /goldengate/dirdat/orcl/ww TABLE jack.t10; 2. DataPump进程配置: GGSCI (rac01) 3> view param lpt10 EXTRACT lpt10 ---------------------------------------------- -- DataPump extract lpjack for jack.t10 ---------------------------------------------- USERID ogg@orcl,PASSWORD ogg NOPASSTHRU RMTHOST 192.168.31.113 MGRPORT 7809 RMTTRAIL /goldengate/dirdat/orcl/ww TABLE jack.t10; 3. 创建定义参数文件 GGSCI (rac01) 4> view param defgen DEFSFILE /goldengate/dirdef/rejackt10.defs USERID ogg@orcl,password ogg TABLE jack.t10; 4. 生成定义文件 [oracle@rac01 goldengate]$ /goldengate/defgen paramfile /goldengate/dirprm/defgen.prm 5. 复制到目标端的/goldengate/dirdef/目录中 scp /goldengate/dirdef/rejackt10.def 192.168.31.113:/goldengate/dirdef/ 目标库OGG配置 1. replicat进程配置 GGSCI (class113) 2> view param ret10 replicat ret10 ----------------------------- -- replicat for jack.t10 ----------------------------- USERID ogg@vmsys,password ogg HandleCollisions SourceDefs /goldengate/dirdef/rejackt10.defs --此为定义文件,源端配置好复制过来的,目标端引用 -- AssumeTargetDefs --此参数不可与SourceDefs同用 Map jack.t10,Target jack.t10,colmap(USEDEFAULTS,tid=id,tname=name,tage=age);