If source and target table structures are different, like source has then we need to use definition file in replicat file.
Example:
Here we will generate definition file of a table DBACLASS.EMPLOYEE from source database and use it in target db.
1. Create defgen parameter file
ggsci>edit params defgen defsfile /u01/ggate/dirsql/dbaclass_def.sql userid ggatebss, password ggatebss#123 TABLE DBACLASS.EMPLOYEE;
This will create the parameter file in $GG_HOME/dirprm
ls -ltr /u01/ggate/dirprm/defgen.prm
2. Now execute the param file( to generate the defgen file)
./defgen paramfile /u01/ggate/dirprm/defgen.prm
./defgen paramfile /u01/ggate/dirprm/defgen.prm *********************************************************************** Oracle GoldenGate Table Definition Generator for Oracle Version 11.2.1.0.3 14400833 OGGCORE_11.2.1.0.3_PLATFORMS_120823.1258 Linux, x64, 64bit (optimized), Oracle 11g on Aug 23 2012 16:58:29 Copyright (C) 1995, 2012, Oracle and/or its affiliates. All rights reserved. Starting at 2016-12-20 14:52:05 *********************************************************************** Operating System Version: Linux Version #1 SMP Tue Sep 16 01:56:35 EDT 2014, Release 2.6.32-504.el6.x86_64 Node: b23e2bay16 Machine: x86_64 soft limit hard limit Address Space Size : unlimited unlimited Heap Size : unlimited unlimited File Size : unlimited unlimited CPU Time : unlimited unlimited Process id: 29614 *********************************************************************** ** Running with the following parameters ** *********************************************************************** defsfile /u01/ggate/dirsql//dbaclass_def.sql userid ggatebss, password ************ TABLE DBACLASS.EMPLOYEE; Retrieving definition for DBACLASS.EMPLOYEE Definitions generated for 1 tables in /u01/ggate/dirsql/dbaclass_def.sql
Now copy the file dbaclass_def.sql to target server(where replicat is running.
4. Stop the replicat and Update the extract file with sourcedef parameter as below
SOURCEDEFS /ggatebss/app/ggate/product/11.2.1.0.3/ggate_1/myobjects3.sql
REPLICAT BLTLR USERID ggatebss, PASSWORD ggatebss DBOPTIONS SUPPRESSTRIGGERS,DEFERREFCONST SOURCEDEFS /ggatebss/app/ggate/product/11.2.1.0.3/ggate_1/myobjects3.sql DISCARDFILE /ggatebss/install/datacapture_bsst/discardbltlr,append,megabytes 1000 MAP DBACLASS.EMPLOYEE,TARGET DBACLASS.EMPLOYEE
Now you can start your replicat.
NOTE – If you source and target database versions are different. i.e source db is of 12c and target db is of 11g, then use format command in the defgen file. i.e the file will look as below. format release < target db release version>
ggsci>edit params defgen defsfile /u01/ggate/dirsql/dbaclass_def.sql ,format release 11.2 userid ggatebss, password ggatebss#123 TABLE DBACLASS.EMPLOYEE;
very useful!
Hello,
Thanks for sharing the great information. It helps to all the basic level to higher level of Oracle GoldenGate.
Good info to understand the defgen process in GG
Thanks Niraj
Hi,
I used this tool in 12.3, but it seems not working
GGSCI (zccc as ggadmin@xiyun) 10> view param cdcrep
REPLICAT cdcrep
HANDLECOLLISIONS
–ASSUMETARGETDEFS
USERID ggadmin, PASSWORD ggadmin
DBOPTIONS SUPPRESSTRIGGERS,DEFERREFCONST
SOURCEDEFS /u01/app/oracle/product/ogg_src/dirdef/t1.def
MAP b.t1, TARGET b.t1;
[oracle@zccc ogg_src]$ ls -l /u01/app/oracle/product/ogg_src/dirdef/t1.def
-rw-r—–. 1 oracle oinstall 1304 Aug 30 19:12 /u01/app/oracle/product/ogg_src/dirdef/t1.def
I still got the erro message from replicat process following by:
2019-08-30T19:24:08.133-0400 ERROR OGG-00918 Oracle GoldenGate Delivery for Oracle, cdcrep.prm: Key column INSERT_DATE is missing from map.
2019-08-30T19:24:08.135-0400 ERROR OGG-01668 Oracle GoldenGate Delivery for Oracle, cdcrep.prm: PROCESS ABENDING.
Looks like some column mismatch i source and target table. Please crosscheck again.
how to do this automatically….?? I have read that we can call any os script from ggsci but I am unable to do it .
Please suggest how to create a script for my requirment.
When the source and target on 12.1.0.2, do we need defgen or we can go with ASSUMETARGETDEFS.
In my case ASSUMETARGETDEFS is not working.
It says OGG-00919 Error in COLMAP clause. But i see that the mapping is all done right.
Yes, you need defgen for 12.1.0.2 also.