Oracle GoldenGate Uni-Directional replication setup
Configure Step by step Oracle GoldenGate Unidirectional Method.
Scenario 1: Uni-Directional replication setup
Sno | Config item | Site1 | Site2 |
1 | GoldenGate software location | /u01/app/oracle/
product/ogg1 |
/u01/app/oracle/
product/ogg2 |
3 | GoldenGate database user ID/password | ggs_owner | ggt_owner |
4 | Manager port | 7809 | 7810 |
5 | Database name | US | UK |
6 | Schema | POS_US | POS_UK |
7 | extract name | EXT_1 | |
8 | Extract trail filename | ~/dirdat/L1 | |
9 | Datapump name | pump_1 | |
10 | Remote trail filename | ~/dirdat/R1 | |
11 | Replicat name | REP_1 |
1.1. Preparing Database
SQL>ALTER DATABASE ADD SUPPLEMENTAL LOG DATA (ALL) COLUMNS;
Create the following objects on all databases (Site 1 and Site 2)
create user POS_US identified by POS_US default tablespace users temporary tablespace temp;
grant connect,resource to POS_US;
grant unlimited tablespace to POS_US;
create table POS_US.inventory
(prod_id number,
prod_category varchar2(20),
qty_in_stock number,
last_dml timestamp default systimestamp);
alter table POS_US.inventory add constraint pk_inventory primary key(prod_id);
——————————————————-
create user POS_UK identified by POS_UK default tablespace users temporary tablespace temp;
grant connect,resource to POS_UK;
grant unlimited tablespace to POS_UK;
create table POS_UK.inventory
(prod_id number,
prod_category varchar2(20),
qty_in_stock number,
last_dml timestamp default systimestamp);
alter table POS_UK.inventory add constraint pk_inventory primary key(prod_id);
—————————————————————————————-
1.2. GoldenGate Installation on Source and Target
Install GoldenGate in below locations as mentioned in the section 2 in this doc.
/u01/app/oracle/product/ogg1
/u01/app/oracle/product/ogg2
1.3. Create GLOBAL file on Source
Add GGSSCHEMA and CHECKPOINTTABLE in GLOBALS file in both golden gate homes.
##############################################33
On site A
[oracle@ol6-GG-sys1 ogg1]$ cat GLOBALS
GGSCHEMA GGS_OWNER
CHECKPOINTTABLE GGS_OWNER.CHKPTTAB
On Site B
[oracle@ol6-GG-sys1 ogg2]$ cat GLOBALS
GGSCHEMA GGT_OWNER
CHECKPOINTTABLE GGT_OWNER.CHKPTTAB
1.4. Connecting to GoldenGate and create checkpointtable on both sites
cd /u01/app/oracle/product/ogg1
./ggsci
1.5. Add TRANDATA on both sites
add trandata POS_US.inventory cols (prod_category,qty_in_stock, last_dml)
add trandata POS_UK.inventory cols (prod_category,qty_in_stock, last_dml)
1.6. Configure GoldenGate Processes on Source
1 Source System
##################################
To configure the Manager process on the source
- On the source, configure the Manager process .
GGSCI>edit param mgr
PORT 7809
USERID ggs_owner,PASSWORD ggs_owner
PURGEOLDEXTRACTS /u01/app/oracle/product/ogg1/dirdata/L1,USECHECKPOINTS
To configure the primary Extract group on the source
##########################################################
- On the source, use the ADD EXTRACT command to create an Extract group ext_1.
GGSCI>add extract ext_1 tranlog begin now
2. On the source, use the ADD EXTTRAIL command to create a local trail.
ADD EXTTRAIL local_trail_1, EXTRACT ext_1
Use the EXTRACT argument to link this trail to the ext_1 Extract group.
GGSCI>add exttrail /u01/app/oracle/product/ogg1/dirdat/L1 extract ext_1
EXTTRAIL added.
- On the source, use the EDIT PARAMS command to create a parameter file for the ext_1 Extract group.
GGSCI> edit params ext_1
EXTRACT ext_1
USERID ggs_owner@US, PASSWORD ggs_owner
EXTTRAIL /u01/app/oracle/product/ogg1/dirdat/L1
TRANLOGOPTIONS EXCLUDEUSER ggs_owner
TABLE POS_WEST.inventory;
To configure the data pump on the source
#################################################
- On the source, use the ADD EXTRACT command to create a data pump group.
ADD EXTRACT pump_1, EXTTRAILSOURCE local_trail_1, BEGIN time
Use EXTTRAILSOURCE as the data source option, and specify the name of the local trail.
GGSCI>add extract pump_1 exttrailsource /u01/app/oracle/product/ogg1/dirdat/L1
2. On the source, use the ADD RMTTRAIL command to specify a remote trail that will be created on the target system.
GGSCI>add rmttrail /u01/app/oracle/product/ogg2/dirdat/R1 extract pump_1
3. On the source, use the EDIT PARAMS command to create a parameter file for the pump_1 data pump.
edit params pump_1
EXTRACT pump_1
USERID gg1_owner, PASSWORD gg1_owner
RMTHOST localhost, MGRPORT 7810, TCPBUFSIZE 100000
RMTTRAIL /u01/app/oracle/product/ogg2/dirdat/R1
PASSTHRU
TABLE POS_WEST.inventory;
Note:
To use PASSTHRU mode, the names of the source and target objects must be identical. No column mapping, filtering, SQLEXECfunctions, transformation, or other functions that require data manipulation can be specified in the parameter file. You can combine normal processing with pass-through processing by pairing PASSTHRU and NOPASSTHRU with different TABLE statements.
1.7. Configure GoldenGate Processes on Target
################################################
Configure the Manager Process, Replicat group, on the target system .
To configure the Manager process on the second system
- On the second system, configure the Manager process
edit params mgr
PORT 7810
USERID ggt_owner@UK,PASSWORD ggt_owner
PURGEOLDEXTRACTS /u01/app/oracle/product/ogg2/dirdata/L1, USECHECKPOINTS
In the Manager Parameter file, use the PURGEOLDEXTRACTS parameter to control the purging of files from the trail.
GGSCI>add trandata POS_UK.inventory cols (prod_category,qty_in_stock, last_dml)
To configure the Replicat group on the second system
###############################################################
On the second system, use the ADD REPLICAT command to create a Replicat group rep_1.
Use the EXTTRAIL option to link the rep_1 group to the remote trail remote_trail_1 that is on the local system.
GGSCI>add replicat rep_1 exttrail /u01/app/oracle/product/ogg2/dirdat/R1
REPLICAT added.
On the second system, use the EDIT PARAMS command to create a parameter file for the Replicat group. Include the following parameters plus any others that apply to your database environment.
edit params rep_1
REPLICAT rep_1
ASSUMETARGETDEFS
USERID ggt_owner@UK, PASSWORD ggt_owner
DISCARDFILE /u01/app/oracle/product/ogg2/discard_1.txt, append,
MAP POS_US.inventory, TARGET POS_UK.inventory;
1.8. Start GoldenGate processes on both Sites
Manager @Source
Manager@Target
Extract @source
Pump @source
Replicat @ Target
Info all on Source
Indo all on Target
1.9. Verify Unidirectional replication setup
1.9.1. DML
Insert
On source
insert into POS_US.inventory values (10101,’DVD’,10,sysdate);
insert into POS_US.inventory values (2,’DVD’,10,sysdate);
insert into POS_US.inventory values (3,’DVD’,10,sysdate);
On Target:
Update :
On Source:
Update pos_us.inventory set qty_in_stock=20 where prod_id=10101;
On Target:
Delete:
On Source:
On target :
1.9.2. DDL
DDL setup is done as per the section 3.1 for ggs_source user only.
Ext_1 and pump_1 parameter files on Source
On target rep_1 paramater file
On Source:
On Target
On Source:
Drop the ‘xyz’ column.
On Target:
Column drooped from target table.
Truncate:
Source:
On Target
See Also: