本篇内容主要讲解“Goldengate异构数据同步的具体方案”,感兴趣的朋友不妨来看看。本文介绍的方法操作简单快捷,实用性强。下面就让小编来带大家学习“Goldengate异构数据同步的具体方案”吧!
ORACLE源库配置准备工作:
1)开启附加日志
select supplemental_log_data_min from v$database; SUPPLEME --------------- NO alter database add supplemental log data; select supplemental_log_data_min from v$database; SUPPLEME --------------- YES
2)开启归档(已经是归档模式,省略)
SQL> shutdown immediate SQL> startup mount SQL> alter database archivelog; SQL> archive log list; Database log mode Archive Mode Automatic archival Enabled Archive destination /u01/arch SQL> alter database open;
3)创建OGG同步用户:
create user goldengate identified by goldengate default tablespace users; grant dba to goldengate;
源库操作(oracle端):
1源端删除抽取,传输进程:
dblogin userid goldengate, password goldengate
--增加待同步表的附加日志:
add trandata MW_APP. DYT_DATALOSTRECORD
创建抽取进程相关GGLOG日志目录:
mkdir –p /ogg/gglog/e_MW_APP/
增加新的抽取进程:
add extract e_MW_APP, tranlog, begin now add exttrail /ogg/gglog/e_MW_APP/ex, extract e_MW_APP,megabytes 200
2,删除并增加传输进程:
add extract p_MW_APP, exttrailsource /ogg/gglog/e_MW_APP/ex add rmttrail /ogg/gglog/MW_APP/re, extract p_MW_APP, megabytes 200
3在源端启动抽取进程前,先做以下操作:
alter extract p_MW_APP,begin now --让传输进程从此刻开始启动传输数据 start e_MW_APP
创建要同步的表的定义(重要)
1. #创建参数文件
GGSCI (pos300-db01) 10> edit param defgen defsfile ./dirdef/MW_APP.def userid goldengate, password goldengate table MW_APP.*; #生成表定义文件 ./defgen paramfile ./dirprm/defgen.prm #传至目标库目录 scp /ogg/software/dirdef/MW_APP.def root@192.168.1.241:/ogg/software/dirprm
目标库(MYSQL端)
4删除复制进程和检查点表:
目标库为Mysql, 同oracle与oracle之间的同步略有区别
1)创建用户和待同步库
mysql> GRANT ALL PRIVILEGES ON `MW_APP`.* TO root@'%' IDENTIFIED BY ‘root’; mysql>create database MW_APP;
2)创建目录
GGSCI (zoop300) 1> create subdirs Creating subdirectories under current directory /home/mysql Parameter files /goldengate/dirprm: created Report files /goldengate/dirrpt: created Checkpoint files /goldengate/dirchk: created Process status files /goldengate/dirpcs: created SQL script files /goldengate/dirsql: created Database definitions files /goldengate/dirdef: created Extract data files /goldengate/dirdat: created Temporary files /goldengate/dirtmp: created Stdout files /goldengate/dirout: created mkdir –p /ogg/gglog/MW_APP/
3)配置管理进程
GGSCI (zoop300) 3> edit params mgr 加入:port 7809 GGSCI (zoop300) 4> start mgr Manager started. GGSCI (zoop300) 3> info mgr Manager is running
4)配置检查点及全局
GGSCI (zoop300) 4> dblogin sourcedb MW_APP userid root password root GGSCI (zoop300) 5> add checkpointtable MW_APP.checkpoint_table GGSCI (zoop300) 6> edit params ./GLOBALS checkpointtable MW_APP.checkpoint_table
5)配置replicat进程
GGSCI (zoop300) 8> add replicat r_MW_APP ,exttrail /ogg/gglog/MW_APP/re,checkpointtable MW_APP.checkpoint_table
编辑replicat进程
edit params r_MW_APP
--加入下列参数
replicat r_MW_APP targetdb MW_APP userid root password root handlecollisions sourcedefs /ogg/software/dirprm/MW_APP.def discardfile /ogg/software/dirrpt/dcr1.dsc,purge map MW_APP.DYT_DATALOSTRECORD,target MW_APP.DYT_DATALOSTRECORD;
启动进程:
GGSCI (zoop300) 9> start dcr1
4、测试数据同步
附录:
--各进程配置 -E extract e_MW_APP SETENV (ORACLE_HOME = "/u01/oracle") SETENV (ORACLE_SID = "idoracle") SETENV (NLS_LANG = "AMERICAN_AMERICA.ZHS16GBK") userid goldengate,password goldengate exttrail /ogg/gglog/e_MW_APP/ex discardfile /ogg/software/dirrpt/e_MW_APP.dsc,append TRANLOGOPTIONS DBLOGREADER dynamicresolution table MW_APP.DYT_DATALOSTRECORD; -P extract p_MW_APP rmthost 192.168.1.241,mgrport 7809 passthru rmttrail /ogg/gglog/MW_APP/re table MW_APP.DYT_DATALOSTRECORD; -R replicat r_MW_APP targetdb MW_APP userid root password root handlecollisions sourcedefs /ogg/software/dirprm/MW_APP.def discardfile /ogg/software/dirrpt/dcr1.dsc,purge map MW_APP.DYT_DATALOSTRECORD,target MW_APP.DYT_DATALOSTRECORD;
到此,相信大家对“Goldengate异构数据同步的具体方案”有了更深的了解,不妨来实际操作一番吧!这里是亿速云网站,更多相关内容可以进入相关频道进行查询,关注我们,继续学习!
免责声明:本站发布的内容(图片、视频和文字)以原创、转载和分享为主,文章观点不代表本网站立场,如果涉及侵权请联系站长邮箱:is@yisu.com进行举报,并提供相关证据,一经查实,将立刻删除涉嫌侵权内容。