Thursday, July 7, 2016

Knowledge on BI-DIRECTIONAL Replication GoldenGate : CDR Parameters

Knowledge of Bi-directional Replication and How to resolve conflicts @
Loop Detection # when we configured Bi-directional replication, Both instance's are active, where both instances are updated by application. Here its hard to find out goldengate or application performed the transactions. if the goldengate start replicating the transaction. Goldengate replicat's apply transaction where goldengate extract collect the transaction again. In this scenario, it is never ending loop
we will avoid loop by using following parameter in extract parameter file
tranlogoptions excludeuser <ggsuser>
tracetable ggsuser.trctab

This will exclude transactions or operations performed by goldengate user :) 
if you still want to investigate the looping we can trace extract and replicat process# 
 

Conflict Detection # When we configured bi-directional replication, detecting if any update occurred on both the source and target instances, before changes are applied by goldengate 
we have to use the parameter "getbeforecols" to log before changes for update and delete operations to trail, which helps us to compare and detect conflict while goldengate is processing transaction on database # 
parameter used in extract as follows # 
table schema.tabname, getbeforecols ( on update all, on delete all)  

conflict can be occurred in different scenario, during an update, insert or delete. How to resolve is little bit tricky #  lets talk about resolution for a while #

Conflict resolution #  To handle collisions we will compare the data using timestamp column or range of values  #  # At least timestamp column should be added to the tables replicated by goldengate  in bi-directional replication which help's to compare before and after values i.e logged on the trail. When conflict is detected using the data on the trail # we have to automate the process to resolve the conflict

Conflict Resolution  and management Options #  
Insert -> Insertrowexists -> Overwrite 
                                        -> Ignore
                                        -> Discard
                                        -> USEMIN,USEMAX

Update -> Updaterowmissing  -> Overwrite 
                                                 -> Ignore
                                                 -> Discard
                  Updaterowmissing -> Overwrite 

                                                 -> Ignore
                                                 -> Discard
                                                 -> USEMIN,USEMAX
                                                 -> USEDELTA 

 Delete -> Deleterowmissing -> Ignore
                                           -> Discard
                 Deleterowexists -> Overwrite
                                            -> Ignore
                                            -> Discard

For Example Conflict can be handled as follows MAP mots.emp, target delta.emp,
COMPARECOLS (ON UPDATE ALL, ON DELETE ALL),
RESOLVECONFLICT (INSERTROWEXISTS, (DEFAULT, USEMAX(CHANGE_TS)));
RESOLVECONFLICT (UPDATEROWEXISTS, (DEFAULT, USEMIN(CHANGE_TS)));
RESOLVECONFLICT (DELETEROWMISSING, (DEFAULT, [ DISCARD | IGNORE ]));



----Nikhil Tatineni---


 

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...