Saturday, April 16, 2016

GOLDEN GATE :PERFORMING INITIAL DATA LOAD

Oracle GoldenGate Tutorial 4 – performing initial data load


On Source
SQL> conn syed/india123
Connected.

SQL> CREATE TABLE Persons
(
PersonID int,
LastName varchar(255),
FirstName varchar(255)
);
  2    3    4    5    6
Table created.

SQL> insert into Persons values ( 1,'amin','syed');

1 row created.

SQL> insert into Persons values (2,'amina','syed');

1 row created.

SQL>  insert into Persons values (3,'shifa','syed');

1 row created.

SQL> select * from persons;

  PERSONID LASTNAME FIRSTNAME
         1  amin   syed

         2  amina syed

         3 shifa  syed


On Target
SQL> conn syed/india123
Connected.


SQL> CREATE TABLE Persons
(
PersonID int,
LastName varchar(255),
FirstName varchar(255)
);

SQL> select * from persons;





On Source

1) Create the Initial data extract process ‘load1’

GGSCI (PrimeDG) 1> ADD EXTRACT load1, SOURCEISTABLE
EXTRACT added.


Since this is a one time data extract task, the source of the data is not the transaction log files of the RDBMS (in this case the online and archive redo log files) but the table data itself, that is why the keyword SOURCEISTABLE is used.

2) Create the parameter file for the extract group load1

EXTRACT: name of the extract group
USERID/PASSWORD: the database user which has been configured earlier for Extract ( this user is created in the source database)
RMTHOST: This will be the IP address or hostname of the target system
MGRPORT: the port where the Manager process is running
TABLE: specify the table which is being extracted and replicated. This can be specified in a number of ways using wildcard characters to include or exclude tables as well as entire schemas.

GGSCI (PrimeDG) 6> EDIT PARAMS load1

EXTRACT load1
USERID ggadmin, PASSWORD india123
RMTHOST 192.168.1.253, MGRPORT 7809
RMTTASK replicat, GROUP load2
TABLE syed.persons;

On Target

3) Create the initial data load task ‘load2’

Since this is a one time data load task, we are using the keyword SPECIALRUN

GGSCI (CyclopDB) 3>  ADD REPLICAT load2, SPECIALRUN
REPLICAT added.

4) Create the parameter file for the Replicat group, load2

REPLICAT: name of the Replicat group created for the initial data load
USERID/PASSWORD: database credentials for the Replicat user (this user is created in the target database)
ASSUMETARGETDEFS: this means that the source table structure exactly matches the target database table structure
MAP: with GoldenGate we can have the target database structure entirely differ from that of the source in terms of table names as well as the column definitions of the tables. This parameter provides us the mapping of the source and target tables which is same in this case

GGSCI (PrimeDG) 2> EDIT PARAMS load2
REPLICAT load2
USERID ggadmin, PASSWORD india123
ASSUMETARGETDEFS
MAP syed.persons, TARGET syed.persons;

~


~

On Source

SQL> select count(*) from syed.persons;

  COUNT(*)
----------
         3


On Target

SQL> select count(*) from syed.persons;

  COUNT(*)
----------
      0


On Source

5) Start the initial load data extract task on the source system

We now start the initial data load task load 1 on the source. Since this is a one time task, we will initially see that the extract process is runningand 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.

On Source

GGSCI (PrimeDG) 2> START EXTRACT load1

Sending START request to MANAGER ...
EXTRACT LOAD1 starting


GGSCI (PrimeDG) 3>  info extract load1

EXTRACT    LOAD1     Last Started 2016-04-16 17:46   Status RUNNING
Checkpoint Lag       Not Available
Log Read Checkpoint  Table SYED.PERSONS
                     2016-04-16 17:46:15  Record 1
Task                 SOURCEISTABLE


GGSCI (PrimeDG) 4> info extract load1

EXTRACT    LOAD1     Last Started 2016-04-16 17:46   Status STOPPED
Checkpoint Lag       Not Available
Log Read Checkpoint  Table SYED.PERSONS
                     2016-04-16 17:46:15  Record 3
Task                 SOURCEISTABLE



On Target
SQL> select count(*) from syed.persons;

  COUNT(*)
----------
         3

No comments:

Post a Comment