OGG 同步

登录oracle数据库所在的服务器
======================Step1:源端执行,把要同步的表记录到oggext用户名下============================================================
数据表添加附加日志,每个表都得做,以便goldengate进行redo的抽取以及应用
GGSCI > dblogin userid oggext,password "oggext"
GGSCI > add trandata HRONLINE.Vap_To_Tms

=====================Step2:源端执行,根据redolog去抽取=============================================================
--注意:不同组的队列文件名前缀要不同,E可以看成Extra的首字母,代表这是一个抽取进程
GGSCI > add extract 50374E99, tranlog, begin now
GGSCI > add exttrail ./dirdat/za, extract 50374E99
==编辑extract抽取进程的参数信息
GGSCI > edit param 50374E99
--配置信息
extract 50374E99
userid oggext, password "oggext"
EXTTRAIL ./dirdat/za
TRANLOGOPTIONS DBLOGREADER
table HRONLINE.Vap_To_Tms;


GGSCI > start 50374E99
GGSCI > stop 50374E99

GGSCI > stats 50374E99
GGSCI > info 50374E99, detail
GGSCI > view report 50374E99

===================Step3:源端执行====================================================================
--配置Pump进程
GGSCI > ADD EXTRACT 50374P99, EXTTRAILSOURCE ./dirdat/za --配置Pump进程的别名,Pump进程要处理的队列文件(这是由Extra进程在上面配置的)
GGSCI > ADD RMTTRAIL ./dirdat/za, EXTRACT 50374P99 --配置RMTTRAIL(Remot+Trail)远程队列文件(这是由远程Mysql端的接收进程(Extra进程)配置的)
GGSCI > edit param 50374P99

extract 50374P99
--userid oggext, password "oggext"
RMTHOST 10.5.6.169,mgrport 7809
RMTTRAIL ./dirdat/za
table HRONLINE.Vap_To_Tms;

GGSCI >start 50374P99
GGSCI >stop 50374P99
GGSCI >info 50374P99, detail
GGSCI >stats 50374P99

==============================step5:源端执行,源端初载=========================================================
======源端初载, -- 10.3.65.115 ggs配置
GGSCI > edit param 50374I99

extract 50374I99
userid oggext, password "oggext"
RMTHOST 10.5.6.169,mgrport 7809
rmttask replicat, group 50374J99
table HRONLINE.Vap_To_Tms;

GGSCI > add extract 50374I99, sourceistable

在源端执行,查看初始化状态
GGSCI > start 50374I99
GGSCI > VIEW REPORT 50374I99

 

 

 

 

===============step4:目的端执行========================================================================
目的端安装复制进程R(Replicat)
GGSCI > add replicat 50374R99, exttrail ./dirdat/za, checkpointtable HRM_PHR_Business.checkpoint
GGSCI > edit param 50374R99

EPLICAT 50374R99
SETENV(MYSQL_UNIX_PORT='/var/lib/mysql/mysql.sock')
dboptions host 10.5.6.169, connectionport 3306
targetdb HRM_PHR_Business,userid itoffice,password "itoffice"
DISCARDFILE ./discrd/reptr.desc,append,megabytes 512
ASSUMETARGETDEFS
HANDLECOLLISIONS
MAP HRONLINE.Vap_To_Tms, target HRM_PHR_Business.Vap_To_Tms;


GGSCI > start replicat 50374R99


==========================step5:目的端执行===========================================
======目的端初载, -- 10.5.6.122 ggs配置
GGSCI > edit param 50374J99

replicat 50374J99
SETENV(MYSQL_UNIX_PORT='/var/lib/mysql/mysql.sock')
dboptions host 10.5.6.169, connectionport 3306
targetdb HRM_PHR_Business,userid itoffice,password "itoffice"
reperror default, discard
DISCARDFILE ./discrd/50374J99.desc,append,megabytes 512
ASSUMETARGETDEFS
MAP HRONLINE.Vap_To_Tms, target HRM_PHR_Business.Vap_To_Tms;

GGSCI> add replicat 50374J99, specialrun

GGSCI > VIEW REPORT 50374J99
=====================================================================
先启动增量抽取进程
启动初载抽取,自动启动初载复制,做成功了
启动增量传输进程
启动增量复制进程 (先包含 HANDLECOLLISIONS 参数)
看lag 增量复制进程,达到3秒内,停止增量复制进程, 关闭 HANDLECOLLISIONS 参数

 

经验 ===================经验

root
zte(*)it
cd data
ls
cd ogg
ls

su - oracle
cd /data/app/ogg
cd dirdat -- 查看文件夹,两个字母开头的 不要重复,自己用Z开头
ggsci

info all -- 看这些 50374E99 存在的进程号

退出 edit param 50374E99
按 Esc键 shift + 冒号 , 输入 wq 最后 回车


mysql端
root
zte(*)it
cd mnt
cd app
cd ogg
ggsci

 

posted @ 2018-03-27 14:55  二零一七  阅读(593)  评论(0编辑  收藏  举报