Friday, 27 July 2012

Golden Gate 11.1.1.1 for Oracle 11.2.0.3


What is Golden Gate?

Golden Gate is a replication software, which have a capability to replicate data between the heterogeneous databases & platforms.

Golden Gate Topologies -



















Golden Gate Architecture –













Golden Gate Processes (Functional Order) –

1)      Manager
2)      Extract
3)      Trails / Extract files
4)      Data Pump
5)      Collector
6)      Checkpoints
7)      Replicat

Assumptions Source -
Source Host – node1
Source DB – source
DB Version – 11.2.0.3
export ORACLE_HOME=/u01/app/oracle
export LIBPATH=$ORACLE_HOME/lib
export GG_HOME=/u01/app/gg111
Assumptions Target -
Target Host – node2
Target DB – target
DB Version – 11.2.0.3
ORACLE_HOME - /u01/app/oracle
export ORACLE_HOME=/u01/app/oracle
export LIBPATH=$ORACLE_HOME/lib
export GG_HOME=/u01/app/gg111

Golden Gate Installation (In Both Source & Target) –

  • Download the GG binaries from Oracle site
  • Unzip the file and it will generate a tar file and a read me file
unzip –v ggs_AIX_ppc_ora11g_64bit.zip
unzip ggs_AIX_ppc_ora11g_64bit.zip
  • Copy the tar file to the GG_HOME location
cp –ip ggs_AIX_ppc_ora11g_64bit.tar $GG_HOME
  • Untar the file 
      tar –tvf ggs_AIX_ppc_ora11g_64bit.tar
      tar –xvf ggs_AIX_ppc_ora11g_64bit.tar
  • Execute the below from ggsci prompt
ggsci> create subdirs

Preparing Database for Golden Gate replication (In Both source & Targets) –

export ORACLE_SID=source
export ORACLE_HOME=/u01/app/oracle
export LIBPATH=$ORACLE_HOME/lib
export GG_HOME=/u01/app/gg111
export NLS_LANG=AMERICAN_AMERICA.AL32UTF8
sqlplus ‘/as sysdba’
SQL> ALTER DATABASE ADD SUPPLEMENTAL LOG DATA;
SQL> ALTER SYSTEM SWITCH LOGFILE;
SQL> SELECT SUPPLEMENTAL_LOG_DATA_MIN FROM V$DATABASE;

Create a GG admin user in the database –

SQL> CREATE USER GGADMIN IDENTIFIED EXTERNALLY;
SQL> PASSWORD GGADMIN;
SQL> GRANT DBA TO GGADMIN;
SQL> exec dbms_goldengate_auth.grant_admin_privilege('GGADMIN');


Configuring Golden Gate (In both source & Target)

Configuring GLOBALS parameter –

$ cd $GG_HOME
ggsci> EDIT PARAMS ./GLOBALS
GGSCHEMA ggadmin

Configuring Manager Process –

ggsci> EDIT PARAMS mgr
PORT 7809
USERID ggadmin, PASSWORD test1234
PURGEOLDEXTRACTS /u01/app/gg111/dirdat/ex, USECHECKPOINTS

ggsci> INFO mgr
ggsci> START mgr
ggsci> VIEW REPORT manager



Scenarios to be Tested –

1)       Single table Initial data load
2)       Single table Uni-Directional replication
3)       Single table Bi-Directional replication
4)       Bi-Directional DDL Replication of a schema
5)       Exception Handling
6)       Sending reports


1) Single Table Initial data load –

Create a schema which would have a table structure and that table would replicate the data in both the source and target databases.

@Source & Target –
SQL> CREATE USER GGUSER IDENTIFIED EXTERNALLY;
SQL> PASSWORD GGUSER;
SQL> GRANT CREATE SESSION, CREATE TABLE TO GGUSER;
SQL> CREATE TABLE GGUSER.EMP(NO NUMBER, NAME VARCHAR2(20));
SQL> ALTER TABLE GGUSER.EMP ADD CONSTRAINT PK_NO PRIMARY KEY (NO);

@ Source
ggsci> ADD EXTRACT sload, SOURCEISTABLE
ggsci> EDIT PARAMS sload
EXTRACT sload
USERID ggadmin, PASSWORD test1234
RMTHOST node2, MGRPORT 7809
RMTTASK replicat, GROUP tload
TABLE gguser.emp;
ggsci> START EXTRACT sload

@ Target
ggsci> ADD REPLICAT tload, SPECIALRUN
ggsci> EDIT PARAMS tload
REPLICAT tload
USERID ggadmin, PASSWORD test1234
ASSUMETARGETDEFS
MAP gguser.emp, TARGET gguser.emp;

ggsci> INFO REPLICAT tload
ggsci> START REPLICAT tload

SQL> SELECT * FROM GGUSER.EMP;

The table would have replicated the data.

No comments:

Post a Comment