在《GoldenGate step by step installation and configuration》中介绍了最简单的配置,在其最后提到了使用data pump进程作为传递信息的方案来隔离Source的EXTRACT进程和Target的trail文件。
在GG Admin Guide中,"In most cases, it is best practice to use a data pump."
这里,将介绍如何配置data pump进程。
1.在Source停止EXTRACT和MGR process
GGSCI (xxx) 27> stop extract haoext
Sending STOP request to EXTRACT HAOEXT ...
Request processed.
GGSCI (xxx) 28> stop mgr
Manager process is required by other GGS processes.
Are you sure you want to stop it (y/n)? y
Sending STOP request to MANAGER ...
Request processed.
Manager stopped.
2.对Source端的MGR添加PURGEOLDEXTRACTS参数用来控制自动清除本地trail文件
GGSCI (xxx) 36> EDIT PARAMS MGR
PORT 7809
PURGEOLDEXTRACTS TRUE
~
"dirprm/mgr.prm" 2 lines, 27 characters written
GGSCI (xxx) 37> start mgr
Manager started.
GGSCI (xxx) 38> info mgr
Manager is running (IP port xxx.7809).
3.在Source添加EXTRACT
GGSCI (xxx) 40> add EXTRACT HAOEXT2, tranlog,begin now
EXTRACT added.
这里注意添加的是EXTTRAIL,不是RMTTRAIL,所以EXTRACT进程将把抓取的信息放到本地的trail文件里。
GGSCI (xxx) 41> ADD EXTTRAIL ./dirdat/zz, EXTRACT HAOEXT2, megabytes 50
EXTTRAIL added.
GGSCI (xxx) 42> EDIT PARAMS HAOEXT2
EXTRACT HAOEXT2
SETENV (ORACLE_SID=MOT)
USERID GGS@MOT, PASSWORD GGS
EXTTRAIL ./dirdat/zz
TABLE HAOZHU_USER.GGDUMP;
~
"dirprm/haoext2.prm" [New File] 5 lines, 116 characters written
GGSCI (xxx) 43> start extract HAOEXT2
Sending START request to MANAGER ...
EXTRACT HAOEXT2 starting
GGSCI (xxx) 44> info HAOEXT2
EXTRACT HAOEXT2 Initialized 2010-04-22 06:44 Status RUNNING
Checkpoint Lag 00:00:00 (updated 00:05:15 ago)
Log Read Checkpoint Oracle Redo Logs
2010-04-22 06:44:00 Seqno 0, RBA 0
4.在Source添加data pump EXTRACT进程
GGSCI (xxx) 60> ADD EXTRACT HAODP, EXTTRAILSOURCE ./dirdat/zz, BEGIN now
EXTRACT added.
GGSCI (xxx) 61> ADD RMTTRAIL ./dirdat/zz, EXTRACT HAODP, megabytes 50
RMTTRAIL added.
GGSCI (xxx) 62> EDIT PARAMS HAODP
EXTRACT HAODP
SETENV (ORACLE_SID=MOT)
USERID GGS@MOT, PASSWORD GGS
RMTHOST xxx.xxx.xxx.xxx, MGRPORT 7809
RMTTRAIL ./dirdat/zz
TABLE HAOZHU_USER.GGDUMP;
~
"dirprm/haodp.prm" [New File] 6 lines, 153 characters written
GGSCI (xxx) 63> start extract HAODP
Sending START request to MANAGER ...
EXTRACT HAODP starting
GGSCI (xxx) 66> info HAODP
EXTRACT HAODP Last Started 2010-04-22 07:02 Status RUNNING
Checkpoint Lag 00:00:00 (updated 00:00:00 ago)
Log Read Checkpoint File ./dirdat/zz000000
2010-04-22 07:00:56.000000 RBA 895
5.在Target端跟上面一样添加参数PURGEOLDEXTRACTS并重启MGR
GGSCI (xxx) 14> stop REPLICAT HAOREP
Sending STOP request to REPLICAT HAOREP ...
Request processed.
GGSCI (xxx) 15> stop mgr
Manager process is required by other GGS processes.
Are you sure you want to stop it (y/n)? y
Sending STOP request to MANAGER ...
Request processed.
Manager stopped.
GGSCI (xxx) 16> edit params mgr
PORT 7809
PURGEOLDEXTRACTS TRUE
~
"dirprm/mgr.prm" 2 lines, 32 characters written
GGSCI (xxx) 17> start mgr
Manager started.
6.建立REPLICAT Group(同前面一样)
GGSCI (xxx) 19> add replicat HAOREP2, EXTTRAIL ./dirdat/zz, nodbcheckpoint
REPLICAT added.
GGSCI (xxx) 20> edit params HAOREP2
REPLICAT HAOREP2
ASSUMETARGETDEFS
SETENV (ORACLE_SID=DC1)
USERID GGS, PASSWORD GGS
map HAOZHU_USER.GGDUMP , target HAOZHU_USER.GGDUMP;
~
"dirprm/haorep2.prm" [New File] 5 lines, 135 characters written
GGSCI (xxx) 21> start REPLICAT HAOREP2
Sending START request to MANAGER ...
REPLICAT HAOREP2 starting
7.测试
在Source:
SQL> insert into ggdump select * from dba_objects;
9895 rows created.
SQL> commit;
Commit complete.
在Target:
SQL> select count(*) from ggdump;
COUNT(*)
----------
9895
可以找到这样的SQL:
SQL_TEXT
----------------------------------------------------------------
INSERT INTO "HAOZHU_USER"."GGDUMP" ("OWNER","OBJECT_NAME","SUBOB
JECT_NAME","OBJECT_ID","DATA_OBJECT_ID","OBJECT_TYPE","CREATED",
"LAST_DDL_TIME","TIMESTAMP","STATUS","TEMPORARY","GENERATED","SE
CONDARY") VALUES (:a0,:a1,:a2,:a3,:a4,:a5,:a6,:a7,:a8,:a9,:a10,:
a11,:a12)
SQL> select EXECUTIONS,module,PARSING_SCHEMA_NAME from v$sql where hash_value=1142510906;
EXECUTIONS MODULE PARSING_SCHEMA_NAME
---------- ---------------------------------------------------------------- ------------------------------
9895 replicat@xxx (TNS V1-V3) GGS
在Target shutdown replicat和mgr之后,
此时Target端的trail文件被这个远程进程使用着:
> fuser zz000000
zz000000: 17497o
> ptree 17497
18089 zsched
17497 ./server -p 7841 -k -l /xxx/ggserr.log
> kill -9 17497
然后在Source产生一点dml,接着观察Source的error log,发现同样的在N次(超过10次)之后,data pump EXTRACT进程死掉了。
但EXTRACT到本地trail文件的进程还活着。
GGSCI (xxx) 98> info HAODP
EXTRACT HAODP Last Started 2010-04-22 07:06 Status ABENDED
Checkpoint Lag 00:00:00 (updated 00:03:08 ago)
Log Read Checkpoint File ./dirdat/zz000001
2010-04-22 07:24:35.000000 RBA 2912657
GGSCI (xxx) 99> info HAOEXT2
EXTRACT HAOEXT2 Last Started 2010-04-22 07:06 Status RUNNING
Checkpoint Lag 00:00:00 (updated 00:00:07 ago)
Log Read Checkpoint Oracle Redo Logs
2010-04-22 09:35:12 Seqno 64, RBA 1620992
如何恢复?
重启Target mgr和replicat,然后重启Source data pump EXTRACT即可。
至于将data pump EXTRACT的信息放到中间server,其实也就是多加一对EXTRACT而已,没什么区别。
至于cascade replication也很易懂,即配两次而已。
来自 “ ITPUB博客 ” ,链接:http://blog.itpub.net/15415488/viewspace-660456/,如需转载,请注明出处,否则将追究法律责任。
转载于:http://blog.itpub.net/15415488/viewspace-660456/