GoldenGate<三> configure data-distribution(1對多複製)

viadeazhu發表於2010-04-22

    此文將在前兩文基礎上介紹如何配置一個一對多的資料分散式複製體系。

    方法與前面大同小異,再次僅突出重點。

    由於測試機器不夠,我就在Target上的DB裡建立兩個User,分別代表兩個Target環境。

    這裡需要注意的是,兩個Target可以使用同一個GG binary,也可以使用同一個MGR(同一個port),只是需要配置不同的REPLICAT而已。

1.Source 新增EXTRACT

GGSCI (xxx) 120> ADD EXTRACT HAOEXMUL, TRANLOG, BEGIN now
EXTRACT added.


GGSCI (xxx) 121> edit params HAOEXMUL


EXTRACT HAOEXMUL
SETENV (ORACLE_SID=MOT)
USERID
, PASSWORD GGS
EXTTRAIL ./dirdat/za
TABLE HAOZHU_USER.GGMULTI;
~
"dirprm/haoexmul.prm" 5 lines, 118 characters written


GGSCI (xxx) 124> ADD EXTTRAIL ./dirdat/za, EXTRACT HAOEXMUL
EXTTRAIL added.

GGSCI (xxx) 125> start extract HAOEXMUL

Sending START request to MANAGER ...
EXTRACT HAOEXMUL starting


GGSCI (xxx) 126> info HAOEXMUL

EXTRACT    HAOEXMUL  Last Started 2010-04-22 12:23   Status RUNNING
Checkpoint Lag       00:13:57 (updated 00:00:03 ago)
Log Read Checkpoint  Oracle Redo Logs
                     2010-04-22 12:09:54  Seqno 64, RBA 8503312

2.Source新增兩個data pump EXTRACT


GGSCI (xxx) 110> ADD EXTRACT HAODP1, EXTTRAILSOURCE ./dirdat/za, BEGIN now
EXTRACT added.


GGSCI (xxx) 111> ADD EXTRACT HAODP2, EXTTRAILSOURCE ./dirdat/za, BEGIN now
EXTRACT added.


GGSCI (xxx) 112> ADD RMTTRAIL ./dirdat/za, EXTRACT HAODP1
RMTTRAIL added.


GGSCI (xxx) 113> ADD RMTTRAIL ./dirdat/zb, EXTRACT HAODP2
RMTTRAIL added.

GGSCI (xxx) 114> edit params HAODP1


EXTRACT HAODP1
SETENV (ORACLE_SID=MOT)
USERID
, PASSWORD GGS
RMTHOST xxx.xxx.xxx.xxx, MGRPORT 7809
RMTTRAIL ./dirdat/za
TABLE HAOZHU_USER.GGMULTI;
~

~
"dirprm/haodp1.prm" [New File] 6 lines, 158 characters written


GGSCI (xxx) 115> edit params HAODP2


EXTRACT HAODP2
SETENV (ORACLE_SID=MOT)
USERID
, PASSWORD GGS
RMTHOST xxx.xxx.xxx.xxx, MGRPORT 7809
RMTTRAIL ./dirdat/zb
TABLE HAOZHU_USER.GGMULTI;
~
"dirprm/haodp2.prm" [New File] 6 lines, 159 characters written

GGSCI (xxx) 128> start HAODP1

Sending START request to MANAGER ...
EXTRACT HAODP1 starting


GGSCI (xxx) 129> start HAODP2

Sending START request to MANAGER ...
EXTRACT HAODP2 starting


GGSCI (xxx) 130> info HAODP1

EXTRACT    HAODP1    Last Started 2010-04-22 12:29   Status RUNNING
Checkpoint Lag       00:00:00 (updated 00:00:03 ago)
Log Read Checkpoint  File ./dirdat/za000000
                     2010-04-22 12:04:39.000000  RBA 0


GGSCI (xxx) 131> info HAODP2

EXTRACT    HAODP2    Last Started 2010-04-22 12:29   Status RUNNING
Checkpoint Lag       00:00:00 (updated 00:00:02 ago)
Log Read Checkpoint  File ./dirdat/za000000
                     2010-04-22 12:04:44.000000  RBA 0

3.Target 新增兩個Replicat

GGSCI (xxx) 32> ADD REPLICAT HAOREPA, EXTTRAIL ./dirdat/za, BEGIN now , nodbcheckpoint
REPLICAT added.


GGSCI (xxx) 33> ADD REPLICAT HAOREPB, EXTTRAIL ./dirdat/zb, BEGIN now , nodbcheckpoint
REPLICAT added.

GGSCI (xxx) 34> edit params HAOREPA


REPLICAT HAOREPA
ASSUMETARGETDEFS
SETENV (ORACLE_SID=DC1)
USERID GGS, PASSWORD GGS
map HAOZHU_USER.GGMULTI , target HAOZHU_USER.GGMULTI;
~

"dirprm/haorepa.prm" [New File] 5 lines, 137 characters written

GGSCI (xxx) 35> edit params HAOREPB


REPLICAT HAOREPB
ASSUMETARGETDEFS
SETENV (ORACLE_SID=DC1)
USERID GGS, PASSWORD GGS
map HAOZHU_USER.GGMULTI , target HAOZHU2_USER.GGMULTI;
~

"dirprm/haorepb.prm" [New File] 5 lines, 138 characters written

GGSCI (xxx) 36> start HAOREPA 

Sending START request to MANAGER ...
REPLICAT HAOREPA starting


GGSCI (xxx) 37> start HAOREPB

Sending START request to MANAGER ...
REPLICAT HAOREPB starting


GGSCI (xxx) 38> info HAOREPA

REPLICAT   HAOREPA   Last Started 2010-04-22 12:35   Status RUNNING
Checkpoint Lag       00:00:00 (updated 00:00:09 ago)
Log Read Checkpoint  File ./dirdat/za000000
                     2010-04-22 12:32:46.000000  RBA 0


GGSCI (xxx) 39> info HAOREPB

REPLICAT   HAOREPB   Last Started 2010-04-22 12:35   Status RUNNING
Checkpoint Lag       00:00:00 (updated 00:00:06 ago)
Log Read Checkpoint  File ./dirdat/zb000000
                     2010-04-22 12:32:50.000000  RBA 0

4.測試

在Source:

SQL> insert into ggmulti select * from dba_objects;

10045 rows created.

SQL> commit;

Commit complete.

在Target:


SQL> show user
USER is "HAOZHU2_USER"
SQL> select count(*) from ggmulti;

  COUNT(*)
----------
     10045

SQL> show user
USER is "HAOZHU_USER"
SQL> select count(*) from ggmulti;

  COUNT(*)
----------
     10045

 

(這裡感謝Thomas Zhang的幫助讓我找到一個配置中的失誤:))

來自 “ ITPUB部落格 ” ,連結:http://blog.itpub.net/15415488/viewspace-660466/,如需轉載,請註明出處,否則將追究法律責任。

相關文章