Oracle: Goldengate 12C: Conflict Detection and Resolution
Oracle: Goldengate 12C: Conflict Detection and Resolution
Speaker
Douglasville, Georgia
Senior Technical Consultant
IOUG, RMOUG, GAOUG, RACSIG
@dbasolved
http://dbasolved.com
[email protected]
[email protected]
Agenda
Oracle GoldenGate 12c Architecture
Conflict Management
Examples
Statistics
Summary
Capture
Trail
Files
Pump
Trail
Files
Delivery
Capture
Delivery
Trail
Files
Trail
Files
Pump
Trail
Files
Pump
bi - directional
Trail
Files
Delivery
Capture
Delivery
Trail
Files
Trail
Files
Pump
Trail
Files
Pump
bi - directional
Trail
Files
Delivery
Capture
Conflict Management
Example - Financial Institution: Active/Active
ACCTINFO
ID
(PK)
ACCTINFO
Capture
NAME
ADDRESS
CITY
BALANCE
CHANGE_TS
Delivery
Trail
Files
Trail
Files
Pump
Trail
Files
Pump
Delivery
Trail
Files
bi - directional
Capture
ID
(PK)
NAME
ADDRESS
CITY
BALANCE
CHANGE_TS
Conflict Management
Example - Financial Institution: Active/Active
ACCTINFO
ID
(PK)
ACCTINFO
Capture
NAME
ADDRESS
CITY
BALANCE
CHANGE_TS
CHANGE_TS
Delivery
Trail
Files
Trail
Files
Pump
Trail
Files
Pump
Trail
Files
bi - directional
Delivery
Capture
ID
(PK)
NAME
ADDRESS
CITY
BALANCE
CHANGE_TS
CHANGE_TS
Conflict Management
Conflicts Supported
Basic Resolution for conflicts within GoldenGate environment:
INSERT
Uniqueness conflict for INSERT
UPDATE
conflict for No Data Found when row exists (before image diffs)
conflict for No Data Found when row does not exists
DELETE
conflict for No Data Found when row exists (before image diffs)
conflict for No Data Found when row does not exists
Conflict Management
Supported Data Types
Data Types that can be compared are supported:
NUMERIC
DATE
TIMESTAMP
CHAR/NCHAR
VARCHAR/NVARCHAR
Typically these data types are used with parameters like COMPARECOLS,
GETBEFORECOLS, and in resolution parameters using RESOLVECONFLICT
([USEMIN] | [USEMAX])
Conflict Management
Before and After Images
ACCTINFO
BEFORE
AFTER
ID (PK)
10
10
NAME
32
32
ADDRESS
96 Smith Rd
96 Smith Rd
CITY
Atlanta
Atlanta
BALANCE
1500
1550
CHANGE_TS
2014-10-29
2014-10-30
00.00.00.000000
AM
01.32.05.000000
PM
Conflict Management
Requirements - Environment
Full before image of each record
Transactional Data
GGSCI> dblogin user <gg user> password <password>
GGSCI> add trandata SFAA.ACCTINFO, allcols
Conflict Management
Requirements - Environment
Sequences need to be unique on each
system
Use starting value and increment by
number of systems
Applies to existing sequences and
identity columns
1+3
3+3
2+3
Conflict Management
Requirements - Extract
LOGALLSUPCOLS
Extract captures before images for UPDATE operations
Extract captures before images of supplemental logged columns for both
UPDATE and DELETE operations
GETBEFORECOLS
Ensures certain columns are logged
GETBEFOREUPDATES (DB2 only)
TABLE option in extract
GETBEFORECOLS (ON UPDATE ALL, ON DELETE ALL)
Conflict Management
Requirements - Extract
TRANSLOGOPTION EXCLUDETAG
Tag supplied to transaction as it is extracted to prevent receiving replicat
from trying to send it back to source
Classic/Integrated Extract (primary or pump)
Tag can be any number/letter [0-9 A-Z]
Example:
TRANSLOGOPTION EXCLUDETAG 0294
Conflict Management
Requirements - Replicat
REPERROR
Used to control how Replicat responds to errors
Default:
REPERROR(default, abend)
For CDR:
REPERROR(default, exception)
REPERROR(default2, [ abend | discard ])
REPERROR(-1, exception)
Conflict Management
Requirements - Replicat
COMPARECOLS
Used by Replicat to detect and resolve update/delete conflicts
RESOLVECONFLICT
Used by Replicat in bi-directional/multi-master to handle conflicts for DML
operations
Example:
MAP SFAA.ACCTINFO, TARGET ATLAA.ACCTINFO,
COMPARECOLS (ON UPDATE ALL, ON DELETE ALL),
RESOLVECONFLICT (INSERTROWEXISTS, (DEFAULT,USEMAX(CHANGE_TS)));
Overwrite
InsertRowExists
Ignore
Discard
Min/Max
Insert
Overwrite
UpdateRowMissing
Ignore
Discard
ResolveConflict
Update
Overwrite
Ignore
UpdateRowExists
Discard
Min/Max
Delta
Delete
DeleteRowMissing
Ignore
Discard
DeleteRowExists
Overwrite
Ignore
Discard
Conflict Management
Requirements - Exceptions
Exception Table[s]
User defined
Used for troubleshooting or
handling errors
Referenced in REPERROR and
MAP parameters
Best if defined through macros
Conflict Management
Beware
BATCHSQL
Increases apply performance of Replicat by organizing similar SQL statements
and apply them at an accelerated rate.
CDR is not performed in this mode
Replicat reverts, as needed, to help resolve conflict
1. GROUPTRANSOPS
2. Single-transaction mode
Conflict Management
Example 1 Insert Row Exists
ACCTINFO
SF
ATL
ID
944
944
NAME
32
32
ADDRESS
55 5th Street
55 5th Street
CITY
Symrna
Symrna
BALANCE
1100
1200
INSERTROWEXISTS
Violates the unique
constraint on the target
31-OCT-14
31-OCT-14
CHANGE_TS
10.40.36.000000000
PM
10.40.40.000000000
PM
Conflict Management
Example 2 Update Row Exists
ACCTINFO
BEFORE
AFTER
ID
944
944
NAME
32
32
ADDRESS
55 5th Street
55 5th Street
CITY
Symrna
Symrna
BALANCE
1150
1100
31-OCT-14
31-OCT-14
CHANGE_TS
10.40.36.000000000
PM
10.40.40.000000000
PM
UPDATEROWEXISTS
Updated row exists on
target side
One or more columns
have a before image
different from current
value
Conflict Management
Example 3 Delete Row
ACCTINFO
SF
ATL
ID
944
null
NAME
32
null
ADDRESS
55 5th Street
null
CITY
Symrna
null
BALANCE
1100
null
DELETEROWMISSING
Deleted row does not exist
on target
31-OCT-14
CHANGE_TS
10.40.36.000000000
PM
null
Conflict Management
Statistics
GGSCI> stats replicat <group name>, reportcdr
Replicating from ATLAA.ACCTINFO to SFAA.ACCTINFO:
*** Total statistics since 2014-11-02 00:30:43 ***
Total inserts
Total updates
Total deletes
Total discards
Total operations
Total CDR conflicts
CDR resolutions succeeded
CDR INSERTROWEXISTS conflicts
CDR UPDATEROWEXISTS conflicts
CDR DELETEROWMISSING conflicts
719.00
93.00
524.00
0.00
1336.00
377.00
377.00
257.00
93.00
27.00
Conflict Management
Summary
Architecture
Conflict Management
Parameters Required
Examples
INSERTROWEXISTING
UPDATEROWEXISTING
DELETEROWMISSING
Statistics
Contact Info
@dbasolved
http://dbasolved.com