Reviewing replication conflicts

Occasionally the same entity or link is updated or deleted by users in different databases in such a way that a conflict occurs between the different versions of the record. Such conflicts are automatically resolved by SQL Server when they are merged in the publication database. The conflict is automatically resolved either in favor of the change that is made at the Publisher or, if the changes were made in two subscription databases, in favor of the first version to merge with the Publisher.

About this task

It is important to check for and review any conflicts regularly. To begin with, a suitable interval might be hourly, then when you know how frequently conflicts occur you can adjust the interval, for example, to once a day.

Working in the publication database, you use the Conflict Viewer to review how the conflicts were resolved by SQL Server. If required, you can change the outcome of the conflict and even edit the record to combine information from the different versions. When you complete the review by clicking Apply, any changes to the outcome of the conflict are replicated to the other sites to produce a consistent view of the data across all the sites. If there are links involved, changing the outcome of the conflict can also restore or delete links depending on the type of conflict.

How the conflicts are displayed

In the Conflict Viewer, the tree view lists the entity and link types for which there are conflicts. To obtain a breakdown by type, expand the items in the tree view, and then click an entity or link type to list the actual conflicts. This record will be a modification unless DELETED or RESOLVED appears in the record label. The tree view always lists the winning version of the record. The shortcut menu that is available by right-clicking on each record, applies only to the winning version.

The Conflict Viewer does not display the total number of broken links until you click Broken Links or review the last conflict. This is because it might take some time to calculate which links are affected by the conflicts or broken as a result of changing the outcome of the conflicts.

Click Refresh or press the F5 key to update the list with any recent conflicts and to remove any resolved ones.

Procedure

To review conflicts:
  1. Select Tools > Replication > Conflict Viewer.
    Note: The Replication menu is only available when the database is initialized for replication, and you log on as a database or system administrator.
  2. In the tree view, click a conflict.
  3. Compare the two versions of the entity or link. The version that won when the conflict was automatically resolved is displayed as the winner, and the differences between the two versions are highlighted. To make it easier to identify the differences, turn on Show Conflicting Fields Only.

    If any links are going to be deleted or restored as a result of this conflict between entities, Link(s) Affected appears.

    The table below each version of the record shows additional information:

    OptionDescription
    Field Description
    Record identifier Double-click the identifier to display the winning record (you can never display the losing record). The identifier is the same for both the winning and losing versions of the record.
    Created Double-click to display the contact details for the user who originally added the record.
    Last Updated The Last Updated field is different in each version. It shows the date, time, and user who made the change or deletion. Double-click to display the user's contact details.
    Description Double-click to display a message about the databases in which the conflicting change was made. The format of the database name is: <SQL Server name>\<SQL Server instance name>\<database name>.
  4. Resolve the conflict:
    • If you are satisfied that the conflict was resolved correctly, click Apply below the Winner area.
    • If the conflict was resolved incorrectly, click Apply below the Loser area. You will therefore resolve the conflict in favor of the version displayed in the Loser area.
    • To edit either version before resolving the issue, click Edit below the version that you want to modify and then make the required changes.
    Note: Although you can change any of the entity or link details, you cannot change the link end entities, and you cannot edit a version of the record that is set to be deleted.
  5. Click Apply.
    • The preferred version of the record is replicated to all the subscription databases.
    • The rejected version of the record is permanently deleted in the publication database.

What to do next

Depending on the type of conflict, a broken link may be detected by the Conflict Viewer if someone adds a link to an entity that is deleted at a different site. The broken link feature enables you to view and then fix the problem by either restoring the link end entities or removing the broken link. Anything that is removed will be soft-deleted rather than purged. Fixing a broken link may also fix other related broken links.

To check for broken links, click on Broken Links in the tree view.

To fix any broken links that are found:

  1. In the tree view, click on the broken link and then examine its details. You need to decide whether to delete the broken link or whether to keep it which will mean restoring the link end entity. You can use the commands on the shortcut menu to investigate the records further. You cannot edit any information for a broken link.
  2. Click:
    • Remove to soft delete the broken link and leave the link end entities unchanged.
    • Restore to restore any deleted link end entities so that the link is no longer broken.

If you want to leave this broken link until later, click a different broken link in the tree view.