Oracle7 Server Distributed Systems Volume II: Replicated Data

Contents Index Home Previous Next

Detecting Conflicts

When you propagate changes in a replicated environment by pushing the deferred transaction queue, Oracle's symmetric replication facility calls a remote procedure in the generated package at the receiving site. Oracle uses the remote procedure to detect conflicts, if any. If, for example, two sites modify the same row before propagating their updates to each other, a conflict occurs. (If you have set up a conflict resolution method, Oracle attempts to resolve the conflict.)

For each changed row, Oracle forwards

Note: If you are inserting a row, it has no old value. If you are deleting a row, it has no new value.

As shown in Figure 6 - 1, Oracle at the receiving site compares the old and current values of the row. Oracle detects a conflict if there are any differences between these values for any column in the row.

Note: Because a row can have different ROWIDs at different sites, Oracle uses the row's primary key to determine which rows to compare. If you do not want to use the primary key, designate one or more different columns by calling DBMS_REPCAT.SET_COLUMNS, as described [*].

Figure 6 - 1. Detecting Conflicts

If the procedure at the receiving site detects no conflict, the server at the receiving site writes the new value(s).

If a conflict is detected, Oracle applies the appropriate conflict resolution routine, if one is available. Any unresolved conflicts are logged in the DefError view at the receiving site.

When you replicate a table using row-level replication, you can designate one or more conflict resolution methods. Oracle applies these methods in the priority order you define until the conflict is resolved, or no more routines are available.

Note: For procedural replication, you must supply a conflict resolution method as part of your replicated procedure.

Types of Conflicts

The three types of conflicts that the symmetric replication facility detects are

The procedures at the receiving site detect an update conflict if there is any difference between the old values of the replicated row and the current values of the same row at the receiving site.

A uniqueness conflict is detected if a unique constraint is violated during an INSERT or UPDATE of the replicated row.

A delete conflict is detected if you change a row at a remote site after you delete that row from the local site. The delete conflict occurs because the old values of the deleted row at the local site do not match the current values of the same row at the remote site.

Warning: Because the primary key is used to determine which rows to compare, allowing modifications to the primary key is extremely risky to the integrity of your data.


Contents Index Home Previous Next