GoldenGate系统二:快速搭建三方单向通信GoldenGate环境 分类: H2_ORACLE 2013-05-16 10:54 827人阅读 评论(0) 收藏
1、环境准备
(1)下载安装包并解压至ORACLE_BASE
(2)修改环境变更
[oracle@irms156ogg]$ vi ~/.bashrc
exportPATH=$ORACLE_HOME/bin:/u01/app/ogg:$PATH
(3)创建子目录
[oracle@irms157 ogg]$ ggsci
GGSCI (irms157) 1> create subdirs
Creating subdirectories under currentdirectory /u01/app/ogg
Parameter files /u01/app/ogg/dirprm: already exists
Report files /u01/app/ogg/dirrpt: created
Checkpoint files /u01/app/ogg/dirchk: created
Process status files /u01/app/ogg/dirpcs: created
SQL script files /u01/app/ogg/dirsql: created
Database definitions files /u01/app/ogg/dirdef: created
Extract data files /u01/app/ogg/dirdat: created
Temporary files /u01/app/ogg/dirtmp: created
Stdout files /u01/app/ogg/dirout: created
注:建议所有Goldengate操作均在Goldengate安装目录下进行。
2、开启管理进程
(1)创建管理进程参数文件
GGSCI (irms156) 1> edit params mgr
port 7809
(2)启动管理器
GGSCI(irms156) 2> start mgr
Managerstarted.
GGSCI(irms156) 3> info mgr
Manager isrunning (IP port irms156.7809).
GGSCI(irms156) 4> info all
Program Status Group Lag at Chkpt Time Since Chkpt
MANAGER RUNNING
3、在源端开启补充日志
(1)Oracle-specificinstallation steps
Thefollowing steps are only required when GoldenGate will be capturing data fromthe server. Therefore it is only needed when you are installing GoldenGate forOracle as your<source> environment.
[oracle@irms157 ogg]$ sqlplus /nolog
SQL> conn / as sysdba
Connected.
SQL> alter database add supplementallog data;
Database altered.
SQL> alter system switch logfile;
System altered.
(2)为具体模式对象开启补充日志(Add supplemental logging)
GGSCI (irms156) 9> dblogin useridsystem, password Lu123456;
Successfully logged into database.
GGSCI (irms156) 10> add trandatascott.emp;
ERROR: No viable tables matchedspecification.(注意不要有分号)
GGSCI (irms156) 11> add trandatascott.emp
Logging of supplemental redo dataenabled for table SCOTT.EMP.
GGSCI (irms156) 13> add trandatascott.salgrade
2013-05-14 14:29:47 WARNING OGG-00869 No unique key is defined for table'SALGRADE'. All viable columns will be used to represent the key, but may notguarantee uniqueness. KEYCOLS may beused to define the key.
Logging of supplemental redo dataenabled for table SCOTT.SALGRADE.
GGSCI (irms156) 14> add trandatascott.bonus
2013-05-14 14:30:12 WARNING OGG-00869 No unique key is defined for table 'BONUS'.All viable columns will be used to represent the key, but may not guaranteeuniqueness. KEYCOLS may be used to definethe key.
Logging of supplemental redo dataenabled for table SCOTT.BONUS.
GGSCI (irms156) 15> add trandatascott.dept
Logging of supplemental redo dataenabled for table SCOTT.DEPT.
GGSCI(irms156) 16> info trandata scott.emp
Logging ofsupplemental redo log data is enabled for table SCOTT.EMP.
Columnssupplementally logged for table SCOTT.EMP: EMPNO.
3、数据准备
(1)在目标端创建与源端一样的表
(2)把源端的初始数据导入至目标端
由于本实验采用scott模式,在每个oracle数据库均已默认安装,因此不再需要准备。第2步可使用datapump,goldengatedirect load, sql*loader等方法。
4、配置源端提取
(1)增加抽取组
广东:
GGSCI (irms156) 1> add extracteoragd, tranlog, begin now, threads 1
EXTRACT added.
GGSCI (irms156) 2> info extracteoragd
EXTRACT EORAGD Initialized 2013-05-1414:58 Status STOPPED
Checkpoint Lag 00:00:00 (updated 00:00:13 ago)
Log Read Checkpoint Oracle Redo Logs
2013-05-14 14:58:05 Thread 1, Seqno 0, RBA 0
SCN 0.0 (0)
Log Read Checkpoint Oracle Redo Logs
2013-05-14 14:58:05 Thread 2, Seqno 0, RBA 0
SCN 0.0 (0)
江苏:
GGSCI (irms156) 1> add extract eorajs, tranlog, begin now,threads 1
EXTRACT added.
GGSCI (irms156) 2> info extract eorajs
EXTRACT EORAGD Initialized 2013-05-1414:58 Status STOPPED
Checkpoint Lag 00:00:00 (updated 00:00:13 ago)
Log Read Checkpoint Oracle Redo Logs
2013-05-14 14:58:05 Thread 1, Seqno 0, RBA 0
SCN 0.0 (0)
Log Read Checkpoint Oracle Redo Logs
2013-05-14 14:58:05 Thread 2, Seqno 0, RBA 0
SCN 0.0 (0)
(2)创建抽取进程参数文件
广东:
GGSCI (irms156) 3> edit params eoragd
EXTRACT EORAGD
USERID system, PASSWORD Lu123456
RMTHOST 10.252.48.155, MGRPORT 7809
RMTTRAIL ./dirdat/gd
TABLE scott.emp;
TABLE scott.dept;
TABLE scott.salgrade;
TABLE scott.bonus;
江苏:
GGSCI (irms156) 3> edit params eorajs
EXTRACT EORAJS
USERID system, PASSWORD Lu123456
RMTHOST 10.252.48.155, MGRPORT 7809
RMTTRAIL ./dirdat/js
TABLE scott.emp;
TABLE scott.dept;
TABLE scott.salgrade;
TABLE scott.bonus;
(3)Define the GoldenGate trail
add thetrail that will store the changes on the target.
广东:
GGSCI (irms156) 8> add RMTTRAIL./dirdat/gd, EXTRACT EORAGD
RMTTRAIL added.
GGSCI(irms156) 9> info rmttrail *
Extract Trail: ./dir/gd
Extract: EORAGD
Seqno: 0
RBA: 0
File Size: 5M
江苏:
GGSCI (irms156) 8> add RMTTRAIL./dirdat/js, EXTRACTEORAJS
RMTTRAIL added.
GGSCI(irms156) 9> info rmttrail *
Extract Trail: ./dir/js
Extract: EORAGD
Seqno: 0
RBA: 0
File Size: 5M
(4)启动抽取进程并验证
广东:
GGSCI (irms156) 10> start extracteoragd
Sending START request to MANAGER ...
EXTRACT EORAGD starting
GGSCI (irms156) 11> info extracteoragd, detail
GGSCI(irms156) 12> view report eoragd
江苏:
GGSCI (irms156) 10> start extracteorajs
Sending START request to MANAGER ...
EXTRACT EORAJS starting
GGSCI (irms156) 11> info extract eorajs, detail
GGSCI (irms156)12> view report eorajs
5、配置目标端检查点表
(1)配置全局参数文件并增加检查点表(checkpoint table)
GGSCI (irms155) 1> edit params./globals
checkpointtablescott.ggschkpt
(2)激活GLOBALS参数文件
直接退出再进入ggsci即可生效。
GGSCI (irms155) 2> exit
(3)增加检查点表
GGSCI (irms155) 1> dblogin useridsystem, password Lu123456
Successfully logged into database.
GGSCI (irms155) 3> addcheckpointtable scott.ggschkpt
Successfully created checkpoint tablescott.ggschkpt.
6、配置目标端变更投递
(1)增加replicat组
广东:
GGSCI (irms155) 5> add replicat roragd, exttrail ./dirdat/gd, checkpointtablescott.ggschkpt
REPLICAT added.
江苏:
GGSCI (irms155) 5> add replicat rorajs, exttrail ./dirdat/js, checkpointtablescott.ggschkpt
REPLICAT added.
与源端的配置保持一致。
(2)创建replicat参数文件
广东:
GGSCI (irms155) 7> edit params roragd
REPLICAT RORAGD
USERID system, PASSWORD Lu123456
HANDLECOLLISIONS
ASSUMETARGETDEFS
DISCARDFILE ./dirrpt/RORAGD.DSC, PURGE
MAP scott.emp, TARGET scott.emp;
MAP scott.salgrade, TARGETscott.salgrade;
MAP scott.bonus, TARGET scott.bonus;
MAP scott.dept, TARGET scott.dept;
江苏:
GGSCI (irms155) 7> edit params rorajs
REPLICAT RORAJS
USERID system, PASSWORD Lu123456
HANDLECOLLISIONS
ASSUMETARGETDEFS
DISCARDFILE ./dirrpt/RORAJS.DSC, PURGE
MAP scott.emp, TARGET scott.emp;
MAP scott.salgrade, TARGETscott.salgrade;
MAP scott.bonus, TARGET scott.bonus;
MAP scott.dept, TARGET scott.dept;
(3)启动replicat进程
广东:
GGSCI (irms155) 8> start replicatroragd
Sending START request to MANAGER ...
REPLICAT RORAGD starting
GGSCI (irms155) 9> info replicat roragd
REPLICAT RORAGD Last Started 2013-05-14 15:39 Status RUNNING
Checkpoint Lag 00:00:00 (updated 00:00:09 ago)
Log Read Checkpoint File ./dirdat/gd000000
First Record RBA 0
GGSCI (irms155) 10> info all
Program Status Group Lag at Chkpt Time Since Chkpt
MANAGER RUNNING
REPLICAT RUNNING RORAGD 00:00:00 00:00:02
江苏:
GGSCI (irms155) 8> start replicatrorajs
Sending START request to MANAGER ...
REPLICAT RORAJS starting
GGSCI (irms155) 9> info replicat rorajs
REPLICAT RORAJS Last Started 2013-05-14 15:39 Status RUNNING
Checkpoint Lag 00:00:00 (updated 00:00:09 ago)
Log Read Checkpoint File ./dirdat/js000000
First Record RBA 0
GGSCI (irms155) 10> info all
Program Status Group Lag at Chkpt Time Since Chkpt
MANAGER RUNNING
REPLICAT RUNNING RORAJS 00:00:00 00:00:02
版权声明:本文为博主原创文章,未经博主允许不得转载。