从mysql到oracle和oracle到mysql差不多。大致步骤如下:
环境是:
192.168.0.165 (Mysql ) —> 192.168.0.164 ( Oracle )
想将mysql的sure库下的ah6 同步到 oracle的 hr.ah6下
版本:
操作系统:redhat5.8
Oracle: 11.2.0.3
Mysql: 5.5.37
goldgate:
11.2.0.1.3 for oracle
11.2.0.1.1 for mysql
大致的配置过程如下:
----------------------------
源端(mysql,以log-bin方式启动的,format为row)
1.配置抽取进程
edit params ext5
extract ext5
setenv (MYSQL_HOME="/u01/mysql")
sourcedb sure@localhost:3306,userid root,password 123456
tranlogoptions altlogdest /tmp/binlog.index
exttrail /u01/ogg/11.2/dirdat/mb
--dynamicresolution
--gettruncates
table sure.ah6;
2.给ext5添加本地trail
add extract ext5,tranlog,begin now
add exttrail /u01/ogg/11.2/dirdat/mb,extract ext5
3.配置pump进程
edit params pump5
extract pump5
rmthost 192.168.0.164,mgrport 7809
rmttrail /u01/ogg/11.2/dirdat/mb
passthru
table sure.ah6;
4.给pump5添加本地和远程的trail
add extract pump5,exttrailsource /u01/ogg/11.2/dirdat/mb
add rmttrail /u01/ogg/11.2/dirdat/mb,extract pump5
5.配置define文件
edit params ah6
defsfile /u01/ogg/11.2/dirdef/ah6.prm
sourcedb sure@localhost:3306,userid root,password 123456
table sure.ah6;
生成define,并将define传到oracle服务器上
./defgen paramfile dirprm/ah6.prm
------------------------
以下是配置目的端(oracle)
1.配置接收进程
edit params rep2
replicat rep2
sourcedefs /u01/ogg/11.2/dirdef/ah6.prm
userid ggs,password ggs
reperror default,discard
discardfile /u01/ogg/11.2/dirrpt/rep2.dsc,append,megabytes 50
dynamicresolution
map sure.ah6, target hr.ah6;
2.添加checkpoint表
add checkpointtable ggs.checkpointtab
3.给接收进行添加trail和checkpoint table
add replicat rep2,exttrail /u01/ogg/11.2/dirdat/mb,checkpointtable ggs.checkpointtab
add replicat rep2,exttrail /u01/ogg/11.2/dirdat/mb,checkpointtable repggs.checkpointtab
--alter replicat rep2,exttrail /u01/ogg/11.2/dirdat/mb,checkpointtable repggs.checkpointtab
需要注意的是,mysql需要使用log的format为row模式。另外,要注意binlog-do-db这个参数,如果配置了的话,那么一定要包含需要复制的数据库在内,我就在这个地方犯了傻。
本站文章如无特殊说明,均为本站原创,如若转载,请注明出处:配置ogg异构mysql-oracle 单向同步 - Python技术站