step 1: 配置mysql
修改配置文件my.ini
#for goldengate
log-bin = "C:/mysql/logbin/logbin.log"
binlog-format = ROW
log-bin-index = "C:\mysql\logindex"
binlog_cache_size=32m
max_binlog_cache_size=512m
max_binlog_size=512m
添加数据库用户ggs,具有DBA权限
step 2: 在mysql服务器上安装配置GoldenGate
创建mgr.prm
PORT 7809
DYNAMICPORTLIST 7840-7914
STARTUPVALIDATIONDELAY 5
PURGEOLDEXTRACTS C:\ogg\dirdat\*, USECHECKPOINTS, MINKEEPDAYS 7
LAGREPORTHOURS 1
LAGINFOMINUTES 30
LAGCRITICALMINUTES 45
创建抽取进程参数ext1.prm
--ext1.prm
EXTRACT ext1
SOURCEDB test@localhost:3306, USERID ggs, PASSWORD 123
DISCARDROLLOVER ON FRIDAY
DISCARDFILE C:\ogg\dirrpt\ext1.dsc, APPEND, MEGABYTES 1024
WARNLONGTRANS 2h, CHECKINTERVAL 3m
REPORTCOUNT EVERY 30 MINUTES, RATE
EXTTRAIL C:\ogg\dirdat\ex
DYNAMICRESOLUTION
NUMFILES 5000
TABLE test.test1;
添加抽取进程ext1
ADD EXTRACT ext1, tranlog, begin now
ADD EXTTRAIL C:\ogg\dirrpt\ex, EXTRACT ext1, megabytes 100
创建传播进程参数dp1.prm
--dp1.prm
EXTRACT dp1
RMTHOST 172.27.35.28, MGRPORT 7809,COMPRESS
RMTTRAIL d:\ogg\dirdat\ex
PASSTHRU
NUMFILES 5000
DYNAMICRESOLUTION
TABLE test.*;
添加抽取进程dp1
ADD EXTRACT dp1, EXTTRAILSOURCE C:\ogg\dirdat\ex
ADD RMTTRAIL d:\ogg\dirdat\ex, EXTRACT dp1, MEGABYTES 100
step 3: 配置defgen
创建defgen参数
--defgen.prm
defsfile C:\ogg\dirdef\defgen.prm
sourcedb test@localhost:3306, userid ggs,password 123
table test.test1;
生成defgen文件
defgen paramfile C:\ogg\dirprm\defgen.prm
将C:\ogg\dirdef目录下的文件defgen.prm拷贝到目标端的相应目录下,即目录.\dirdef下。
step 4: Oracle环境准备
创建数据库用户
create tablespace ggs datafile ‘......‘ size 200m;
create user ggs identified by 123 default tablespace ggs;
grant dba to ggs;
step 5: 在Oracle服务器安装配置GoldenGate
创建mgr参数
--mgr.prm
PORT 7809
DYNAMICPORTLIST 7840-7914
STARTUPVALIDATIONDELAY 5
PURGEOLDEXTRACTS d:\ogg\dirdat\*, USECHECKPOINTS, MINKEEPDAYS 7
LAGREPORTHOURS 1
LAGINFOMINUTES 30
LAGCRITICALMINUTES 45
创建复制进程参数rep1.prm
--rep1.prm
replicat rep1
sourcedefs D:\ogg\dirdef\defgen.prm
userid ggs,password ggs
reperror default,discard
discardfile D:\ogg\dirrpt\rep1.dsc,append,megabytes 50
dynamicresolution
map test.test1, target test.test1;
添加复制进程
dblogin userid ggs password 123
add checkpointtable chkpnttab
add replicat rep1,exttrail D:\ogg\dirdat\ex, checkpointtable chkpnttab
本文出自 “Cheney.Yu” 博客,请务必保留此出处http://cheneyyu.blog.51cto.com/173219/1551683
使用GoldenGate实现MySQL到Oracle的数据实时同步
原文地址:http://cheneyyu.blog.51cto.com/173219/1551683