Goldengate配置oracle to mysql

以前oracle to mysql试验总是有乱码问题不能解决,后来和同事交流中,他说oracle使用ogg的11g版本,mysql使用ogg的10g版本可以解决乱码问题,开始我还是怀疑,因为想新的版本都不行,难道老版本就可以解决这个问题吗?抱着试试看的态度,做了个试验,尽然成功了,把试验的相关情况记录下来


mysql参数配置(cat /etc/my.cnf):


[client]


default-character-set = gbk


[mysqld]


lower_case_table_names=1�C表名不区分大小写(省的在repl进程中因为大小写的问题导致不能捕获数据)


character-set-server = gbk


表/列编码:均为gbk


Note:


1、因为mysql是target端,所以对于log-bin/binlog_format参数无要求


2、通过以上设置确保mysql的所有相关编码均为gbk


系统编码配置(cat /etc/sysconfig/i18n):


source:


LANG=”zh_CN.GBK”


SUPPORTED=”zh_CN.GBK:zh_CN:zh”


SYSFONT=”latarcyrheb-sun16″


target:


LANG=”zh_CN.GBK”


SYSFONT=”latarcyrheb-sun16″


Note:是的系统编码和mysql编码相同


OGG配置过程:


source端:


add extract ext-all,tranlog,begin now


ADD EXTTRAIL /opt/OGG/dirdat/extract/AL, EXTRACT ext-all


edit params ext-all



extract ext-all


SETENV (NLS_LANG =AMERICAN_AMERICA.ZHS16GBK)


userid is1ogg,password passw0rd


exttrail /opt/OGG/dirdat/extract/AL


discardfile /opt/OGG/discard/ext-all.txt, append, megabytes 100


DDL INCLUDE MAPPED OPTYPE alter OBJNAME ECP.TAB*


TABLE ecp.*;



add EXTRACT p-air, EXTTRAILSOURCE /opt/OGG/dirdat/extract/AL, BEGIN now


add rmttrail /opt/OGG/dirdat/rl extract p-air


edit params p-air



extract p-air


SETENV (NLS_LANG =AMERICAN_AMERICA.ZHS16GBK)


userid is1ogg,password passw0rd


RMTHOST 192.168.1.4,MGRPORT 7809,TCPBUFSIZE 100000,TCPFLUSHBYTES 300000


rmttrail /opt/OGG/dirdat/rl


discardfile /opt/OGG/discard/p-air.txt, append, megabytes 100


TABLE ecp.*;


target端:


add replicat repl, exttrail /opt/OGG/dirdat/rl,nodbcheckpoint


edit params repl



replicat repl


DBOPTIONS HOST 127.0.0.1, CONNECTIONPORT 3306


TARGETDB ecp,userid root,password xifenfei


assumetargetdefs


reperror default,discard


discardfile /tmp/mysql.dsc,append,megabytes 100


MAP ECP.TAB_UUM_DEPT, TARGET ecp.tab_uum_dept;


MAP ECP.TAB_UUM_DEPT_LEADER, TARGET ecp.tab_uum_dept_leader;



oracle视频教程请关注:http://u.youku.com/user_video/id_UMzAzMjkxMjE2.html

你可能感兴趣的:(TO,oracle,mysql,goldengate)