Valid for
Replicat
Description
Use HANDLECOLLISIONS
to overlay duplicate records into the target database and ignore missing record errors.
If your installation collects data from several sources to update the same record on the same target, data can be lost. Ideally, applications should ensure that each source file manages a specific range of keys. If this is not the case, there can be conflicts on the target. For example, if two source tables receive an insert with the same key, both operations cannot be applied at the target because a duplicate error results.
Replicat supplies the HANDLECOLLISIONS
parameter to overlay duplicate records with the latest version of the record, even if they key exists. HANDLECOLLISIONS
ignores missing update and delete conditions.
HANDLECOLLISIONS
is especially useful during the initial load of a target table while the source table remains online. In this phase, the following steps occur:
Processing initial data to the target. When the source database remains online, this step will not read everything. Step 1 begins at time 0.
Extracting changes that occurred since the beginning of Step 1. Step 2 begins at time 0.
After Step 1 completes (time 1), processing of changes extracted in Step 2 (finishes at time 2).
In Step 3, duplicate errors are possible because both Step 1 and Step 2 may extract the same insert records (which occurred since time 0). In such cases, you can use the change record. While you could ignore the duplicate, overlaying the change is safer from an operational standpoint.
There may be instances of missing records when an update or delete operation is attempted on the target table. This is considered normal, since the following chain of events may have occurred:
Update of record A
in source table.
Delete of record A
in source table.
Extracting update A
by Extract process (Step 2).
Initial-load extraction (Step 1) sees no trace of A
, therefore A
never inserted into target by initial-load processing.
Replicating update A
attempted in Step 3, but record is missing. Delete of A
will result in a missing record error as well.
When all changes have been extracted and applied (time 2), HANDLECOLLLIONS
is no longer required. Turn off HANDLECOLLISIONS
while Replicat remains online with the GGSCI SEND REPLICAT NOHANDLECOLLISIONS
command.
HANDLECOLLISIONS
can also be turned off by including NOHANDLECOLLISIONS
in the parameter file.
Default
NOHANDLECOLLISIONS
Syntax
HANDLECOLLISIONS | NOHANDLECOLLISIONS
Example
The following turns HANDLECOLLISIONS
on for TARGET1
and off for TARGET2
.
HANDLECOLLISIONS MAP $DATA1.DAT.SOURCE1, TARGET $DATA2.DAT.TARGET1; NOHANDLECOLLISIONS MAP $DATA1.DAT.SOURCE2, TARGET $DATA2.DAT.TARGET2;