This article will demostrate how to perform a OGG Initial Load using the File to Replicat technique.
Other Initial Load techniques and their advantages and disadvantages can be found here
.
Pre-requisites
OGG is installed on source and target systems
Environment
OGG : 11.2.1.0.1
Database : 11.2.0.3
Linux : OEL 6 ( 64 bit )
File to Replicat Steps
1. Configure the initial-load processes
Extract
SOURCEISTABLE -- -------------------------------------------------- -- environment -- -------------------------------------------------- SETENV (ORACLE_HOME="/u01/app/oracle/product/11.2.0/dbhome_1") SETENV (ORACLE_SID="GGDB1") SETENV (NLS_LANG="AMERICAN_AMERICA.WE8MSWIN1252") USERID ggate, PASSWORD ggate -- -------------------------------------------------- RMTHOST gglab1n2, mgrport 7809 RMTFILE /u01/app/oracle/product/golden_gate/dirdat/ilCSOE.DAT, PURGE TABLE soe.inventories; TABLE soe.product_descriptions;
Replicat
SPECIALRUN END RUNTIME -- -------------------------------------------------- -- environment -- -------------------------------------------------- SETENV (ORACLE_HOME="/u01/app/oracle/product/11.2.0/dbhome_1") SETENV (ORACLE_SID="GGDB2") SETENV (NLS_LANG="AMERICAN_AMERICA.WE8MSWIN1252") USERID ggate, PASSWORD ggate -- -------------------------------------------------- -- options -- -------------------------------------------------- ASSUMETARGETDEFS DBOPTIONS SUPPRESSTRIGGERS -- -------------------------------------------------- -- files -- -------------------------------------------------- EXTFILE /u01/app/oracle/product/golden_gate/dirdat/ilCSOE.DAT DISCARDFILE /u01/app/oracle/product/golden_gate/dirrpt/ilCSOE.dsc, PURGE -- -------------------------------------------------- -- mappings -- -------------------------------------------------- MAP soe.inventories , TARGET soe.inventories; MAP soe.product_descriptions , TARGET soe.product_descriptions;
2. Configure the change-synchronization processes
This is the normal replication methods, so I will not cover them here to keep things short. You can see example of this in some of my other posts.
3. Start the change-synchronization Extract
GGSCI> DBLOGIN USERID ggate, PASSWORD password ggate GGSCI> FLUSH SEQUENCE soe.* GGSCI> start extract csoea
4. Start the initial-load extract
extract paramfile ./dirprm/icsoea.prm reportfile ./dirrpt/icsoea.rpt
You should observe the following:
* the collector starting on target as seen in the ggserr.log
* the file ilCSOE.DAT in dirdat directory on target
* report file in dirrpt directory on source
When I first tried this on the entire schema, errors were reported in both the source and target ggserr logs.
2013-05-22 16:06:17 WARNING OGG-01223 Oracle GoldenGate Collector for Oracle: Error 0 (Success) getting position in /u01/app/oracle/product/golden_gate/dirdat/ilCSOE.DAT. 2013-05-22 16:07:51 ERROR OGG-01033 There is a problem in network communication, a remote file problem, encryption keys for target and source do not match (if using ENCRYPT) or an unknown error. (Remote file used is /u01/app/oracle/product/golden_gate/dirdat/ilCSOE.DAT, reply received is Error 0 (Success) getting position in /u01/app/oracle/product/golden_gate/dirdat/ilCSOE.DAT).
This turns out to be a limitation of this technique where the remote file is limited in size to 2 GB.
I then reduced my dataset down to two tables in order to perform the this intial-load.
I also did a test with the “Trail to Replicat” initial-load technique which can be used with datasets greater than 2GB.
Wait until the extract completes running and review the resulting report file for any errors.
5. Start the initial-load replicat on the target environment
replicat paramfile ./dirprm/irsoea.prm reportfile ./dirrpt/irsoea.rpt
Monitor the report file for the initial-load replicat and wait until it completes. If there are no errors, then you can continue on to the next step.
6. Start the change-synchronization Replicat
GGSCI> start replicat rsoeas
Monitor the replicat for any errors and the current time and position of the records it is applying.
Next, Verify that the change synchronization replicat has passed the point where the initial-load replicat stopped. You can compare both time and the RBA by looking in the irsoea.rpt report file and the current position of the change synchronization replication as shown by the info command.
... Reading /u01/app/oracle/product/golden_gate/dirdat/ilCSOE.DAT, current RBA 97596089, 901667 records Report at 2013-05-22 18:49:25 (activity since 2013-05-22 18:44:17) From Table SOE.INVENTORIES to SOE.INVENTORIES: # inserts: 900667 # updates: 0 # deletes: 0 # discards: 0 From Table SOE.PRODUCT_DESCRIPTIONS to SOE.PRODUCT_DESCRIPTIONS: # inserts: 1000 # updates: 0 # deletes: 0 # discards: 0 Last log location read: FILE: /u01/app/oracle/product/golden_gate/dirdat/ilCSOE.DAT RBA: 97596089 TIMESTAMP: 2013-05-22 18:41:55.063284 ...
GGSCI (gglab1n2.enkitec.com) 4> info * REPLICAT RSOEAS Last Started 2013-05-22 18:44 Status RUNNING Checkpoint Lag 00:00:00 (updated 00:00:04 ago) Log Read Checkpoint File /u01/app/oracle/product/golden_gate/dirdat/As000001 2013-05-22 19:49:32.242676 RBA 97596089
7. Turn off HANDLECOLLISIONS
SEND REPLICAT rsoeas, NOHANDLECOLLISIONS
Lastly, edit the replicat parameter file and remove HANDLECOLLISIONS so that it is not enabled next time the replicat restarts.