加入收藏 | 设为首页 | 会员中心 | 我要投稿 威海站长网 (https://www.0631zz.cn/)- 科技、建站、经验、云计算、5G、大数据,站长网!
当前位置: 首页 > 站长百科 > 正文

ogg异构oracle-mysql

发布时间:2020-12-24 11:32:49 所属栏目:站长百科 来源:网络整理
导读:/* 参数文件里,TABLE参数中有cols和COLSEXCEPT 项 前者用来选择要capture的字段,后者指定要排除的字段 但是官方文档上有一句 Do not exclude key columns,and do not use COLSEXCEPT to exclude columns that contain unsupported data types. */ scott.bo

目的端的ogg日志:
2014-04-02 16:21:55 INFO OGG-00975 Oracle GoldenGate Manager for MySQL,mgr.prm: REPLICAT REP3 starting.
2014-04-02 16:21:55 INFO OGG-00995 Oracle GoldenGate Delivery for MySQL,rep3.prm: REPLICAT REP3 starting.
2014-04-02 16:21:55 INFO OGG-03035 Oracle GoldenGate Delivery for MySQL,rep3.prm: Operating system character set identified as UTF-8. Locale: en_US,LC_ALL:.
2014-04-02 16:21:55 INFO OGG-01815 Oracle GoldenGate Delivery for MySQL,rep3.prm: Virtual Memory Facilities for: COM
anon alloc: mmap(MAP_ANON) anon free: munmap
file alloc: mmap(MAP_SHARED) file free: munmap
target directories:
/home/oracle/app/oracle/ogg/dirtmp.
2014-04-02 16:21:55 INFO OGG-00996 Oracle GoldenGate Delivery for MySQL,rep3.prm: REPLICAT REP3 started.

2014-04-02 16:22:17 INFO OGG-00963 Oracle GoldenGate Manager for MySQL,mgr.prm: Command received from EXTRACT on host ::ffff:192.168.0.164 (START SERVER CPU -1 PRI -1 TIMEOUT 300 PARAMS ).
2014-04-02 16:22:17 INFO OGG-01677 Oracle GoldenGate Collector for MySQL: Waiting for connection (started dynamically).
2014-04-02 16:22:17 INFO OGG-00963 Oracle GoldenGate Manager for MySQL,mgr.prm: Command received from SERVER on host localhost.localdomain (REPORT 30868 7810).
2014-04-02 16:22:17 INFO OGG-00974 Oracle GoldenGate Manager for MySQL,mgr.prm: Manager started collector process (Port 7810).
2014-04-02 16:22:17 INFO OGG-01228 Oracle GoldenGate Collector for MySQL: Timeout in 300 seconds.
2014-04-02 16:22:22 INFO OGG-01229 Oracle GoldenGate Collector for MySQL: Connected to ::ffff:192.168.0.164:61104.
2014-04-02 16:22:22 INFO OGG-01669 Oracle GoldenGate Collector for MySQL: Opening /home/oracle/app/oracle/ogg/dirdat/xs000000 (byte -1,current EOF 0).
2014-04-02 16:22:53 INFO OGG-03010 Oracle GoldenGate Delivery for MySQL,rep3.prm: Performing implicit conversion of column data from character set windows-936 to ISO-8859-1.

双向同步需要考虑的是怎么解决循环复制,以及同时更新一张表以谁为基准。
配置过程就不写了,大致和oracle到mysql的单向+mysql到oracle的单向差不多。
需要注意的有如下几点:
1.oracle和mysql的2端,抽取(extract)和应用(replication)应该使用不同的用户
2.为解决禁止循环复制,应该在ext进程配置3个参数,如下:
oracle的extract:

extract ext4
dynamicresolution
userid ggs,password ggs
RANLOGOPTIONS EXCLUDEUSER repggs
GETAPPLOPS
IGNOREREPLICATES
exttrail /home/oracle/app/oracle/ogg/dirdat/dd
table hr.ah6;

mysql的extract:

extract ext5
setenv (MYSQL_HOME="/u01/mysql")
sourcedb [email?protected]:3306,password 123456
tranlogoptions altlogdest /tmp/binlog.index
TRANLOGOPTIONS EXCLUDEUSER reproot
GETAPPLOPS
IGNOREREPLICATES
exttrail /home/oracle/app/oracle/ogg/dirdat/mb
--dynamicresolution
--gettruncates
table sure.ah6;

只复制应用产生的数据,忽略replication产生的数据,以及忽略replication进程的用户。
3. ./GLOBALS 是全局变量,只在replication的时候有用,所以配置的时候需要加上:
GGSCHEMA repggs --这个参数只在oracle里面有
CheckpointTable repggs.checkpointtab --这个参数oracle和mysql里面都有
4.在extract用ggs/root用户,在replication用repggs/reproot用户
5.因为是双向同步,所以同一个表,比如说ah6,在oracle生成的define要传递到mysql去,在mysql生成的define也要传递到oracle去。
所以,建议命名规则是oracle->mysql:ah6_o2m.prm,mysql->oracle:ah6_m2o.prm
6.从oracle复制到mysql的dml操作,需要手工commit,这个还没找到解决的方法(除了把auto_commit改为on)。

-------------------------------------------------------------------------------------------------------------------------
配置ogg异构mysql-oracle 单向同步
从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 [email?protected]:3306,password 123456
tranlogoptions altlogdest /tmp/binlog.index
exttrail /home/oracle/app/oracle/ogg/dirdat/mb
--dynamicresolution
--gettruncates
table sure.ah6;
2.给ext5添加本地trail
add extract ext5,begin now
add exttrail /home/oracle/app/oracle/ogg/dirdat/mb,extract ext5
3.配置pump进程
edit params pump5
extract pump5
rmthost 192.168.0.164,mgrport 7809
rmttrail /home/oracle/app/oracle/ogg/dirdat/mb
passthru
table sure.ah6;
4.给pump5添加本地和远程的trail
add extract pump5,exttrailsource /home/oracle/app/oracle/ogg/dirdat/mb
add rmttrail /home/oracle/app/oracle/ogg/dirdat/mb,extract pump5
5.配置define文件
edit params ah6
defsfile /home/oracle/app/oracle/ogg/dirdef/ah6.prm
sourcedb [email?protected]:3306,password 123456
table sure.ah6;
生成define,并将define传到oracle服务器上
./defgen paramfile dirprm/ah6.prm
------------------------
以下是配置目的端(oracle)
1.配置接收进程
edit params rep2
replicat rep2
sourcedefs /home/oracle/app/oracle/ogg/dirdef/ah6.prm
userid ggs,password ggs
reperror default,discard
discardfile /home/oracle/app/oracle/ogg/dirrpt/rep2.dsc,megabytes 50
dynamicresolution
map sure.ah6,target hr.ah6;
2.添加checkpoint表
add checkpointtable ggs.checkpointtab
3.给接收进行添加trail和checkpoint table
add replicat rep2,exttrail /home/oracle/app/oracle/ogg/dirdat/mb,checkpointtable ggs.checkpointtab
add replicat rep2,checkpointtable repggs.checkpointtab
--alter replicat rep2,checkpointtable repggs.checkpointtab

需要注意的是,mysql需要使用log的format为row模式。另外,要注意binlog-do-db这个参数,如果配置了的话,那么一定要包含需要复制的数据库在内,我就在这个地方犯了傻。
----------------------------------------------------------------------------------------------------------------------
配置ogg异构oracle-mysql 双向同步注意事项
双向同步需要考虑的是怎么解决循环复制,以及同时更新一张表以谁为基准。
配置过程就不写了,大致和oracle到mysql的单向+mysql到oracle的单向差不多。
需要注意的有如下几点:
1.oracle和mysql的2端,抽取(extract)和应用(replication)应该使用不同的用户
2.为解决禁止循环复制,应该在ext进程配置3个参数,如下:
oracle的extract:

(编辑:威海站长网)

【声明】本站内容均来自网络,其相关言论仅代表作者个人观点,不代表本站立场。若无意侵犯到您的权利,请及时与联系站长删除相关内容!

热点阅读