INITIAL LOAD | FILE TO REPLICAT |
SOURCE DATABASE VERSION | 11.2.0.3 |
TARGET DATABASE VERSION | 11.2.0.4 |
ORACLE GOLDEN GATE VERSION | 12.1.2.0.0 |
SOURCE DATABASE | GGDB1 |
TARGET DATABASE | GGDB2 |
SCHEMA USED | VEERA |
TABLE NAME | MYTABLE |
The File to Replicat Method is similar to the normal CDC (Change Data Capture) method used in the GoldenGate. In this method, the Initial Load Extract extracts the data from the Source Tables and writes it to the Extract File in an Canonical Format. This file is read by the Initial Load Replicat Process and this loads the data using the Database Interface.
One thing should be taken in to considerations. During this Initial Load, you can also enable the Change Synchronization Extract and Datapump processes to record or capture the Online or Incremental changes which happens during the Initial Load and later it can be merged or reconciled with the results of the Initial Load.
File to Replicat is slower when comparing to the Other types/methods of Initial Load because, here the records are applied to the target database one by one. It is applied one record at a time.
ON TARGET
As I mentioned in my earlier postings, For starting the Initial Load, The structure of the tables should be exported from the Source and Imported to the Target database.
This can be done using the EXPDP / IMPDP utility available in the Oracle.
So in this example I have already exported the Schema VEERA from Source and IMPORTED to the Target System (only the structures).
COUNT(1)
———-
0
Name Null? Type
—————- ——————– —————————-
ID NOT NULL NUMBER
So in Target Table there are no rows inserted. Only the Structure is created.
ON SOURCE
Connected.
SQL> select * from tab;TNAME TABTYPE CLUSTERID
————– ————— ——————
MYTABLE TABLESQL> select count(1) from mytable;
COUNT(1)
—————
10000000
Create the Initial Load Extract Process.
EXTRACT added.
Configure the Extract process for the Initial Load. The parameters are below,
SOURCEISTABLE
USERID ggadmin, password oracle
RMTHOST OGG2, MGRPORT 7809
RMTFILE /ogg/dirdat/in, PURGE
TABLE veera.MYTABLE;
SOURCEISTABLE – This parameter insists GoldenGate Extract process to extract the data directly from the Source Tables instead from redo logs.
RMTFILE – This is the Extract file on the remote system. The extract process writes the extracted data to this file where then the Replicat process reads these files and applies to the Target system.
Configure the parameters and save the file.
SOURCEISTABLE
USERID ggadmin, password oracle
RMTHOST OGG2, MGRPORT 7809
RMTFILE /ogg/dirdat/in, PURGE
TABLE veera.MYTABLE;
In the ggserr.log file you could see the below.,
2015-01-11 16:05:10 INFO OGG-00987 Oracle GoldenGate Command Interpreter for Oracle: GGSCI command (oracle): EDIT PARAMS EXTLOAD.
To see the Normal or Regular Extract, Datapump or Replicat processes the command is INFO ALL. But in this command the Extract or Replicat processes which are configured for INITIAL LOAD will not be displayed.
To display INITIAL LOAD Processes,
ON TARGET
Create the Initial Replicat Process,
REPLICAT added.
Configure the Replicat process for the Initial Load. The parameters are below,
SPECIALRUN
USERID ggadmin, password oracle
EXTFILE /ogg/dirdat/in
DISCARDFILE /ogg/dirrpt/rep.dsc, PURGE
ASSUMETARGETDEFS
MAP veera.MYTABLE, TARGET veera.MYTABLE;
END RUNTIME
SPECIALRUN – This parameter tells the Replicat that this is a “ONE-TIME” Process. This is an Initial Load process and not the Normal one. This is process ends with END RUNTIME.
EXTFILE – The Filename present in the Remote system with location. This contains the data which are written by the Extract process for Synchronization of the Target database.
ASSUMETARGETDEFS – This parameter tells the Replicat Process that the Structure of the Source Tables are same as the Target Table.
To view the Parameters,
SPECIALRUN
USERID ggadmin, password oracle
EXTFILE /ogg/dirdat/in
DISCARDFILE /ogg/dirrpt/rep.dsc, PURGE
ASSUMETARGETDEFS
MAP veera.MYTABLE, TARGET veera.MYTABLE;
END RUNTIME
In the ggserr.log file you could see the below,
2015-01-11 16:28:43 INFO OGG-00987 Oracle GoldenGate Command Interpreter for Oracle: GGSCI command (oracle): EDIT PARAMS REPLOAD.
ON SOURCE
Now Start the Initial Load Extract Process from the SOURCE SYSTEM,
Sending START request to MANAGER …
EXTRACT EXTLOAD starting
Program Status Group Lag at Chkpt Time Since Chkpt
EXTRACT RUNNING EXTLOAD
Wait until the Initial Extraction completes. Once it is finished, start the Initial Load Replicat which is on the Target System.
Program Status Group Lag at Chkpt Time Since Chkpt
EXTRACT STOPPED EXTLOAD
The below is registered in the ggserr.log,
2015-01-12 11:41:50 INFO OGG-01478 Oracle GoldenGate Capture for Oracle, extload.prm: Output file /ogg/dirdat/in is using format RELEASE 12.1.
2015-01-12 11:41:52 INFO OGG-00987 Oracle GoldenGate Command Interpreter for Oracle: GGSCI command (oracle): info all tasks.
2015-01-12 11:41:55 INFO OGG-01226 Oracle GoldenGate Capture for Oracle, extload.prm: Socket buffer size set to 27985 (flush size 27985).
2015-01-12 11:42:17 INFO OGG-00991 Oracle GoldenGate Capture for Oracle, extload.prm: EXTRACT EXTLOAD stopped normally.
ON TARGET
Start the Initial Load Replicat and using sqlplus, check if the data are getting loaded to the target table.
START request to MANAGER …
REPLICAT REPLOAD starting
Program Status Group Lag at Chkpt Time Since Chkpt
REPLICAT RUNNING REPLOAD
Connected.
SQL> select count(1) from mytable;
COUNT(1)
—————
1406001SQL> select count(1) from mytable;
COUNT(1)
—————
9217539SQL> select count(1) from mytable; COUNT(1)
—————
10000000
As I mentioned before., here the Initial Load Extract extracts the data from the Source Tables and writes it to the Extract File in an Canonical Format. This file is read by the Initial Load Replicat Process and this loads the data using the Database Interface.
We can see the trail file created in the Target system from where the data is loaded to the Target table by the Replicat Process,
[oracle@ogg2 dirdat]$ ls -lart
total 770416
drwxrwxr-x. 27 oracle oinstall 4096 Jan 4 13:48 ..
drwxr-x— 2 oracle oinstall 4096 Jan 12 11:41 .
-rw-r—– 1 oracle oinstall 788890292 Jan 12 11:42 in
[oracle@ogg2 dirdat]$
In ggserr.log file you could see the below.,
2015-01-12 11:46:12 INFO OGG-03522 Oracle GoldenGate Delivery for Oracle, repload.prm: Setting session time zone to source database time zone ‘GMT’.
2015-01-12 11:46:12 INFO OGG-03506 Oracle GoldenGate Delivery for Oracle, repload.prm: The source database character set, as determined from the trail file, is we8mswin1252.
2015-01-12 12:10:15 INFO OGG-00987 Oracle GoldenGate Command Interpreter for Oracle: GGSCI command (oracle): info all tasks.
2015-01-12 12:19:21 INFO OGG-00994 Oracle GoldenGate Delivery for Oracle, repload.prm: REPLICAT REPLOAD stopped normally.
As I mentioned earlier in this post, we should start the Change Synchronization Extract processes before starting the Initial Load Extract process. After the Initial Load is completed, you can start the Change Synchronization Replicat process to apply the Incremental Changes to the Target Database.