Automatic Conflict Detection and Resolution
Note:
The automatic conflict detection and resolution feature is specific to Oracle Database 12c Release 2 (12.2) and later, which is configured in an Oracle database. It also requires Oracle GoldenGate 12c (12.3.0.1) and later. There is a manual conflict detection and resolution feature, which is called Oracle GoldenGate conflict detection and resolution (CDR). Oracle GoldenGate CDR is configured in the Replicat parameter file. To know more about Oracle GoldenGate CDR, seeAbout Automatic Conflict Detection and Resolution
When Oracle GoldenGate replicates changes between Oracle databases, you can configure and manage Oracle GoldenGate conflict detection and resolution automatically in these databases.
This feature is intended for use with active-active configurations, where Oracle GoldenGate must maintain data synchronization among multiple databases that contain the same data sets.
Note:
Automatic conflict detection and resolution (ACDR) feature that is available only when using Oracle GoldenGate with Oracle Database. For non-Oracle databases, there is a manual conflict detection and resolution (CDR) feature available with Oracle GoldenGate. Oracle GoldenGate CDR is configured in the Replicat parameter file.
Topics:
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
conflict detection and resolution for a table, call the ADD_AUTO_CDR
procedure in the DBMS_GOLDENGATE_ADM
package. These are administration
APIs, which are expected to be called by an Oracle GoldenGate administrator who is
granted privileges through the
DBMS_GOLDENGATE_AUTH.GRANT_ADMIN_PRIVILEGE
. This user needs to have
privileges to modify the affected table. These APIs result in the version number being
bumped for the object and also lock the object due to DDL execution.
-
EARLIEST_TIMESTAMP_RESOLUTION=0x0001
setsTOMBSTONE KEY VERSIONING
automatically -
DELETE_ALWAYS_WINS=0x0002
setsTOMBSTONE KEY VERSIONING
automatically. -
IGNORE_SITE_PRIORITY=0x0004
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.
See Also:
-
Oracle Database Utilities for information about supplemental logging
Requirements for Automatic Conflict Detection and Resolution
Supplemental logging is required to ensure that each row LCR has the information required to detect and resolve a conflict. Supplemental logging places additional information in the redo log for the columns of a table when a DML operation is performed on the table. When you configure a table for Oracle GoldenGate conflict detection and resolution, supplemental logging is configured automatically for all of the columns in the table. The additional information in the redo log is placed in an LCR when a table change is replicated.
Extract must be used for capturing. Integrated Replicat or parallel Replicat
in integrated mode must be used on the apply side. LOGALLSUPCOLS
should
remain the default.
There is a hidden field
KEYVER$$
of type timestamp that is optionally added to the
DELETE TOMBSTONE
table. This field is required for EARLIEST
TIMESTAMP
, DELETE ALWAYS WINS
, and SITE
PRIORITY
resolution and it also exists in the base table. The existence of
the field in the base table needs to be provided in the trail file metadata as a flag or
token.
Primary Key updates is also supported in the DELETE TOMBSTONE
table. An
entry is inserted into the DELETE TOMBSTONE
table for the row of the
original key value (before image). The logic in the Extract which matches inserts in the
DELETE TOMBSTONE
table to deletes also needs to be matched to PK
updates, or unique key (UK) with at least one non-nullable field, if there is no PK.
Site priority needs support from the Replicat, both the parameters are implemented and the setting is passed to the apply.
Compatibility and Migration
Replicating from a base table which doesn’t have a KEYVER$$
to a
target, which has EARLIEST TIMESTAMP
resolution support, DELETE
ALWAYS WINS
resolution, or SITE PRIORITY, will receive an error in cases
involving DELETE
or PK Update.
Replicating from a base table, which has a KEYVER$$
to a
target, which does not, will ignore the KEYVER$$
, when replicating to
an earlier release, then the field is dropped or is not supported).
Example
EARLIEST TIMESTAMP
resolution
on Site1 with no keyver$$
column or earlier RDBMS version
replication to Site 2Site 1 | Site 2 | Description |
---|---|---|
insert |
insert |
If the Site1
CDRTS$ timestamp is earlier then Site1
wins else Site2 wins
|
insert |
update |
Same as insert insert. |
insert |
delete |
Conflict cannot be resolved, depending on configuration, error goes to error queue, discard and so on. |
insert |
pkupdate |
Same as insert delete |
update |
insert |
Same as insert insert |
update |
update |
Same as insert insert |
update |
delete |
Same as insert delete |
update |
pkupdate |
Same as insert delete |
delete |
insert |
Same as insert delete |
delete |
update |
Same as insert delete |
pkupdate |
insert |
Same as insert delete |
pkupdate |
update |
Same as insert delete |
pkupdate |
delete |
Same as insert delete |
Primary Key Updates (pkupdate) interoperability will not resolve correctly without a backport. Besides the interoperability problems listed above, pkupdates that are replicated to earlier versions of the RDBMS, will not resolve correctly. A conflicting insert and replicated pkupdate on the earlier RDBMS may result in 2 rows. The insert will succeed to the original row and the pkupdate will succeed to update or create the new row.
No upgrage or downgrade scripts are needed because the changes are just to procedure attributes and view columns.
Column Groups
A column group is a logical grouping of one or more columns in a replicated table. When you add a column group, conflict detection and resolution is performed on the columns in the column group separately from the other columns in the table.
When you configure a table for Oracle GoldenGate conflict detection and resolution with the ADD_AUTO_CDR
procedure, all of the scalar columns in the table are added to a default column group. To define other column groups for the table, run the ADD_AUTO_CDR_COLUMN_GROUP
procedure. Any columns in the table that are not part of a user-defined column group remain in the default column group for the table.
Column groups enable different databases to update different columns in the same row at nearly the same time without causing a conflict. When column groups are configured for a table, conflicts can be avoided even if different databases update the same row in the table. A conflict is not detected if the updates change the values of columns in different column groups.
This example shows a row being replicated at database A and database B. The following two column groups are configured for the replicated table at each database:
-
One column group includes the
Office
column. The invisible timestamp column for this column group isTS1
. -
Another column group includes the
Title
andSalary
columns. The invisible timestamp column for this column group isTS2
.
These column groups enable database A and database B to update the same row at nearly the same time without causing a conflict. Specifically, the following changes are made:
-
At database A, the value of
Office
was changed from1080
to1030
. -
At database B, the value of
Title
was changed fromMTS1
toMTS2
.
Because the Office
column and the Title
column are in different column groups, the changes are replicated without a conflict being detected. The result is that values in the row are same at both databases after each change has been replicated.
Piecewise LOB Updates
A set of lob operations composed of LOB WRITE
, LOB ERASE
, and LOB TRIM
is a piecewise LOB update. When a table that contains LOB columns is configured for conflict detection and resolution, each LOB column is placed in its own column group, and the column group has its own hidden timestamp column. The timestamp column is updated on the first piecewise LOB operation.
For a LOB column, a conflict is detected and resolved in the following ways:
-
If the timestamp for the LOB’s column group is later than the corresponding LOB column group in the row, then the piecewise LOB update is applied.
-
If the timestamp for the LOB’s column group is earlier than the corresponding LOB column group in the row, then the LOB in the table row is retained.
-
If the row does not exist in the table, then an error occurs
DELETE TOMBSTONE Table
DELETE TOMBSTONE
table is a marker for a deleted record to
distinguish it from a record, which never existed. A DELETE TOMBSTONE
table contains at minimum the key columns and operation timestamp. This information is
required for delete convergence becasue some incoming updates and inserts may be delayed
from another site and the incoming LCR needs to be filtered against the tombstone
operation timestamp to determine whether it should be applied.
Earliest Timestamp Conflict Detection and Resolution
Columns with names of the form CDRTS$ column group
and
CDRTS$ROW
are used to contain timestamps that reflect modification
times for column groups and the row. The DBMS_GOLDENGATE_ADM
procedures
ADD_AUTO_CDR()
, ADD_AUTO_CDR_COLUMN_GROUP()
,
REMOVE_AUTO_CDR()
, REMOVE_AUTO_CDR_COLUMN_GROUP()
,
ALTER_AUTO_CDR()
, and
ALTER_AUTO_CDR_COLUMN_GROUP()
are presently used to configure ACDR
with latest timestamp resolution. They are also used in configuration of ACDR with
earliest timestamp resolution, The field ADDITIONAL_OPTIONS
in both
ADD_AUTO_CDR()
and ALTER_AUTO_CDR()
turn on the
use of earliest timestamp. Turning on earliest timestamp automatically turn on
versioning, which adds a new hidden column KEYVER$$
(version number) of
type timestamp. A new flag value is added to acdrflags_kqldtvc
to
indicate earliest timestamp usage. This field is also added to the DELETE
TOMBSTONE
table. Delete conflicts are the reason that version number is
needed. With an earliest timestamp resolution, delete conflicts, which can be
transparent, might not only incorrectly succeed, they might prevent new inserts of the
row (new versions). With a version timestamp, the delete can be correctly resolved
against a row DML for the same row version.
The original insert of the row receives the current timestamp from its default value. The delete of this row then inserts the version number and the time when this row was inserted, into the tombstone table when there is a delete. On a new insert, by default, the version number receives the current timestamp again, thereby avoiding a false conflict with the present delete entries in the tombstone table.
Example
For key version kv
and timestamp ts
Database 1: insert tab1 key1 kv1 ts1
Database 2: delete tab1 key1 kv1 ts1
Insertion to DELETE TOMBSTONE table key1 kv1 ts1
Database 1: insert tab1 key1 kv2 ts2
Without using the key version, the insert would be ignoreed, the delete timestamp is
earlier. As the key version is used, you know that kv2
is not the
version of the row that was deleted and the insert succeeds.
Latest Timestamp Conflict Detection and Resolution
When you run the ADD_AUTO_CDR
procedure in the DBMS_GOLDENGATE_ADM
package to configure a table for automatic Oracle GoldenGate conflict detection and resolution, a hidden timestamp column is added to the table. This hidden timestamp column records the time of a row change, and this information is used to detect and resolve conflicts.
When a row LCR is applied, a conflict can occur for an INSERT
, UPDATE
, or DELETE
operation. The following table describes each type of conflict and how it is resolved.
Operation | Conflict Detection | Conflict Resolution |
---|---|---|
|
A conflict is detected when the table has the same value for a key column as the new value in the row LCR. |
If the timestamp of the row LCR is later than the timestamp in the table row, then the values in the row LCR replace the values in the table. If the timestamp of the row LCR is earlier than the timestamp in the table row, then the row LCR is discarded, and the table values are retained. |
|
A conflict is detected in each of the following cases:
|
If there is a value mismatch and the timestamp of the row LCR is later than the timestamp in the table row, then the values in the row LCR replace the values in the table. If there is a value mismatch and the timestamp of the row LCR is earlier than the timestamp in the table row, then the row LCR is discarded, and the table values are retained. If the table row does not exist and the timestamp of the row LCR is later than the timestamp in the tombstone table row, then the row LCR is converted from an If the table row does not exist and the timestamp of the row LCR is earlier than the timestamp in the tombstone table row, then the row LCR is discarded. If the table row does not exist and there is no corresponding row in the tombstone table, then the row LCR is converted from an |
|
A conflict is detected in each of the following cases:
|
If the timestamp of the row LCR is later than the timestamp in the table, then delete the row from the table. If the timestamp of the row LCR is earlier than the timestamp in the table, then the row LCR is discarded, and the table values are retained. If the delete is successful, then log the row LCR by inserting it into the tombstone table. If the table row does not exist, then log the row LCR by inserting it into the tombstone table. |
Delete Always Wins Timestamp CDR
DELETE ALWAYS WINS
is enabled through the field
ADDITIONAL_OPTIONS
in both DBMS_GOLDENGATE_ADM
procedures ADD_AUTO_CDR()
and ALTER_AUTO_CDR()
. This
is again a delete conflict resolution method, which is not using latest timestamp
resolution, therefore, versioning is needed. Turning on DELETE ALWAYS
WINS
automatically turns on versioning, which adds a new hidden column
KEYVER$$
(version number) of type timestamp. A new flag value is
also added to acdrflags_kqldtvc
to indicate DELETE ALWAYS
WINS
usage. This field is also added to the DELETE
TOMBSTONE
table. The same versioning issues exist as the EARLIEST TIMESTAMP
resolution.
Exmaple:
Key Version kv
and Timestamp ts
Database 1: insert tab1 key1 kv1 ts1
Database 2: delete tab1 key1 kv1 ts1
Insertion to DELETE TOMBSTONE
table key1 kv1
ts1
Database 1: insert tab1 key1 kv2 ts2
Without using the key version, the insert would be ignored, the delete
always wins. As the key version is used, you know that kv2
is not
the version of the row that was deleted and the insert succeeds.
Delta Conflict Detection and Resolution
With delta conflict detection, a conflict occurs when a value in the old column list of the row LCR differs from the value for the corresponding row in the table.
To configure delta conflict detection and resolution for a table, run the ADD_AUTO_CDR_DELTA_RES
procedure in the DBMS_GOLDENGATE_ADM
package. The delta resolution method does not depend on a timestamp or an extra resolution column. With delta conflict resolution, the conflict is resolved by adding the difference between the new and old values in the row LCR to the value in the table. This resolution method is generally used for financial data such as an account balance. For example, if a bank balance is updated at two sites concurrently, then the converged value accounts for all debits and credits.
This example shows a row being replicated at database A and database B. The Balance
column is designated as the column on which delta conflict resolution is performed, and the TS1
column is the invisible timestamp column to track the time of each change to the Balance
column. A change is made to the Balance
value in the row in both databases at nearly the same time (@T20
in database A and @T22
in database B). These changes result in a conflict, and delta conflict resolution is used to resolve the conflict in the following way:
-
At database A, the value of
Balance
was changed from100
to110
. Therefore, the value was increased by 10. -
At database B, the value of
Balance
was changed from100
to120
. Therefore, the value was increased by 20. -
To resolve the conflict at database A, the value of the difference between the new and old values in the row LCR to the value in the table. The difference between the new and old values in the LCR is 20 (120–100=20). Therefore, the current value in the table (110) is increased by 20 so that the value after conflict resolution is 130.
-
To resolve the conflict at database B, the value of the difference between the new and old values in the row LCR to the value in the table. The difference between the new and old values in the LCR is 10 (110–100=10). Therefore, the current value in the table (120) is increased by 10 so that the value after conflict resolution is 130.
After delta conflict resolution, the value of the Balance
column is the same for the row at database A and database B.
Site Priority CDR
Note:
SITE PRIORITY
resolution takes precedence over all COLUMN GROUP
resolution settings.
Note:
IfSITE PRIORITY
Replicat parameter is not placed before applicable
map statements in the parameter file, it will not work. This parameter must be placed
before the applicable map statements.
Priority resolution specified in Replicat parameter file between source and target in conflict resolution.
SITE PRIORITY
is turned on for a database or PDB in the Replicat
parameter file with the parameter ACDR SITE_PRIORITY {source_db_name}{OVERWRITE
| IGNORE }
specified to turn on SITE PRIORITY
resolution
for a table. If OVERWRITE
is specified, then the source table has
priority and conflicts are resolved by OVERWRITE
. Conversely, if
IGNORE
is specified, then the target table has priority and source
table change are ignored in a conflict. SITE PRIORITY
resolution can be
turned off by the field ADDITIONAL_OPTIONS
in both
DBMS_GOLDENGATE_ADM
procedure ADD_AUTO_CDR()
and
ALTER_AUTO_CDR()
setting the bit
IGNORE_SITE_PRIORITY
. Every Replicat source-target relationship can
be set up differently, therefore, convergence is dependent on user setup.
Track PK Updates in Delete Tombstone
Full support of primary key (PK) updates requires handling conflicts on both the rows represented by the before image of the key and the row represented by the after image of the key. A PK update is an autonomous delete and insert, so, the PK update conflicts must be supported as a delete for conflicts with the before image of the key and inserts with the after image of the key (and row).
Supporting the PK update as a delete of the row represented by the before image of the key means that it should insert into the delete tombstone table as a delete. An update internal trigger is added to insert into the tombstone table when the PK is updated (actually the row identifying key, either the PK if it exists or the chosen UK with at least one non-nullable column). As a PK update may lead to two conflicts, up to two resolutions are attempted at the row level, delete of the row with the original PK and the insert of the row with the new PK.
Example: Using latest timestamp resolution
Database 1: Update to tab1 key1 at ts1
Database 2: Update to tab1 key1 set key1 to key2 ts2
Database 3: Update to tab1 key2 ts3
In this scenario, it appears that at the row level tab1
row with key1
should be deleted and the database 3 update should be
the final modification of tab1
row key2. If instead the database 2
is at ts3
and database 3 is at ts3
, then the PK
update at database 2 would be the final modification of tab1
row
key2
.
Now, consider a case where the database 1 was at ts3
,
database 2 at ts2
and database 3 at ts1
, then the
update to tab1
row key1
on database 1 should
succeed and the PK update from database 2 on tab1
row
key2
should succeed. At this point, it looks like the complete
resolution is that both the delete at the before image and the insert at the after
image must be resolved separately. This implies that they are not dependent on each
other and a loss for one, is not a loss for both.
Configuring Delta Conflict Detection and Resolution
The ADD_AUTO_CDR_DELTA_RES
procedure in the
DBMS_GOLDENGATE_ADM
package configures delta conflict detection and
resolution.
With delta conflict resolution, you specify one column for which conflicts are detected and resolved. The conflict is detected if the value of the column in the row LCR does not match the corresponding value in the table. The conflict is resolved by adding the difference between the new and old values in the row LCR to the value in the table.
GRANT_ADMIN_PRIVILEGE
procedure in the DBMS_GOLDENGATE_ADM
package.
- Connect to the inbound server database as an Oracle GoldenGate administrator.
- Run the
ADD_AUTO_CDR
procedure and specify the table to configure for latest timestamp conflict detection and resolution. - Run the
ADD_AUTO_CDR_DELTA_RES
procedure and specify the column on which delta conflict detection and resolution is performed. - Repeat the previous steps in each Oracle Database that replicates the table.
Example 11-21 Configuring Delta Conflict Detection and Resolution for a Table
This example configures delta conflict detection and resolution for the order_total
column in the oe.orders
table.
BEGIN
DBMS_GOLDENGATE_ADM.ADD_AUTO_CDR(
SCHEMA_NAME => 'OE',
TABLE_NAME => 'ORDERS');
END;
/
BEGIN
DBMS_GOLDENGATE_ADM.ADD_AUTO_CDR_DELTA_RES(
SCHEMA_NAME => 'OE',
TABLE_NAME => 'ORDERS',
COLUMN_NAME => 'ORDER_TOTAL');
END;
/
Configuring Latest Timestamp Conflict Detection and Resolution
The ADD_AUTO_CDR
procedure in the DBMS_GOLDENGATE_ADM
package configures latest timestamp conflict detection and resolution. The
ADD_AUTO_CDR_COLUMN_GROUP
procedure adds optional column groups.
With latest timestamp conflict detection and resolution, a conflict is detected when the
timestamp column of the row LCR does not match the timestamp of the corresponding table row.
The row LCR is applied if its timestamp is later. Otherwise, the row LCR is discarded, and
the table row is not changed. When you run the ADD_AUTO_CDR
procedure, it
adds an invisible timestamp column for each row in the specified table and configures
timestamp conflict detection and resolution. When you use the
ADD_AUTO_CDR_COLUMN_GROUP
procedure to add one or more column groups, it
adds a timestamp for the column group and configures timestamp conflict detection and
resolution for the column group.
GRANT_ADMIN_PRIVILEGE
procedure in the DBMS_GOLDENGATE_ADM
package.
- Connect to the inbound server database as a Oracle GoldenGate administrator.
- Run the
ADD_AUTO_CDR
procedure and specify the table to configure for latest timestamp conflict detection and resolution. - Optional: Run the
ADD_AUTO_CDR_COLUMN_GROUP
procedure and specify one or more column groups in the table. - Repeat the previous steps in each Oracle Database that replicates the table.
Example 11-22 Configuring the Latest Timestamp Conflict Detection and Resolution for a Table
This example configures latest timestamp conflict detection and resolution for
the hr.employees
table.
BEGIN
DBMS_GOLDENGATE_ADM.ADD_AUTO_CDR(
schema_name => 'hr',
table_name => 'employees');
END;
/
Example 11-23 Configuring Column Groups
This example configures the following column groups for timestamp conflict
resolution on the hr.employees
table:
-
The
job_identifier_cg
column group includes thejob_id
,department_id
, andmanager_id
columns. -
The
compensation_cg
column group includes thesalary
andcommission_pct
columns.
BEGIN
DBMS_GOLDENGATE_ADM.ADD_AUTO_CDR_COLUMN_GROUP(
schema_name => 'hr',
table_name => 'employees',
column_list => 'job_id,department_id,manager_id',
column_group_name => 'job_identifier_cg');
END;
/
BEGIN
DBMS_GOLDENGATE_ADM.ADD_AUTO_CDR_COLUMN_GROUP(
schema_name => 'hr',
table_name => 'employees',
column_list => 'salary,commission_pct',
column_group_name => 'compensation_cg');
END;
/
Configuring Delta Conflict Detection and Resolution
The ADD_AUTO_CDR_DELTA_RES
procedure in the
DBMS_GOLDENGATE_ADM
package configures delta conflict detection and
resolution.
With delta conflict resolution, you specify one column for which conflicts are detected and resolved. The conflict is detected if the value of the column in the row LCR does not match the corresponding value in the table. The conflict is resolved by adding the difference between the new and old values in the row LCR to the value in the table.
GRANT_ADMIN_PRIVILEGE
procedure in the DBMS_GOLDENGATE_ADM
package.
- Connect to the inbound server database as an Oracle GoldenGate administrator.
- Run the
ADD_AUTO_CDR
procedure and specify the table to configure for latest timestamp conflict detection and resolution. - Run the
ADD_AUTO_CDR_DELTA_RES
procedure and specify the column on which delta conflict detection and resolution is performed. - Repeat the previous steps in each Oracle Database that replicates the table.
Example 11-24 Configuring Delta Conflict Detection and Resolution for a Table
This example configures delta conflict detection and resolution for the order_total
column in the oe.orders
table.
BEGIN
DBMS_GOLDENGATE_ADM.ADD_AUTO_CDR(
SCHEMA_NAME => 'OE',
TABLE_NAME => 'ORDERS');
END;
/
BEGIN
DBMS_GOLDENGATE_ADM.ADD_AUTO_CDR_DELTA_RES(
SCHEMA_NAME => 'OE',
TABLE_NAME => 'ORDERS',
COLUMN_NAME => 'ORDER_TOTAL');
END;
/
Managing Automatic Conflict Detection and Resolution
You can manage Oracle GoldenGate automatic
conflict detection and resolution in Oracle Database with the
DBMS_GOLDENGATE_ADM
package.
Altering Conflict Detection and Resolution for a Table
ALTER_AUTO_CDR
procedure in the DBMS_GOLDENGATE_ADM
package alters conflict detection and resolution for a table.
- Connect to the inbound server database as the Oracle GoldenGate administrator.
- Run the
ALTER_AUTO_CDR
procedure and specify the table to configure for latest timestamp conflict detection and resolution. - Repeat all of the previous steps in each Oracle Database that replicates the table.
Example 11-25 Altering Conflict Detection and Resolution for a Table
This example alters conflict detection and resolution for the
HR.EMPLOYEES
table to specify that delete conflicts are tracked in a
tombstone table.
BEGIN
DBMS_GOLDENGATE_ADM.ALTER_AUTO_CDR(
SCHEMA_NAME => 'HR',
TABLE_NAME => 'EMPLOYEES',
TOMBSTONE_DELETES => TRUE);
END;
/
Altering a Column Group
ALTER_AUTO_CDR_COLUMN_GROUP
procedure alters a column group.
- Connect to the inbound server database as an Oracle GoldenGate administrator.
- Run the
ALTER_AUTO_CDR_COLUMN_GROUP
procedure and specify one or more column groups in the table. - Repeat all of the previous steps in each Oracle Database that replicates the table.
Example 11-26 Altering a Column Group
This example removes the MANAGER_ID
column from the
JOB_IDENTIFIER_CG
column group for the HR.EMPLOYEES
table.
BEGIN
DBMS_GOLDENGATE_ADM.ALTER_AUTO_CDR_COLUMN_GROUP(
SCHEMA_NAME => 'HR',
TABLE_NAME => 'EMPLOYEES',
COLUMN_GROUP_NAME => 'JOB_IDENTIFIER_CG',
REMOVE_COLUMN_LIST => 'MANAGER_ID');
END;
/
Note:
If there is more than one column, then use a comma-separated list.Purging Tombstone Rows
PURGE_TOMBSTONES
procedure removes tombstone rows that were recorded before a specified date and time. This procedure removes the tombstone rows for all tables configured for conflict resolution in the database.
- Connect to the inbound server database as an Oracle GoldenGate administrator.
- Run the
PURGE_TOMBSTONES
procedure and specify the date and time.
Example 11-27 Purging Tombstone Rows
This example purges all tombstone rows recorded before 3:00 p.m. on December, 1, 2015 Eastern Standard Time. The timestamp must be entered in TIMESTAMP WITH TIME ZONE
format.
EXEC DBMS_GOLDENGATE_ADM.PURGE_TOMBSTONES('2015-12-01 15:00:00.000000 EST');
Removing Conflict Detection and Resolution From a Table
REMOVE_AUTO_CDR
procedure in the
DBMS_GOLDENGATE_ADM
package removes automatic conflict detection and
resolution from a table. This procedure also removes any column groups and delta conflict
detection and resolution configured for the table.
- Connect to the inbound server database as an Oracle GoldenGate administrator.
- Run the
REMOVE_AUTO_CDR
procedure and specify the table. - Repeat all of the previous steps in each Oracle Database that replicates the table.
Example 11-28 Removing Conflict Detection and Resolution for a Table
This example removes conflict detection and resolution for the
hr.employees
table.
BEGIN
DBMS_GOLDENGATE_ADM.REMOVE_AUTO_CDR(
schema_name => 'hr',
table_name => 'employees');
END;
/
Removing a Column Group
REMOVE_AUTO_CDR_COLUMN_GROUP
procedure removes a
column group.
- Connect to the inbound server database as an Oracle GoldenGate administrator.
- Run the
REMOVE_AUTO_CDR_COLUMN_GROUP
procedure and specify the name of the column group. - Repeat all of the previous steps in each Oracle Database that replicates the table.
Example 11-29 Removing a Column Group
This example removes the compensation_cg
column group from the
hr.employees
table.
BEGIN
DBMS_GOLDENGATE_ADM.REMOVE_AUTO_CDR_COLUMN_GROUP(
schema_name => 'hr',
table_name => 'employees',
column_group_name => 'compensation_cg');
END;
/
Removing Delta Conflict Detection and Resolution
REMOVE_AUTO_CDR_DELTA_RES
procedure in the DBMS_GOLDENGATE_ADM
package removes delta conflict detection and resolution for a column.
- Connect to the inbound server database as an Oracle GoldenGate administrator.
- Run the
REMOVE_AUTO_CDR_DELTA_RES
procedure and specify the column. - Repeat all of the previous steps in each Oracle Database that replicates the table.
Example 11-30 Removing Delta Conflict Detection and Resolution for a Table
This example removes delta conflict detection and resolution for the
ORDER_TOTAL
column in the OE.ORDERS
table.
BEGIN
DBMS_GOLDENGATE_ADM.REMOVE_AUTO_CDR_DELTA_RES(
SCHEMA_NAME => 'OE',
TABLE_NAME => 'ORDERS',
COLUMN_NAME => 'ORDER_TOTAL');
END;
/
Monitoring Automatic Conflict Detection and Resolution
You can monitor Oracle GoldenGate automatic conflict detection and resolution in an Oracle Database by querying data dictionary views.
Displaying Information About the Tables Configured for Conflicts
ALL_GG_AUTO_CDR_TABLES
view displays information about the tables configured for Oracle GoldenGate automatic conflict detection and resolution.
- Connect to the database.
- Query the
ALL_GG_AUTO_CDR_TABLES
view.
Example 11-31 Displaying Information About the Tables Configured for Conflict Detection and Resolution
This query displays the following information about the tables that are configured for conflict detection and resolution:
-
The table owner for each table.
-
The table name for each table.
-
The tombstone table used to store rows deleted for update-delete conflicts, if a tombstone table is configured for the table.
-
The hidden timestamp column used for conflict resolution for each table.
COLUMN TABLE_OWNER FORMAT A15
COLUMN TABLE_NAME FORMAT A15
COLUMN TOMBSTONE_TABLE FORMAT A15
COLUMN ROW_RESOLUTION_COLUMN FORMAT A25
SELECT TABLE_OWNER,
TABLE_NAME,
TOMBSTONE_TABLE,
ROW_RESOLUTION_COLUMN
FROM ALL_GG_AUTO_CDR_TABLES
ORDER BY TABLE_OWNER, TABLE_NAME;
Your output looks similar to the following:
TABLE_OWNER TABLE_NAME TOMBSTONE_TABLE ROW_RESOLUTION_COLUMN
--------------- --------------- --------------- -------------------------
HR EMPLOYEES DT$_EMPLOYEES CDRTS$ROW
OE ORDERS DT$_ORDERS CDRTS$ROW
Displaying Information About Conflict Resolution Columns
ALL_GG_AUTO_CDR_COLUMNS
view displays information about the columns configured for Oracle GoldenGate automatic conflict detection and resolution.
- Connect to the database as an Oracle GoldenGate administrator.
- Query the
ALL_GG_AUTO_CDR_COLUMNS
view.
Example 11-32 Displaying Information About Column Groups
This query displays the following information about the tables that are configured for conflict detection and resolution:
-
The table owner for each table.
-
The table name for each table.
-
If the column is in a column group, then the name of the column group.
-
The column name.
-
If the column is configured for latest timestamp conflict resolution, then the name of the hidden timestamp column for the column.
COLUMN TABLE_OWNER FORMAT A10
COLUMN TABLE_NAME FORMAT A10
COLUMN COLUMN_GROUP_NAME FORMAT A17
COLUMN COLUMN_NAME FORMAT A15
COLUMN RESOLUTION_COLUMN FORMAT A23
SELECT TABLE_OWNER,
TABLE_NAME,
COLUMN_GROUP_NAME,
COLUMN_NAME,
RESOLUTION_COLUMN
FROM ALL_GG_AUTO_CDR_COLUMNS
ORDER BY TABLE_OWNER, TABLE_NAME;
Your output looks similar to the following:
TABLE_OWNE TABLE_NAME COLUMN_GROUP_NAME COLUMN_NAME RESOLUTION_COLUMN
---------- ---------- ----------------- --------------- -----------------------
HR EMPLOYEES COMPENSATION_CG COMMISSION_PCT CDRTS$COMPENSATION_CG
HR EMPLOYEES COMPENSATION_CG SALARY CDRTS$COMPENSATION_CG
HR EMPLOYEES JOB_IDENTIFIER_CG MANAGER_ID CDRTS$JOB_IDENTIFIER_CG
HR EMPLOYEES JOB_IDENTIFIER_CG JOB_ID CDRTS$JOB_IDENTIFIER_CG
HR EMPLOYEES JOB_IDENTIFIER_CG DEPARTMENT_ID CDRTS$JOB_IDENTIFIER_CG
HR EMPLOYEES IMPLICIT_COLUMNS$ PHONE_NUMBER CDRTS$ROW
HR EMPLOYEES IMPLICIT_COLUMNS$ LAST_NAME CDRTS$ROW
HR EMPLOYEES IMPLICIT_COLUMNS$ HIRE_DATE CDRTS$ROW
HR EMPLOYEES IMPLICIT_COLUMNS$ FIRST_NAME CDRTS$ROW
HR EMPLOYEES IMPLICIT_COLUMNS$ EMAIL CDRTS$ROW
HR EMPLOYEES IMPLICIT_COLUMNS$ EMPLOYEE_ID CDRTS$ROW
OE ORDERS IMPLICIT_COLUMNS$ ORDER_MODE CDRTS$ROW
OE ORDERS IMPLICIT_COLUMNS$ ORDER_ID CDRTS$ROW
OE ORDERS IMPLICIT_COLUMNS$ ORDER_DATE CDRTS$ROW
OE ORDERS IMPLICIT_COLUMNS$ CUSTOMER_ID CDRTS$ROW
OE ORDERS DELTA$ ORDER_TOTAL
OE ORDERS IMPLICIT_COLUMNS$ PROMOTION_ID CDRTS$ROW
OE ORDERS IMPLICIT_COLUMNS$ ORDER_STATUS CDRTS$ROW
OE ORDERS IMPLICIT_COLUMNS$ SALES_REP_ID CDRTS$ROW
In this example, the columns with IMPLICIT_COLUMNS$
for the column group name are configured for row conflict detection and resolution, but they are not part of a column group. The columns with DELTA$
for the column group name are configured for delta conflict detection and resolution, and these columns do not have a resolution column.
Displaying Information About Column Groups
ALL_GG_AUTO_CDR_COLUMN_GROUPS
view displays information about the column groups configured for Oracle GoldenGate automatic conflict detection and resolution.
ADD_AUTO_CDR
procedure in the DBMS_GOLDENGATE_ADM
package. You can configure column groups using the ADD_AUTO_CDR_COLUMN_GROUP
procedure in the DBMS_GOLDENGATE_ADM
package.
- Connect to the database as an Oracle GoldenGate administrator.
- Query the
ALL_GG_AUTO_CDR_COLUMN_GROUPS
view.
Example 11-33 Displaying Information About Column Groups
This query displays the following information about the tables that are configured for conflict detection and resolution:
-
The table owner.
-
The table name.
-
The name of the column group.
-
The hidden timestamp column used for conflict resolution for each column group.
COLUMN TABLE_OWNER FORMAT A15
COLUMN TABLE_NAME FORMAT A15
COLUMN COLUMN_GROUP_NAME FORMAT A20
COLUMN RESOLUTION_COLUMN FORMAT A25
SELECT TABLE_OWNER,
TABLE_NAME,
COLUMN_GROUP_NAME,
RESOLUTION_COLUMN
FROM ALL_GG_AUTO_CDR_COLUMN_GROUPS
ORDER BY TABLE_OWNER, TABLE_NAME;
The output looks similar to the following:
TABLE_OWNER TABLE_NAME COLUMN_GROUP_NAME RESOLUTION_COLUMN
--------------- --------------- -------------------- -------------------------
HR EMPLOYEES COMPENSATION_CG CDRTS$COMPENSATION_CG
HR EMPLOYEES JOB_IDENTIFIER_CG CDRTS$JOB_IDENTIFIER_CG