Please see my other blog for Oracle EBusiness Suite Posts - EBMentors

Search This Blog

Note: All the posts are based on practical approach avoiding lengthy theory. All have been tested on some development servers. Please don’t test any post on production servers until you are sure.

Saturday, December 04, 2010

Oracle GoldenGate Tutorial Part 4 - Working with OGG

As we know have basic configurations and information about OGG, we can start with first complete replication example. We will use the initial data load for this example, later on we will see other examples for online synchronization and DDL.

Assumptions
  •  Source DB (eg;  HOMEDEV)
  •  Target DB (eg;   ASMDB, I've ASM Oracle database as target but you can have without ASM)
  •  USER SCOTT is existing on source and target

Step 1:   On Source, start the ggsci session
D:\Temp\GG\GG_SOURCE_HOMEDEV_ONSRV1>ggsci
Oracle GoldenGate Command Interpreter for Oracle
Version 11.1.1.0.0 Build 078
Windows x64 (optimized), Oracle 10 on Jul 28 2010 14:52:12
Copyright (C) 1995, 2010, Oracle and/or its affiliates. All rights reserved.
GGSCI (DB2) 1> start mgr
Note: For me the manager process is  running on 7808 for Source system.
Step 2: Create extract process "extload1" on the source system. This will be one time data extract task so the source of the data is not the transaction log files of the database but the data itself. Thus we will use keyword SOURCEISTABLE with the add extract command.
GGSCI (DB2) 4> ADD EXTRACT extload1,SOURCEISTABLE
EXTRACT added.
Step 3: Create the parameter file for the extract group extload1
GGSCI (DB2) 5> edit params extload1 (notepad will be opened set the parameters)
EXTRACT extload1  -- the name of extract created earlier
USERID ggs_owner@homedev,PASSWORD ggs_owner  -- OGG owner doing the work for extract
RMTHOST DB2,MGRPORT 7809  --remote host for the replicat process with manager --process with port 7809
RMTTASK replicat,GROUP repload1  -- remote task type and the group responsible to perform that task
TABLE SCOTT.EMP;  -- Table to be extracted,Assume that EMP table on target (ASMDB) is empty for --this example

Step 4: On Target , create the initial data load task "repload1" for replication. As this will be one time task, we will use the keyword SPECIALRUN
GGSCI (DB2) 4> ADD REPLICAT repload1, SPECIALRUN
REPLICAT added.

GGSCI (DB2) 6> start mgr
Manager started.

Step 5: Create the parameter file for the Replicat group, "repload1"
GGSCI (DB2) 5> edit params repload1 (notepad will be opened, set parameters)

REPLICAT repload1 -- process/group name for replicat
USERID ggs_owner@asmdb, PASSWORD ggs_owner -- OGG db user in target databse
ASSUMETARGETDEFS  -- used when the source and target tables specified with a MAP statement have --identical column structure,
MAP scott.emp, TARGET scott.emp;  -- to establish a relationship between one or more source and target --objects.

Step 6: Start the initial load data extract task on the source system. Since this is a one time task, we will initially see that the extract process is running and after the data load is complete it will be stopped.
We do not have to manually start the Replicat process on the target as that is done when the Extract task is started on the source system.
GGSCI (DB2) 6> start mgr
Manager started.

GGSCI (DB2) 13> start extract extload1

Check on the source SCOTT.EMP and you will see the rows there.

NOTE: As now you are familiar with golden gate, creating parameter files for the processes etc, I'll be posting my further posts without the title Oracle GoldenGate Tutorial.

Related Posts:
Oracle GoldenGate Tutorial Part 1 - Concepts and Architecture 
Oracle GoldenGate Tutorial Part 2 - Installation (Windows 2003) 
Oracle GoldenGate Tutorial Part 3 - Manager process 
Live Reporting with OGG 
Live Reporting with Data Pump -GG 
OGG Reference - Commands and Options 
SQL Server to SQL Server Replication using GG

No comments: