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