Primary Key Settings for Mirroring and Synchronization
For transaction-based replications (mirroring and synchronization), it is critical to be able to uniquely identify records in the source and target databases, before performing UPDATE and DELETE operations during replication. Database applications typically make use of primary keys to uniquely identify records.
Syniti Replicatecan use primary keys that have been previously set in the source and target databases to identify records during replication. It is also possible to create primary keys within the Syniti Replicateenvironment for use only during replications. Therefore, if you have no primary key set in the database, you can create one within Syniti Replicate, or, if you have set a primary key in the database, you can override the primary key setting by creating a key within Syniti Replicate.
NOTE: If you choose to set one or more table columns as primary key in Syniti Replicate, it is critical that each record contains a unique value. If the values are not unique for each record, the results of any replication using the table are unpredictable. The primary key columns defined in Syniti Replicateare used to match source and target records based on their values. Syniti Replicatedoes not enforce primary key constraints internally, and is not able to determine whether a transaction will be applied to multiple records or whether it will generate duplicate values.
When you create a source or target connection and display a table in
the Management Center, any primary key that is defined in the database
is displayed with a key icon to the left of the row name. In the example
below, the Customers table has
a primary key set on the CustomerID column.
To create a primary key:
-
In the Metadata Explorer, select the source or target table for which you want to create a key.
-
From the right mouse button menu, choose Set Primary Key to open the Define Primary Key dialog.
In the Fields column of the Define Primary Key dialog, there is a list of fields eligible to be primary keys. The Keys column of the dialog shows any primary keys that have already been set. If a primary key is set in the database, it is displayed in the Keys column of the dialog. -
To add a new primary key, select a field name in the Fields column, then click the right-facing arrow to move the field into the Keys column of the dialog. You can use any number of fields (to the limit set by the database you are using) to create a primary key, as long as they can uniquely identify any record.
-
To remove an existing primary key, select the field name in the Keys column, then click the left-facing arrow to move the field into the Fields column of the dialog.
-
When you have set the primary key to your liking, click OK in the Define Primary Key dialog.
Related Topics
Define Primary Key Dialog
Using a Relative Record Number to Identify a Record