使用goldengate同步mysql

联系:手机/微信(+86 17813235971) QQ(107644445)

标题:使用goldengate同步mysql

作者:惜分飞©版权所有[未经本人同意,不得以任何形式转载,否则有进一步追究法律责任的权利.]

一、source端

add extract extl,vam,begin now
ADD EXTTRAIL F:\ogg\mysql\dirdat\rl, EXTRACT EXTL
edit params extl
extract extl
sourcedb test@localhost:3306,userid root,password xifenfei
exttrail F:\ogg\mysql\dirdat\rl
dynamicresolution
gettruncates
table test.t_1;
add EXTRACT pump1, EXTTRAILSOURCE F:\ogg\mysql\dirdat\rl, BEGIN now
add rmttrail /ogg/mysql/dirdat/rl extract pump1
edit params pump1
extract pump1
rmthost 192.168.1.111,mgrport 7808
rmttrail /ogg/mysql/dirdat/rl
PASSTHRU
gettruncates
table test.t_1;

二、target端

edit params ./GLOBALS
dblogin sourcedb test@localhost:3306,userid root,password xifenfei
CHECKPOINTTABLE ogg.chkpoint
ADD CHECKPOINTTABLE ogg.chkpoint
add replicat repl exttrail /ogg/mysql/dirdat/rl,begin now,checkpointtable ogg.chkpoint
edit params repl
replicat repl
DBOPTIONS HOST 127.0.0.1, CONNECTIONPORT 3306
TARGETDB test,userid root,password xifenfei
assumetargetdefs
reperror default,discard
discardfile /tmp/mysql.dsc,append,megabytes 100
gettruncates
map TEST.T_1, target "test.t_1";

三、说明
本实例是win 中的mysql同步到linux中的mysql
有个注意点:
1、add extract extl,vam,begin now 不像oracle中的tranlog
2、注意各个参数中schema.tablename大小写问题
1)win中不区分,全部使用小写会自动转换为大写
2)在replicate参数中,因为map是从win中的data pump中得到,所以map后面的schema.tablename需要大写
3)在replicate参数中,因为table是linux中的对应linux中的数据库名和表名(mysql是以文件形式存储,一般均为小写),所以map后面的schema.tablename需要小写+双引号,防止转为大写
3、注意mysql数据库编码
四、与oracle不同之处
1、登录
dblogin sourcedb dbname@localhost:3306,userid root,password xifenfei
2、Extract中访问mysql
sourcedb dbname@localhost:3306,userid root,password xifenfei
3、Replicat中访问mysql
DBOPTIONS HOST 127.0.0.1, CONNECTIONPORT 3306
TARGETDB dbname,userid root,password xifenfei

One thought on “使用goldengate同步mysql

  1. 在centos上,报下面的错误(mysql的binlog已经开启,format设为row):
    Source Context :
    SourceModule : [ggvam.gen]
    SourceID : [/mnt/ecloud/workspace/Build_OpenSys_r11.1.1.0.3_001_[36467]/perforce/src/gglib/ggvam/cvamgen.cpp]
    SourceFunction : [vamInitialize]
    SourceLine : [418]
    ThreadBacktrace : [9] elements
    : [/usr/ggs_v11/extract(CMessageContext::AddThreadContext()+0x26) [0x7c5666]]
    : [/usr/ggs_v11/extract(CMessageFactory::CreateMessage(CSourceContext*, unsigned int, …)+0x7b2) [0x7bc102]]
    : [/usr/ggs_v11/extract(_MSG_ERR_VAM_API_ERROR_MSG(CSourceContext*, char const*, int, char const*, CMessageFactory:
    :MessageDisposition)+0xa6) [0x78c806]]
    : [/usr/ggs_v11/extract(com_goldengate_vam::CVamGen::vamInitialize()+0x13c3) [0x72c5c3]]
    : [/usr/ggs_v11/extract(com_goldengate_vam::CVAMEXT_initialize()+0x3ad) [0x6e175d]]
    : [/usr/ggs_v11/extract [0x57588b]]
    : [/usr/ggs_v11/extract(main+0xf8a) [0x59ae3a]]
    : [/lib64/libc.so.6(__libc_start_main+0xf4) [0x362701d994]]
    : [/usr/ggs_v11/extract(__gxx_personality_v0+0x19a) [0x51086a]]
    2011-09-27 11:17:28 ERROR OGG-00146 VAM function VAMInitialize returned unexpected result: error 600 – VAM Client Report .

发表评论

邮箱地址不会被公开。 必填项已用*标注

17 − 11 =