一、双向复制节点2配置:
1)添加附加的redolog信息
DBLOGIN USERID ogg, PASSWORD ogg
ADD TRANDATA scott.*
2)配置extract
GGSCI (ogg2) 11> EDIT PARAMS EORA_1
EXTRACT EORA_1
SETENV (NLS_LANG=AMERICAN_AMERICA.ZHS16GBK)
USERID ogg, PASSWORD ogg
TRANLOGOPTIONS EXCLUDEUSER ogg
EXTTRAIL ./dirdat/ab
TABLE scott.*;
GGSCI (ogg2) 11> ADD EXTRACT EORA_1, TRANLOG, BEGIN NOW
add extract eora_1 ,tranlog,begin now,threads 1
EXTRACT added.
GGSCI (ogg2) 12> ADD EXTTRAIL ./dirdat/ab, EXTRACT EORA_1, MEGABYTES 5
EXTTRAIL added.
GGSCI (ogg2) 13> START EXTRACT EORA_1
3)配置pump进程
GGSCI (ogg2) 15> EDIT PARAMS PORA_1
EXTRACT PORA_1
SETENV (NLS_LANG=AMERICAN_AMERICA.ZHS16GBK)
PASSTHRU
RMTHOST ogg1, MGRPORT 7809
RMTTRAIL ./dirdat/pa
TABLE scott.*;
GGSCI (ogg2) 16> ADD EXTRACT PORA_1, EXTTRAILSOURCE ./dirdat/ab
EXTRACT added.
GGSCI (ogg2) 17> ADD RMTTRAIL ./dirdat/pa, EXTRACT PORA_1, MEGABYTES 5
RMTTRAIL added.
GGSCI (ogg2) 18> START EXTRACT PORA_1
4、第一节点(原来的源数据库)
1、配置checkpoint
GGSCI (ogg1) 1> DBLOGIN USERID ogg, PASSWORD ogg
Successfully logged into database.
GGSCI (ogg1) 2> ADD CHECKPOINTTABLE ogg.checkpoint
GGSCI (ogg1) 3>
2、配置replicate
GGSCI (ogg1) 4> EDIT PARAM RORA_1
REPLICAT RORA_1
SETENV (NLS_LANG=AMERICAN_AMERICA.ZHS16GBK)
USERID ogg, PASSWORD ogg
HANDLECOLLISIONS
ASSUMETARGETDEFS
DISCARDFILE ./dirrpt/RORA_aa.DSC, PURGE
MAP scott.*, TARGET scott.*;
GGSCI (ogg1) 5> add replicat RORA_1,exttrail ./dirdat/pa ,checkpointtable ogg.checkpoint
GGSCI (ogg1) 6> START REPLICAT RORA_1
二、支持DDL复制配置
1、在第两个节点执行执行DDL同步脚本命令:
先进入goldengate软件安装目录,以SYSDBA身份登录oracle执行以下脚本,执行脚本过程中,需要输入的用户全部是ogg,安装模式为INITIALSETUP,如果数据字典或者某些内部的包有错误,则
需要运行catalog.sql和catproc.sql脚本。
SQL>alter system set recyclebin=off;
SQL>@marker_setup
SQL>@ddl_setup
SQL>@role_setup
SQL>grant GGS_GGSUSER_ROLE to ogg;
SQL>@ddl_enable
如果某项脚本执行错误,需要重新执行时,先要执行清除的脚本:ddl_remove.sql和marker_remove.sql
2、配置两个节点的extract,在eora_1配置文件中添加以下一行:
DDL INCLUDE OBJNAME "scott.*"
最终的内容如下:
EXTRACT EORA_1
SETENV (NLS_LANG=AMERICAN_AMERICA.ZHS16GBK)
USERID ogg, PASSWORD ogg
TRANLOGOPTIONS EXCLUDEUSER ogg
EXTTRAIL ./dirdat/ab
DDL INCLUDE OBJNAME "scott.*"
TABLE scott.*;
注意:先关闭eora_1进程,再添加,然后重新启动。
3、配置两个节点的replicat
3.1、GGSCI (ogg1) 6> DBLOGIN USERID ogg, PASSWORD ogg
GGSCI (ogg1) 7> add checkpointtable ogg.checkpoint
如果之前已经添加过,则无需操作。
4、配置REPLICAT进程参数文件,添加以下几行到rora_1配置文件中:
DDL INCLUDE ALL
DDLERROR DEFAULT IGNORE RETRYOP MAXRETRIES 3 RETRYDELAY 5
DDLERROR DEFAULT DISCARD
DDLERROR DEFAULT IGNORE RETRYOP
最终的内容如下:
REPLICAT RORA_1
SETENV (NLS_LANG=AMERICAN_AMERICA.ZHS16GBK)
USERID ogg, PASSWORD ogg
HANDLECOLLISIONS
ASSUMETARGETDEFS
DISCARDFILE ./dirrpt/RORA_aa.DSC, PURGE
DDL INCLUDE ALL
DDLERROR DEFAULT IGNORE RETRYOP MAXRETRIES 3 RETRYDELAY 5
DDLERROR DEFAULT DISCARD
DDLERROR DEFAULT IGNORE RETRYOP
MAP scott.*, TARGET scott.*;
注意:先关闭rora_1进程,再添加,然后重新启动。
需要给目标端的ogg用户授予create any table 权限