Oracle7 Server Distributed Systems Volume II: Replicated Data

Contents Index Home Previous Next

Using an Alternate Primary Key

If you are using row-level replication, Oracle must know which rows to compare when you push changes from one site to another. Because two rows may have different row IDs at different replication sites, Oracle uses the primary key for a table to determine which rows to compare. If you do not want to use the primary key for a table, or if the table does not have a primary key, you must call the SET_COLUMNS procedure in the DBMS_REPCAT package, as shown in the following example:

DBMS_REPCAT.SET_COLUMNS(
    sname       => 'acct_rec', 
    oname       => 'emp', 
    column_list => 'emp_no,ename');

In this example, both the employee number and the employee name are used to determine matching rows when pushing changes between replicated copies of the EMP table.

Because this key is used to determine matching rows at different sites, the columns that you specify in the COLUMN_LIST must result in a unique identifier for the row. The SET_COLUMNS procedure does not enforce uniqueness. This key is used as a substitute for the primary key for comparing replicated rows only, and is not a general substitute for defining a primary key constraint on a table.

Additional Information: The parameters for the SET_COLUMNS procedure are described in Table 12 - 167, and the exceptions are listed in Table 12 - 168.


Contents Index Home Previous Next