Advanced Goldengate Configuration ConflictDetect Resolution PDF
Advanced Goldengate Configuration ConflictDetect Resolution PDF
Lorrie Yang
NoCoug, Nov 2015
My GoldenGate Journey
Supported 2-way and 3-way replication with
legacy Advanced Replication
Started with GoldenGate 10
Supported GoldenGate 11.1
Supporting GoldenGate 11.2 and 12.1 one way, 2
way and 3+ way replication.
Supporting combination of GoldenGate and
standby.
Agenda
GoldenGate usage, is it a good fit your app?
GoldenGate requirements
GoldenGate basic concepts
GoldenGate conflict detection and resolution
Other GoldenGate advanced setup
Operational challenges of multi-way replication
AUDIENCE SURVEY
GoldenGate Usage
One way replication
One time data migration across DB platforms
Ongoing master to slave database copies for business or technical
reasons
GoldenGate vs. DataGuard
Two way replication
For data redundancy as well as load sharing.
Three way plus/multi-way replication
Complexity
Workload increases exponentially (next page)
Combination of GoldenGate and Data Guard
GoldenGate active on primary database but dormant on standby
Multi-way replication workload
comparison in simplest case
MANAGER RUNNING
EXTRACT RUNNING E1xxxxxx 00:00:09 00:00:01
EXTRACT RUNNING P2xxxxxx 00:00:00 00:00:02
REPLICAT RUNNING R2xxxxxx 00:00:00 00:00:05
Advanced Configurations
Conflict detection and resolution (today’s subject)
Source and target tables have different definitions
Data filtering and manipulation
Performance tuning
Conflict Detection and Resolution
Set up
Resolution
built-in
customized
Conflict Detection
What is considered a data conflict?
A conflict is a mismatch between the before image
of a record in the trail and the current record in the
target table.
How is current record on the target table found?
By replication key
Conflict Type
Insert conflict
Uniqueness violation on replication key, primary key or unique key
Update row missing
The row can not be found by the replication key.
Update row exists
The row is found by replication key but before image of incoming record doesn’t match current
record on compared columns in target database.
Delete row missing
The row can not be found by the replication key.
Delete row exists
The row is found by replication key but before image of incoming record doesn’t match current
record on compared columns in target database.
Enable Conflict Detection
Specify the columns that replicats use to detect update
and delete conflict in replicat file
MAP scott.table1, TARGET scott.table1, &
COMPARECOLS (ON UPDATE <columns>, ON DELETE
<columns> )
Different ways to specify <columns>
ALL (highest workload, best data convergence)
KEY (replication key)(fastest, least data quality)
KEYINCLUDING (col1, …)
ALLEXCLUDING (col1, …)
KEYANDMOD (key and modified columns)
COMPARECOLS requires that
The before image must be present in the trail file
Specified columns must exist in the target database
Can only compare scalar data types
Scalar data types
Numeric, Date, Character
Non Scalar data columns must be excluded from the
comparison. For example, LOBs, user defined, spatial,
reference, raw etc.
Put before image into DB log files
SCOTT SYS_C006351
TABLE1 PRIMARY KEY LOGGING ALWAYS GENERATED NAME
SCOTT SYS_C006352
TABLE1 UNIQUE KEY LOGGING CONDITIONAL GENERATED NAME
SCOTT SYS_C006353
TABLE1 FOREIGN KEY LOGGING CONDITIONAL GENERATED NAME
SCOTT SYS_C006354
TABLE1 ALL COLUMN LOGGING ALWAYS GENERATED NAME
Put before image into GG trail file
In extract parameter file
All columns will be captured when there is no PK, UK column(s), or alternate key specified
by TABLE …KEYCOLS (columns)
LOGALLSUPCOLS in GG12.
Record the before image of all supplemental logged columns for both UPDATE and DELETE
operations.
NOLOGALLSUPCOLS is default.
GETUPDATEBEFORES and NOCOMPRESSUPDATES below GG12
IGNOREUPDATEBFORES and COMPRESSUPDATES are default
TABLE scott.table1 COLS (col1, col2), must include key columns in the list
TABLE scott.table1 COLSEXCEPT (col1, col2), does not exclude key columns
TABLE scott.table1, GETBEFORECOLS (ON UPDATE <option>, ON DELETE <option> );
<options> are
ALL – all supported columns (highest workload)
KEY – this the default.
KEYINCLUDING (col1, col2)
KEYANDMOD – include modified columns
ALLEXCLUDING (col1, col2)
Conflict Resolution
Out of the box
Conflict type Conflict detail Resolution available
REPERROR (
DEFAULT |DEFAULT2|SQL error|
ABEND - default behavior
IGNORE - ignore the error.
DISCARD - send to discard file
EXCEPTION - to be handled by MAP exception statement
TRANSABORT - abort at transaction level
TRANSDISCARD
TRANSEXCEPTION
RETRYOP [ MAXRETRIES n] – useful for transit error
)
Operational challenges
For a multi-master replicated environment that
doesn’t allow application downtime
Application release must be backward/forward
compatible with DB code (tables, packages.)
May have to complete all database table changes in
all replicated databases before/after application
code change.
Column addition/deletion on replicated tables
Q&A