Dear Readers,
In this article we will see Performing an Initial load with Oracle GoldenGate 12c.
We care for your speed. Below is an easy way to Performing an Initial load with Oracle GoldenGate 12c.
What is GoldenGate Initial Load ?
Loads the data directly from source tables to target tables.
Change synchronization vs Initial load
In change synchronization we have extract,pump and Replicat with sourcefiles and rmttrail files.
But in Initial load data read over the network from source table to target table.
For this we configure extract and replicat with various initial methods
Note : Target table should be empty, while performing initial load
Node Details :
GG1 (SOURCE)
192.168.0.120 gg1.orcl.com gg1
Database Name :orcl
Instance Name : orcl
GG2(TARGET)
192.168.0.180 gg2.orcl.com gg2
Database Name :orcl
Instance Name : orcl
Let’s start the Scenario
SOURCE :
Check the table records which we want to perform initial load
Assume DEPT and EMP have Huge records
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 |
AJAY> select * from dept; DEPTNO DNAME LOC ---------- -------------- ------------- 10 ACCOUNTING NEW YORK 20 RESEARCH DALLAS 30 SALES CHICAGO 40 OPERATIONS BOSTON 50 MARKETING USA SQL> select * from EMP; EMPNO ENAME JOB MGR HIREDATE SAL COMM DEPTNO ---------- ---------- --------- ---------- --------- ---------- ---------- ---------- 7369 SMITH CLERK 7902 17-DEC-80 800 20 7499 ALLEN SALESMAN 7698 20-FEB-81 1600 300 30 7521 WARD SALESMAN 7698 22-FEB-81 1250 500 30 7566 JONES MANAGER 7839 02-APR-81 2975 20 7654 MARTIN SALESMAN 7698 28-SEP-81 1250 1400 30 7698 BLAKE MANAGER 7839 01-MAY-81 2850 30 7782 CLARK MANAGER 7839 09-JUN-81 2450 10 7788 SCOTT ANALYST 7566 09-DEC-82 3000 20 7839 KING PRESIDENT 17-NOV-81 5000 10 7844 TURNER SALESMAN 7698 08-SEP-81 1500 0 30 7876 ADAMS CLERK 7788 12-JAN-83 1100 20 7900 JAMES CLERK 7698 03-DEC-81 950 30 7902 FORD ANALYST 7566 03-DEC-81 3000 20 7934 MILLER CLERK 7782 23-JAN-82 1300 10 14 rows selected. |
Check extint (EXTRACT) param file
1 2 3 4 5 6 7 8 9 10 11 12 |
GGSCI (gg.orcl.com) 1> view param extint EXTRACT EXTINT SETENV(ORACLE_SID='ORCL') SETENV(ORACLE_HOME='/oraeng/app/oracle/product/12.1.0') useridalias ggadmin_src TRANLOGOPTIONS INTEGRATEDPARAMS(MAX_SGA_SIZE 100) EXTTRAIL /u01/app/oracle/product/ogg_src/dirdat/lt --DDL include all --TABLE ajay.DEPT COLSEXCEPT(MOBILE,PIN); TABLE AJAY.*; |
EXTINT will extract all DML’s from AJAY schema.
Check dpint(PUMP) param file
1 2 3 4 5 6 7 |
GGSCI (gg.orcl.com) 2> view param dpint EXTRACT DPINT RMTHOST 192.168.0.180,MGRPORT 7809 RMTTRAIL /u01/app/oracle/product/ogg_trg/dirdat/rt PASSTHRU table ajay.*; |
DPINT will extract all DML’s from AJAY schema.
TARGET :
Now check REPINT(REPLICAT) Param file
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 |
GGSCI (gg2.orcl.com as ggadmin@orcl) 1> view param repint REPLICAT REPINT SETENV(ORACLE_SID='ORCL') SETENV(ORACLE_HOME='/oraeng/app/oracle/product/12.1.0') useridalias ggadmin_trg DBOPTIONS INTEGRATEDPARAMS(parallelism 4) ASSUMETARGETDEFS IGNOREUPDATES IGNOREDELETES MAP ajay.DEPT,target ajay.DEPT; MAP ajay.test10,target ajay.test10, & COLMAP (USEDEFAULTS,CELL = MOBILE,ADDR = ADDRESS ); MAP AJAY.EMP,target AJAY.EMP; MAP ajay.test,target ajay.test; |
Check Processes
1 2 3 4 5 6 |
GGSCI (gg2.orcl.com as ggadmin@orcl) 2> info all Program Status Group Lag at Chkpt Time Since Chkpt MANAGER RUNNING REPLICAT RUNNING REPINT 00:00:00 00:00:09 |
Replicat is running fine, To perform initial load we should stop replicat
1 2 3 4 5 6 7 8 9 10 11 12 |
GGSCI (gg2.orcl.com as ggadmin@orcl) 3> stop repint Sending STOP request to REPLICAT REPINT ... Request processed. GGSCI (gg2.orcl.com as ggadmin@orcl) 4> info all Program Status Group Lag at Chkpt Time Since Chkpt MANAGER RUNNING REPLICAT STOPPED REPINT 00:00:00 00:00:01 |
Note : Check target table if any records found then truncate the table
To performing initial loads the target table should be empty.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 |
AJAY> select * from dept; DEPTNO DNAME LOC ---------- -------------- ------------- 60 ACCOUNTS CANADA 10 ACCOUNTING NEW YORK 20 RESEARCH DALLAS 30 SALES CHICAGO 40 OPERATIONS BOSTON 50 MARKETING USA 6 rows selected. AJAY> truncate table dept; Table truncated. AJAY> select * from dept; no rows selected |
SOURCE :
In source GGSCI , add initial load extract process to read directly from the table
1 2 3 4 5 6 |
GGSCI (gg.orcl.com) 3> dblogin useridalias ggadmin_src Successfully logged into database. GGSCI (gg.orcl.com as ggadmin@orcl) 4> add extract load1,sourceistable EXTRACT added. |
Check process is added or not
1 2 3 4 5 6 7 8 |
GGSCI (gg.orcl.com as ggadmin@orcl) 5> info all Program Status Group Lag at Chkpt Time Since Chkpt MANAGER RUNNING EXTRACT RUNNING DPINT 00:00:00 00:00:02 EXTRACT RUNNING EXTINT 00:00:06 00:00:09 |
Note : Info all command only shows the processes which is used for change synchronization
Now add Param file for load1 extract
1 2 3 4 5 6 7 8 9 |
GGSCI (gg.orcl.com as ggadmin@orcl) 6> edit param load1 extract load1 useridalias ggadmin_src RMTHOST 192.168.0.180,MGRPORT 7809 RMTTASK REPLICAT,GROUP load2 TABLE AJAY.DEPT; TABLE AJAY.EMP; |
Here i was doing initial load for DEPT and EMP tables
Note : Initial load of tables in param file happens in sequence,which means initial load EMP won’t start until DEPT completes.
If the tables have Primary key and Foreign key relationships always ensure parent tables listed above
TARGET :
Add replicat process for initial load and use Specialrun
Specialrun means once you started load1 in source automatically load2 starts in target by manager
1 2 3 4 5 6 7 8 9 10 11 |
GGSCI (gg2.orcl.com as ggadmin@orcl) 5> add replicat load2,SPECIALRUN REPLICAT added. GGSCI (gg2.orcl.com as ggadmin@orcl) 6> edit param load2 REPLICAT load2 useridalias ggadmin_trg ASSUMETARGETDEFS MAP AJAY.DEPT,target AJAY.DEPT; MAP AJAY.EMP,target AJAY.EMP; |
Add below line into target MGR parameter file
1 |
ACCESSRULE, PROG *, IPADDR <IP address or Hostname of source>, ALLOW |
Note: In place of IP address of source, you have to mention IP address or Hostname of your source machine. In my case its 192.168.1.188 so it should be like this
1 2 3 |
GGSCI (gg2.orcl.com as ggadmin@orcl) 7> edit param mgr ACCESSRULE, PROG *, IPADDR 192.168.0.120, ALLOW |
Refresh Manager process as
Note: Make sure you do refresh mgr if doing any changes in manager parameter file so changes will be reflected.
1 2 3 4 5 |
GGSCI (gg2.orcl.com as ggadmin@orcl) 8> refresh mgr Sending REFRESH request to MANAGER ... Mgr Params Updated |
SOURCE :
Check load1 status
1 2 3 4 5 6 7 |
GGSCI (gg.orcl.com as ggadmin@orcl) 7> info load1 EXTRACT LOAD1 Initialized 2019-08-13 17:30 Status STOPPED Checkpoint Lag Not Available Log Read Checkpoint Not Available First Record Record 0 Task SOURCEISTABLE |
The status was stopped ans task is SOURCEISTABLE .
As soon as we started load1, load2 is running and then it will stop after completes initial load.
Lets start load1 process
1 2 3 4 5 |
GGSCI (gg.orcl.com as ggadmin@orcl) 13> start load1 Sending START request to MANAGER ... EXTRACT LOAD1 starting |
check status of load1
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 |
GGSCI (gg.orcl.com as ggadmin@orcl) 14> info load1 EXTRACT LOAD1 Last Started 2019-08-13 19:02 Status STARTING Checkpoint Lag Not Available Process ID 19567 Log Read Checkpoint Table AJAY.DEPT 2019-08-13 19:02:27 Record 5 Task SOURCEISTABLE GGSCI (gg.orcl.com as ggadmin@orcl) 15> info load1 EXTRACT LOAD1 Last Started 2019-08-13 19:02 Status STARTING Checkpoint Lag Not Available Process ID 19567 Log Read Checkpoint Table AJAY.EMP 2019-08-13 19:0:27 Record 14 Task SOURCEISTABLE |
Here load1 process reads data directly for table and handover to load2 process in target side for both DEPT and EMP table
TARGET :
Check status of load2 process
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 |
GGSCI (gg2.orcl.com as ggadmin@orcl) 9>info load2 REPLICAT LOAD2 Initialized 2019-08-13 18:46 Status RUNNING Checkpoint Lag 00:00:00 (updated 00:18:09 ago) Process ID 17534 Log Read Checkpoint Not Available Task SPECIALRUN GGSCI (gg2.orcl.com as ggadmin@orcl) 10> info load2 REPLICAT LOAD2 Initialized 2019-08-13 18:46 Status STOPPED Checkpoint Lag 00:00:00 (updated 00:18:10 ago) Log Read Checkpoint Not Available Task SPECIALRUN |
Load2 is running as SPECIALRUN and is stops once initial loads done.
We have limited to check the status so be fast when your doing
Now check records in Target Tables
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 |
AJAY> select * from dept; DEPTNO DNAME LOC ---------- -------------- ------------- 10 ACCOUNTING NEW YORK 20 RESEARCH DALLAS 30 SALES CHICAGO 40 OPERATIONS BOSTON 50 MARKETING USA AJAY> select * from emp; EMPNO ENAME JOB MGR HIREDATE SAL COMM DEPTNO ---------- ---------- --------- ---------- --------- ---------- ---------- ---------- 7369 SMITH CLERK 7902 17-DEC-80 800 20 7499 ALLEN SALESMAN 7698 20-FEB-81 1600 300 30 7521 WARD SALESMAN 7698 22-FEB-81 1250 500 30 7566 JONES MANAGER 7839 02-APR-81 2975 20 7654 MARTIN SALESMAN 7698 28-SEP-81 1250 1400 30 7698 BLAKE MANAGER 7839 01-MAY-81 2850 30 7782 CLARK MANAGER 7839 09-JUN-81 2450 10 7788 SCOTT ANALYST 7566 09-DEC-82 3000 20 7839 KING PRESIDENT 17-NOV-81 5000 10 7844 TURNER SALESMAN 7698 08-SEP-81 1500 0 30 7876 ADAMS CLERK 7788 12-JAN-83 1100 20 7900 JAMES CLERK 7698 03-DEC-81 950 30 7902 FORD ANALYST 7566 03-DEC-81 3000 20 7934 MILLER CLERK 7782 23-JAN-82 1300 10 14 rows selected. |
Initial load done successfully….!
Thank you for giving your valuable time to read the above information. Please click here to subscribe for further updates
KTEXPERTS is always active on below social media platforms.
Facebook : https://www.facebook.com/ktexperts/
LinkedIn : https://www.linkedin.com/company/ktexperts/
Twitter : https://twitter.com/ktexpertsadmin
YouTube : https://www.youtube.com/c/ktexperts