您好,登錄后才能下訂單哦!
本篇內容主要講解“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進行舉報,并提供相關證據,一經查實,將立刻刪除涉嫌侵權內容。