Saturday, October 31, 2015

Oracle GoldenGate: Defgen utility

Hi Guys, welcome back 

Defgen Utility:  Using defgen utility definition file is created on source database. Replicat will use definition file to map source and target table. Defgen utility exists in Oracle goldengate home. 

Scenario's to use definition file: 

Emp table consists of 42 columns in schema world  on database db11g  and you want to replicate only 5 columns to table emp in  schema india - database oval9p

Replicat param file with out definition file:

replicat param files as follows

-- GGSCI> add replicat rnlggsm1, exttrail /opt/app/db11g/ggs/trails/m9, checkpointtable ggsuser.nspckpt
replicat rnlggsm1
SETENV (ORACLE_HOME="/usr/local/opt/oracle/product/11204")
SETENV (ORACLE_SID="db11g")
userid ggsuser, password xxxxxx
assumetargetdefs
reperror (default, discard)
discardfile /opt/app/oval009p/ggs/dsc/rnlggsm1.dsc, megabytes 200, append
discardrollover at 21:00
----REPERROR (1403, DISCARD)
----BATCHSQL BATCHERRORMODE, BATCHTRANSOPS 100000
map world.emp, target world.emp;

assumetargetdefs: This parameter will help replicat to map source and target table. when we state this parameter in replicat  param file. Replicat will assume structure of source table and target table is same 

Replicat param file with definition file:

replicat param files as follows

-- GGSCI> add replicat rnlggsm1, exttrail /opt/app/db11g/ggs/trails/m9, checkpointtable ggsuser.nspckpt
replicat rnlggsm1
SETENV (ORACLE_HOME="/usr/local/opt/oracle/product/11204")
SETENV (ORACLE_SID="db11g")
userid ggsuser, password xxxxxx
sourcedefs ./dirdef/def-world.def
reperror (default, discard)
discardfile /opt/app/ggs/dsc/rnlggsm1.dsc, megabytes 200, append
discardrollover at 21:00
---REPERROR (1403, DISCARD)
---BATCHSQL BATCHERRORMODE, BATCHTRANSOPS 100000
map world.emp, target india.emp;

In the above paramfile, emp table in world schema have 42 columns and target table emp in india schema have only 5 columns. Here structure of source and target table is different,where replicat will map source and target table using defintion file. 

------When we create defintion file using defgen utility, defintion of source table is loaded into .def file
------Steps to create definition file

Step1: Create .prm file in dirprm directory under goldengate home

vi  /opt/app/db11g/ggs/dirprm/world.prm 

defsfile ./dirdef/def-world.def
userid ggsuser password xxxxxx
table world.emp 

Step2:  Run the defgen file from goldengate home 

./defgen paramfile /opt/app/db11g/ggs/dirprm/world.prm 

when you run defgen utility, .def file is created in dirdef directory under goldengate home. after scp or sftp .def file created under dirdef directory from source to target goldengate home /dirdef directory and add parameters in replicat paramfile as follows

userid ggsuser, password xxxxxx
sourcedefs ./dirdef/def-world.def
map world.emp, target india.emp;

sourcedefs: defintion file is created on the source side 


---Nikhil Tatineni ---
---Oracle in memory ---
Oracle is my realm. Living in it 

Querys to monitor RAC

following few  Query's will help to find out culprits-  Query to check long running transaction from last 8 hours  Col Sid Fo...