- 操作系统
源端:AIX 7.1,目标端:redhat linux6.8
- 源端ogg介质
121211_ggs_AIX_ppc_shiphome(解压安装即可 需oracle用户安装)
- 目标端ogg介质
ggs_Adapters_Linux_x64.zip
- 目标端MQ介质
mqadv_dev80_linux_x86-64.tar
- .bingding配置文件 (ESB同事提供,上传ogg家目录,并赋予权限)
- JMS 配置清单目录 (ESB同事提供)
- Ogg格式文件(ESB同事提供,文件名ogg-format-esb.vm)
源端镜像库:
开启归档(设置好归档过期清除策略)
select supplemental_log_data_min,force_logging from v$database;---需YES
SQL>ALTER SYSTEM SET ENABLE_GOLDENGATE_REPLICATION = TRUE SCOPE=BOTH
源端配置:
配置ogg参数文件
源端配置过程:
dblogin userid himss@20.100.0.115/oracle, password himss ---镜像库 远程连接主库 添加trandata
create subdirs #创建相关目录
编辑mgr参数:
edit params mgr
port 7809 DYNAMICPORTLIST 7810-7860 PURGEOLDEXTRACTS ./dirdat/*,USECHECKPOINTS, MINKEEPHOURS 72 AUTORESTART ER *, RETRIES 5 , WAITMINUTES 2 LAGREPORTHOURS 1 LAGCRITICALMINUTES 10
添加附加日志:
add trandata his.ms_brda
add trandata his.zy_brda
info trandata his.ms_brda
info trandata his.zy_brda
生成表结构文件
Edit Param hisc
userid himss,password himss defsfile ./dirdef/hisc.def,purge table his.ms_brda; table his.zy_brda;
./defgen paramfile dirprm/hisc.prm
配置抽取进程、投递进程:
edit param ehisc
Extract ehisc userid himss, password himss exttrail ./dirdat/hc TRANLOGOPTIONS MINEFROMACTIVEDG table his.ms_brda,cols(BRID,MZHM,BRXM,SFZH); table his.zy_brda,cols(BAHM,MZHM,SFZH,BRXM);
edit param phisc
Extract phisc rmthost 20.100.2.23, mgrport 7809, compress rmttrail ./dirdat/hc PASSTHRU Dynamicresolution TABLE HIS.MS_BRDA; TABLE HIS.ZY_BRDA;
添加进程信息:
Add Extract ehisc, TranLog, Begin Now
Add ExtTrail ./dirdat/hc, Extract ehisc, Megabytes 5
Add Extract phisc, ExtTrailSource ./dirdat/hc
Add RmtTrail ./dirdat/hc, Extract phisc, Megabytes 5
目标端配置
1、添加用户组: groupadd oinstall groupadd dba useradd -g oinstall -G dba oracle
2、检查jdk的环境变量
java -version
环境变量配置:
Vi .bash_profile
export GGS_HOME=/home/ogg/ export JAVA_HOME=/usr/lib/jvm/java-1.7.0-openjdk-1.7.0.99.x86_64/ export LD_LIBRARY_PATH=/usr/lib/jvm/java-1.7.0-openjdk-1.7.0.99.x86_64/jre/lib/amd64:/usr/lib/jvm/java-1.7.0-openjdk-1.7.0.99.x86_64/jre/lib/amd64/server export PATH
3、安装mq
# mkdir -p /opt/mqm ##创建MQ的安装目录 # tar -zxvf mqadv_dev80_linux_x86-64.tar.gz # mv MQServer /opt/mqm # cd /opt/mqm # chmod a+x -R * ./mqlicense.sh rpm -ivh MQSeriesRuntime-8.0.0-4.x86_64.rpm rpm -ivh MQSeriesJava-8.0.0-4.x86_64.rpm
4、ggs_Adapters安装
5、配置
create subdirs #创建相关目录
edit param mgr
Port 7809 DYNAMICPORTLIST 7810-7960 PurgeOldExtracts ./dirdat/*, UseCheckpoints PURGEOLDEXTRACTS ./dirdat/* ,USECHECKPOINTS, MINKEEPHOURS 72 AUTORESTART ER *, RETRIES 5, WAITMINUTES 2 LAGREPORTHOURS 1 LAGCRITICALMINUTES 10
edit param rhisc
EXTRACT rhisc setEnv ( GGS_USEREXIT_CONF = "./dirprm/rhisc.properties" ) setEnv (JAVA_HOME=/usr/lib/jvm/java-1.7.0-openjdk-1.7.0.99.x86_64/) CUserExit libggjava_ue.so CUSEREXIT PASSTHRU INCLUDEUPDATEBEFORES,PARAMS "./dirprm/rhisc.properties" getUpdateBefores sourceDefs ./dirdef/hisc.def TABLE HIS.MS_BRDA; TABLE HIS.ZY_BRDA;
add extract rhisc,exttrailsource ./dirdat/hc
$ cd $GGS_HOME/dirprm
$vi rhisc.properties
gg.handlerlist=myjms1 ##java.naming.factory.initial=com.sun.jndi.fscontext.RefFSContextFactory java.naming.factory.initial=com.sun.jndi.fscontext.RefFSContextFactory ##(初始化上下文工厂,ESB同事负责提供) java.naming.provider.url=file:/home/ogg/ #ogg安装的目录 gg.handler.myjms1.type=jms #gg.handler.myjms1.destination=EQ.J01.CDCPUSH.In #目标名称,ESB同事负责提供 gg.handler.myjms1.destination=EQ.J01.CDCPUSH.In ##gg.handler.myjms1.connectionFactory=HISFactory gg.handler.myjms1.connectionFactory=HISFactory #连接工厂名称,ESB同事负责提供 gg.handler.myjms1.format=ogg-format-esb.vm #ogg格式文件,这里是声明,我们必须把次文件名‘ogg-format-esb.vm’上传到ogg安装目录下 gg.handler.myjms1.mode=tx goldengate.userexit.nochkpt=TRUE goldengate.userexit.datetime.removecolon=true goldengate.userexit.utf8mode=true goldengate.userexit.timestamp=utc8 goldengate.userexit.timestamp=cst goldengate.log.logname=cuserexit goldengate.log.level=INFO goldengate.log.tofile=true goldengate.userexit.writers=javawriter javawriter.stats.time=3600 javawriter.stats.numrecs=10000 javawriter.stats.full=TRUE javawriter.stats.display=TRUE javawriter.bootoptions=-Xmx2048m -Xms1024m -Djava.class.path=/home/ogg/ggjava/ggjava.jar:/opt/mqm/java/lib/jms.jar:/opt/mqm/java/lib/com.ibm.mq.headers.jar:/opt/mqm/java/lib/com.ibm.mq.jar:/opt/mqm/java/lib/com.ibm.mq.jmqi.jar:/opt/mqm/java/lib/com.ibm.mq.pcf.jar:/opt/mqm/java/lib/com.ibm.mqjms.jar:/opt/mqm/java/lib/fscontext.jar:/opt/mqm/java/lib/providerutil.jar:/home/ogg/ggjava/resources/lib/optional/log4j-1.2.17.jar:/home/ogg/ggjava/resources/lib/optional/slf4j-log4j12-1.7.6.jar -Djava.library.path=/opt/mqm/java/lib64 -Dlog4j.configuration=log4j.properties
过程中遇到的错误:
1、
结果:
报错明显 为参数配置问题:rhisc.properties文件结尾处缺少了空格
2、
结果:这个报错是MQ进程无法初始化,esb同事提供的文件问题
3、
结果:
这个报错尝试了几个步骤:队列 队列管理器 管道大小均设置成最大99999999(会按照最小那个生效,默认4M)
字符集设置成1208(utf-8)格式