Automatic Conflict Detection and Resolution
You can configure automatic conflict detection and resolution in an Oracle
GoldenGate configuration that replicates tables between Oracle databases. To configure
automatic conflict detection and resolution for a table, you need to call the
ADD_AUTO_CDR
procedure in the DBMS_GOLDENGATE_ADM
package. A prerequisite for setting up automatic conflict detection and resolution, the
Oracle GoldenGate user must have the appropriate privileges. See Grant User Privileges for Oracle Database for Oracle GoldenGate Classic Architecture learn about user privileges.
ADD_AUTO_CDR
. The following constants, which
represent bit flags are now added:
-
EARLIEST_TIMESTAMP_RESOLUTION
setsTOMBSTONE KEY VERSIONING
automatically -
DELETE_ALWAYS_WINS
setsTOMBSTONE KEY VERSIONING
automatically. -
IGNORE_SITE_PRIORITY
The following example uses an ALTER
command for the
HR.EMPLOYEES
table:
BEGIN
dbms_goldengate_adm.alter_auto_cdr
(schema_name => 'HR'
,table_name => 'EMPLOYEES'
,additional_options => DBMS_GOLDENGATE_ADM.ADDITIONAL_OPTIONS_ADD_KEY_VERSION );
END;
/
See the description for additional_options
in ADD_AUTO_CDR Procedure
of Oracle Database PL/SQL
Packages and Types Reference.
When Oracle GoldenGate captures changes that originated at an Oracle Database, each change is encapsulated in a row logical change record (LCR). A row LCR is a structured representation of a DML row change. Each row LCR includes the operation type, old column values, and new column values. Multiple row LCRs can be part of a single database transaction.
When more than one replica of a table allows changes to the table, a conflict can occur when a change is made to the same row in two different databases at nearly the same time. Oracle GoldenGate replicates changes using the row LCRs. It detects a conflict by comparing the old values in the row LCR for the initial change from the origin database with the current values of the corresponding table row at the destination database identified by the key columns. If any column value does not match, then there is a conflict.
After a conflict is detected, Oracle GoldenGate can resolve the conflict by overwriting values in the row with some values from the row LCR, ignoring the values in the row LCR, or computing a delta to update the row values.
Automatic conflict detection and resolution does not require application changes for the following reasons:
-
Oracle Database automatically creates and maintains invisible timestamp columns.
-
Inserts, updates, and deletes use the delete tombstone log table to determine if a row was deleted.
-
LOB column conflicts can be detected.
-
Oracle Database automatically configures supplemental logging on required columns.