Initial Load for GoldenGate Replication Setup

Extract and Replicat processes take care the data from the point of setup of the processes. To setup a replication using Goldengate, We need to make sure that existing data are properly copied from Source to Target and this is called Initial Load.

There are different types of Initial Load available in Oracle GoldenGate as well as a few possible methods outside the GoldenGate for performing data synchronization between Source and Target databases.

Initial Loading Methods:

  • Using RMAN
  • Oracle Export and Import (Data PUMP)
  • Oracle Transportable Tablespace
  • ETL Tools
  • SQL Loader – Useful for heterogeneous environments.

GoldenGate Initial Loading Methods:

  • File to Replicat
  • File to Database Utility
  • Direct Load
  • Direct Bulk Load.

Oracle GoldenGate Direct Load: I will show in below example, how to load data using this method.

Create Initial Extract Load:

GGSCI (orclprd.localdomain as ggusr@orclprd) 24> VIEW PARAM EINIT1

extract EINIT1

SETENV (ORACLE_SID=ORCLPRD)
USERIDALIAS GGUSR_ORCLPRD

RMTHOST 192.168.56.20, MGRPORT 7809
RMTTASK REPLICAT, GROUP RINIT1
TABLE HR.*;
GGSCI (orclprd.localdomain as ggusr@orclprd) 16> ADD EXTRACT EINIT1 SOURCEISTABLE
EXTRACT added.

Create Initial Load Replicate on Target:

GGSCI (orcl19c.localdomain) 7> view param RINIT1

REPLICAT RINIT1

SETENV (ORACLE_SID=ORCLPRD)
USERIDALIAS GGUSR_ORCL

MAP HR.*, TARGET HR1.*;


GGSCI (orcl19c.localdomain) 8> ADD REPLICAT RINIT1 SPECIALRUN
REPLICAT added.

Create All Objects (Tables/View) on Target Database. We may generate the table creation scripts from source database and execute on Target.

Start Extract Initial Load Process:

Note::: Don’t need to start the Replicat Process.

GGSCI (orclprd.localdomain) 2> start EINIT1

Sending START request to MANAGER ...
EXTRACT EINIT1 starting

GGSCI (orclprd.localdomain as ggusr@orclprd) 41> info EINIT1

EXTRACT    EINIT1    Last Started 2023-11-27 23:20   Status RUNNING
Checkpoint Lag       Not Available
Process ID           29612
Log Read Checkpoint  Table HR.COUNTRIES
                     2023-11-27 23:20:20  Record 1
Task                 SOURCEISTABLE


GGSCI (orclprd.localdomain as ggusr@orclprd) 42> info EINIT1

EXTRACT    EINIT1    Last Started 2023-11-27 23:20   Status RUNNING
Checkpoint Lag       Not Available
Process ID           29612
Log Read Checkpoint  Table HR.EMPLOYEES
                     2023-11-27 23:20:30  Record 1
Task                 SOURCEISTABLE

GGSCI (orclprd.localdomain) 4> !
info EINIT1

EXTRACT    EINIT1    Last Started 2023-11-27 23:23   Status STOPPED
Checkpoint Lag       Not Available
Log Read Checkpoint  Table HR.REGIONS
                     2023-11-27 23:23:32  Record 4
Task                 SOURCEISTABLE

Validation on Target Side:

SQL> select name from v$database;

NAME
---------
ORCL

SQL> select count(*) from hr1.REGIONS;

  COUNT(*)
----------
         4

SQL> select count(*) from hr.EMPLOYEES;

  COUNT(*)
----------
       107

We can run extract and pump process using the time when Initial Load has been stopped. In this case get from below: Timestamp: 2023-11-27 23:23:32

GGSCI (orclprd.localdomain) 6> info EINIT1

EXTRACT    EINIT1    Last Started 2023-11-27 23:23   Status STOPPED
Checkpoint Lag       Not Available
Log Read Checkpoint  Table HR.REGIONS
                     2023-11-27 23:23:32  Record 4
Task                 SOURCEISTABLE