GoldenGate configuration (2) bidirectional replication configuration environment: Environment
GoldenGate configuration (2) bidirectional replication configuration environment: Item Source System Target System Platform Red Hat Enterprise Linux Server release 5.4 Red Hat Enterprise Linux Server release 5.4 Hostname gc1 gc2 Database Oracle 10.2.0.1 Oracle 11.2.0.1 Character
GoldenGate configuration (2) bidirectional replication Configuration
Environment:
Item |
Source System |
Target System |
Platform |
Red Hat Enterprise Linux Server release 5.4 |
Red Hat Enterprise Linux Server release 5.4 |
Hostname |
Gc1 |
Gc2 |
Database |
Oracle 10.2.0.1 |
Oracle 11.2.0.1 |
Character Set |
ZHS16GBK |
ZHS16GBK |
ORACLE_SID |
PROD |
EMREP |
Listener Name/Port |
LISTENER/1521 |
LISTENER/1521 |
Goldengate User |
Ogg |
Ogg |
Two-way replication configuration Description: This article continues with "one-way replication configuration of GoldenGate configuration (1)". About the previous article, one-way replication configuration of GoldenGate configuration (1: click the link to open two-way copy configuration operation: gc2: Authorization
SQL>Grant CONNECT, RESOURCE to ogg;
SQL>Grant create session, alter session to ogg;
SQL>Grant select any dictionary, select any table to ogg;
SQL>Grant alter any table to ogg;
SQL>Grant flashback any table to ogg;
SQL>Grant EXECUTE on DBMS_FLASHBACK to ogg;
Gc1: Authorization
SQL>Grant CONNECT, RESOURCE to ogg;
SQL>Grant create session, alter session to ogg;
SQL>Grant select any dictionary, select any table to ogg;
SQL>Grant create table to ogg;
SQL>Grant INSERT, UPDATE, DELETE on scott. tcustmer to ogg;-- Authorize the DML operation for table synchronization to ogg
SQL>Grant INSERT, UPDATE, DELETE on scott. tcustord to ogg;-- Authorize the DML operation for table synchronization to ogg
Gc2: Enable Supplemental log
SQL>Alter database add supplemental log data;
SQL>Alter system switch logfile;
SQL>Alter database force logging;
Gc2: Add test table to Supplemental log
GGSCI (gc2) 1>Dblogin userid ogg, PASSWORD Ogg
Successfully logged into database.
GGSCI (gc2) 2>Add trandata scott. TCUSTMER
Logging of supplemental redo data enabled fortable SCOTT. TCUSTMER.
GGSCI (gc2) 3>Add trandata scott. TCUSTORD
Logging of supplemental redo data enabled fortable SCOTT. TCUSTORD.
Gc2: configure the Extract process
GGSCI (gc2) 4>Edit params EORA_1
-- Change Capture parameter file to capture
-- TCUSTMER and TCUSTORD changes
EXTRACT EORA_1
SETENV (NLS_LANG = AMERICAN_AMERICA.ZHS16GBK)
USERID ogg, PASSWORD Ogg
Tranlogoptions excludeuser ogg
EXTTRAIL./dirdat/aa
TABLE scott. TCUSTMER;
TABLE scott. TCUSTORD;
~
~
& Quot; dirprm/eora_1.prm & quot; [New] 9L, 257 Cwritten
GGSCI (gc2) 5>Add extract EORA_1, TRANLOG, BEGIN NOW
EXTRACT added.
GGSCI (gc2) 6>Add exttrail./dirdat/aa, EXTRACT EORA_1, MEGABYTES 5
EXTTRAIL added.
GGSCI (gc2) 7>Start extract EORA_1
Sending START request to MANAGER...
EXTRACT EORA_1 starting
GGSCI (gc2) 8>Info extract EORA_1
EXTRACT EORA_1 Last Started 2014-06-1811: 28 Status RUNNING
Checkpoint Lag 00:00:19 (updated 00:00:08 ago)
Log Read Checkpoint Oracle Redo Logs
11:27:42 Seqno 6, RBA 35344
Gc2: configure the Pump Process
GGSCI (gc2) 9>Edit params PORA_1
Add the following content:
-- Data Pump parameter file to read thelocal
-- Trail of TCUSTMER and TCUSTORDchanges
--
EXTRACT PORA_1
SETENV (NLS_LANG = AMERICAN_AMERICA.ZHS16GBK)
PASSTHRU
RMTHOST gc1, MGRPORT 7809
RMTTRAIL./dirdat/pa
TABLE scott. TCUSTMER;
TABLE scott. TCUSTORD;
~
~
~
"Dirprm/pora_1.prm" [New] 10L, 250 Cwritten
GGSCI (gc2) 10>Add extract PORA_1, EXTTRAILSOURCE./dirdat/aa
EXTRACT added.
GGSCI (gc2) 11>Add rmttrail./dirdat/pa, EXTRACT PORA_1, MEGABYTES 5
RMTTRAIL added.
GGSCI (gc2) 12>Start extract PORA_1
Sending START request to MANAGER...
EXTRACT PORA_1 starting
Gc1: configure the Replicat Process
GGSCI (gc1) 1>Edit params./GLOBALS
CHECKPOINTTABLE ogg. ggschkpt
~
~
"./GLOBALS" [New] 1L, 29C written
GGSCI (gc1) 2>Quit
[Oracle @ gc1ogg] $Ll GLOBALS -- Verification
-Rw-1 oracle oinstall 29 Jun 18 11: 33 GLOBALS
GGSCI (gc1) 1>Dblogin userid ogg, PASSWORD Ogg
Successfully logged into database.
GGSCI (gc1) 2>ADD CHECKPOINTTABLE
No checkpoint table specified, using GLOBALSspecification (ogg. ggschkpt )...
Successfully created checkpoint tableOGG. GGSCHKPT.
Gc1: configure the Replicate Process
GGSCI (gc1) 3>Edit param RORA_1
--
-- Change Delivery parameter file to apply
-- TCUSTMER and TCUSTORD Changes
--
REPLICAT RORA_1
SETENV (NLS_LANG = AMERICAN_AMERICA.ZHS16GBK)
USERID ogg, PASSWORD Ogg
HANDLECOLLISIONS
ASSUMETARGETDEFS
DISCARDFILE./dirrpt/RORA_aa.DSC, PURGE
MAP scott. tcustmer, TARGET scott. tcustmer;
MAP scott. tcustord, TARGET scott. tcustord;
~
~
"Dirprm/rora_1.prm" [New] 12L, 327 Cwritten
GGSCI (gc1) 4>Add replicat RORA_1, EXTTRAIL./dirdat/pa
REPLICAT added.
GGSCI (gc1) 5>Start replicat RORA_1
Sending START request to MANAGER...
REPLICAT RORA_1 starting
Gc1: view the process status
GGSCI (gc1) 6>Info all
Program Status Group Lag Time Since Chkpt
MANAGER RUNNING
Extract running EORA_1 00:00:00 00:00:08
Extract running PORA_1 00:00:00 00:00:01
Replicat running RORA_1 00:00:00 00:00:06
Gc2: view the process status
GGSCI (gc2) 13>Info all
Program Status Group Lag Time Since Chkpt
MANAGER RUNNING
Extract running EORA_1 00:00:00 00:00:09
Extract running PORA_1 00:00:00 00:00:06
Replicat running RORA_1 00:00:00 00:00:01
Verify two-way synchronization of insert operations
Gc1: gc1 → gc2, DML operation: insert operation
SQL>Insert into tcustmer VALUES ('hyl', 'huang DBA. ', 'harbin', 'cn ');
1 row created.
SQL>Commit;
Commit complete.
Gc2: Verify synchronization of insert operations
SQL>Select * from tcustmer;
CUST NAME CITY ST
--------------------------------------------------------
Hyl huangdba. HARBIN CN
Will bg software co. SEATTLE WA
Jane rocky flyer inc. DENVER CO
Gc2: gc2 → gc1, DML operation: insert operation
SQL>Insert into tcustmer VALUES ('wt ', 'wangdba.', 'qingdao ', 'cn ');
1 row created.
SQL>Commit;
Commit complete.
Gc1: gc1 → gc2, DML operation: update operation
SQL>Select * from tcustmer;
CUST NAME CITY ST
--------------------------------------------------------
Hyl huangdba. HARBIN CN
Will bg software co. SEATTLE WA
Jane rocky flyer inc. DENVER CO
Wt wangdba. QINGDAO CN
Gc1: update operation
SQL>Update tcustmer set city = 'beijing', state = 'cn' wherecust_code = 'hybrid ';
1 row updated.
SQL>Commit;
Commit complete.
Gc2: Verify synchronization of update operations
SQL>Select * from tcustmer;
CUST NAME CITY ST
--------------------------------------------------------
Hyl huangdba. BEIJING CN
Will bg software co. SEATTLE WA
Jane rocky flyer inc. DENVER CO
Wt wangdba. QINGDAO CN
Gc2: gc2 → gc1, DML operation: update operation
SQL>Update tcustmer set city = 'beijing', state = 'cn' wherecust_code = 'wt ';
1 row updated.
SQL>Commit;
Commit complete.
Gc1: Verify synchronization of update operations
SQL>Select * from tcustmer;
CUST NAME CITY ST
--------------------------------------------------------
Hyl huangdba. BEIJING CN
Will bg software co. SEATTLE WA
Jane rocky flyer inc. DENVER CO
Wt wangdba. BEIJING CN
Gc1: gc1 → gc2, DML operation: delete operation
SQL>Delete from tcustmer where CUST_CODE = 'wt ';
1 row deleted.
SQL>Commit;
Commit complete.
Gc2: Verify synchronization of delete operations
SQL>Select * from tcustmer;
CUST NAME CITY ST
--------------------------------------------------------
Hyl huangdba. BEIJING CN
Will bg software co. SEATTLE WA
Jane rocky flyer inc. DENVER CO
Gc2: gc2 → gc1, DML operation: delete operation
SQL>Delete from tcustmer where CUST_CODE = 'hybrid ';
1 row deleted.
SQL>Commit;
Commit complete.
Gc1: Verify synchronization of delete operations
SQL>Select * from TCUSTMER;
CUST NAME CITY ST
--------------------------------------------------------
Will bg software co. SEATTLE WA
Jane rocky flyer inc. DENVER CO
-- So far, GoldenGate bidirectional synchronous replication is complete.
Statement:
Original works, from "Deep Blue blog" blog, allow reprint, reprint please be sure to indicate the source (http://blog.csdn.net/huangyanlong ).
The author has the right to pursue legal liability for copyright issues.