Synchronizing Data Among Multiple Tables

Prev Next

In the simplest cases, replication is between two tables, a source table and a target table. The replication can be achieved via a full snapshot from the source table to the target table, or via change data capture where only changed data is replicated from the source to the target. Replication can also be two-way between source and target, where changes are expected on both systems, and both systems need to stay synchronized.

In more complex cases, data in tables on several systems needs to stay synchronized. Follow the steps below to synchronize data among more than two tables.

  1. Set up a synchronization replication between the first two tables.

  2. In the Replication wizard, be sure to add the replication to a group, creating a new group as needed.

  3. Use the Replication wizard to set up an additional replication in the same group, between the source table you specified above and an additional "target" table.

  4. Continue to set up replications as in step 3 for all the remaining tables to be synchronized.

  5. Make sure that all replications involved in the multi-table synchronization are in the same group.

Editing Replication Properties

Note that if you edit replication properties for any replication in the group, it is best to do it from the group menu.

  1. In the Metadata Explorer, select the group.

  2. From the right mouse button menu, choose Edit Replications.

  3. In the Replication Properties dialog, use the Replication drop-down list to select the replication to edit, or choose All Replications to make changes that affect all replications in the group.

Resolving Conflicts During Replication

Syniti Replicateprovides a default conflict resolution strategy for situations where multiple changes to the same field are detected: SourceServerWins. There are four additional options that can be set in the Replication Properties dialog:

  • TargetServerWins: Changes applied to the tables defined in the target connections are also applied to the table defined in the source connection, overriding any changes that have occurred in the source connection table. This option also requires you to set a priority for the target tables involved so that, if changes occur in more than one target table, Syniti Replicatecan determine which changed value to use. Set the priority for target connections as follows.

    1. In the Metadata Explorer, select the group.

    2. From the right mouse button menu, choose Group Properties.

    3. In the Group Properties dialog, go to the Preferences tab.

    4. Click in the Conflict Resolver Priority field to view the target connections.

    5. Order the target connections by selecting the connection, then using the up and down arrows to determine its priority.

  • FirstComeWins: The timestamps of the changes in the tables designated as source and target are compared and the change that applied earliest is applied to all tables.

  • LastComeWins: The timestamps of the changes in the tables designated as source and target are compared and the change that applied last is applied to all tables.

  • Use Script: This option generates an event that can be handled by writing a function Replication_onConflict. The script editor can be accessed from the General Tab Use Script option. You can write a function that handles the values from each table in any way you wish using VB .NET.