How to get started with Oracle GoldenGate 12c

This article explains how to get started with Oracle GoldenGate for those who deal with Oracle DBA, real-time data replication,data migration, and so on.

What is Oracle GoldenGate for?

Oracle GoldenGate is a product which enables a real-time data replication between databases on different machines.

Basic features:

  • high-speed
  • lightweight
  • flexible options
  • runs on the database server
  • replication between different database products
  • replication between different OS
  • bidirectional replication

Overall image of how Oracle GoldenGate works

  • GoldenGate writes update logs to a generic format called Trail File, and tranfsers to the target database.
  • Manager process manages overall GoldenGate functions.
  • Capture process extracts updated data from the source database, and writes it to Trail file.
  • Data Pump tranfers the Trail file to the Collector process of the target database.
  • Collector process receives the Trail file, and saves it to the local machine.
  • Repilcat process reads the Trail file, and updates the target database.

From here, let’s dive into the Oracle GoldanGate and see how the data transfer works with Oracle GolenDate 12c Integrated Capture Mode.

Oracle GoldenGate Introduction

Database Environment

Source Database(server#A)Oracle Datebase 12c
Oracle GoldenGate 12c
Schema: test
Table: sample1
Target Database(server#B)Oracle Datebase 12c
Oracle GoldenGate 12c
Schema: test
Table: sample1

1.Configure Oracle Database

  1. Configure Logging Property (Server#A)
    Supplimental Logging is a function which writes additional information needed for GoldenGate’s replication to REDO Log.
$sqlplus / as sysdba
SQL>alter database add supplemental log data;
SQL>alter database force logging;

2.Enacle Oracle GoldenGate

SQL>alter system set enable_goldengate_replication=true;

3.Configure Oracle Data Server Reource (Server#A, Server#B)

 As you will use Integrated Capture Mode for GoldenGate, configure  ”stream_pool_size” of the Oracle Database.

 Recommended Value: (max_sgz_size X parallism) + 0.25

SQL>alter system set stream_pool_size=1250M scope=both;

4.Create user for Oracle GoldenGate (Server#A, Server#B)

SQL>create user ogg identified by oracle;
SQL>grant connect to ogg;
SQL>grant resource to ogg;
SQL>grant dba to ogg;
SQL>exec dbms_goldengate_auth.grant_admin_privilege('ogg');

2.Install Oracle GoldenGate

1.Before You Install (Server#A, Server#B)
  Create home directory for GoldenGate,
  and also sub-directory for Trail file, then unzip the binary file.

$mkdir -p /u01/app/goldengate
$mkdir -p /u01/app/goldengate/trail
$unzip <GG Installer Package>.zip

2.Create Response File (Server#A, Server#B)

ParameterValueDescription
INTALL_OPTION ORA12c Database Version
SOFTWARE_LOCATION /u01/app/goldengate Where to install
START_MANAGER TRUE Start Manager after install
MANAGER_PORT 31000 Port number for Manager
DATABASE_LOCATION $ORACLE_HOME Home directory of Oracle DB
INVENTORY_LOCATION PATh of oraInventoryFull directory path of inventory
UNIX_GROUP_NAME oinstall Group name

3.Install Oracle GoldenGate (Server#A, Server#B)

$<GG Installer Full Path>/runInstaller -silent -nowait -responseFile <Response File Full Path>/gg.rsp

4. Create Directory (Server#A, Server#B)

$ cd /u01/app/goldengate
$./ggsci
GGSCI> CREATE SUBDIRS

5.Configure global parameter (Server#A, Server#B)
  Parameter File: /u01/app/goldengate/GLOBALS

syslog none
allowoutputdir /u01/app/goldengate/trail

6.Configure MANAGER, and start (Server#A, Server#B)
  Parameter File: /u01/app/goldengate/dirprm/mgr.prm

port 31000
dynamicportlist 31100-31109

Start MANAGER

$cd /u01/app/goldengate/
$./ggsci
GGSCI> start mgr
GGSCI> INFO ALL
Program   Status  Group  Lag at Chkpt  Time Since Chkpt
MANAGER  STARTED

7.Enable Schema-level Supplimental Logging
  Sample Schema: test

$cd /u01/app/goldengate/
$./ggsci
GGSCI>dblogin userid ogg,password oracle
GGSCI>add schematrandata test

8.Configure Capture (Server#A)
  Parameter File: /u01/app/goldengate/dirprm/cap.prm

extract cap
userid ogg, password oracle
ddl include mapped
exttrail /u01/app/goldengate/trail
table test.*

Register Capture Group on database

$cd /u01/app/goldengate/
$./ggsci
GGSCI>dblogin userid ogg,password oracle
GGSCI>register extract cap database
GGSCI>add extract cap integrated tranlog,begin now
GGSCI>add exttrail /oracle/trail/source/sr,extract cap

9. Set up Datapump (Server#A)
  Parameter File: /u01/app/goldengate/dirprm/puma.prm
  Source Table: test.sample1

extract pump
passthru
rmthost Server\#B_IP, mgrport 31000
rmttrail /u01/app/goldengate/trail
table test.sample1;

Setup Data Pump

GGSCI>add extract pump,exttrailsource /u01/app/goldengate/trail
GGSCI>add rmttrail /u01/app/goldengate/trail,extract pump

10.Configure Replicat (Server#B)
   Parameter File :/u01/app/goldengate/dirprm/rep.prm
   Target Table: test.sample1;

replicat rep
userid ogg, password oracle
MAP test.sample1, TARGET test.sample1;

Add group (Integrated mode)

GGSCI>dblogin userid ogg,password oracle
GGSCI>add replicat rep, integrated ,exttrail /u01/app/goldengate/tail

11.Start GoldenGate Service

GGSCI>start *
GGSCI>info all

That’s all for setting up GoldenGate!!
Once you update the Source(Server#A) data on [test.sample1], check the Target(Server#B) which is updated as well.

That was a simple and easy one, but hope it was helpful to you!