Article ID: 326483 - Last Review: October 11, 2005 - Revision: 1.6

FIX: The Merge Agent incorrectly deletes rows after a primary key violation occurs

Hotfix download is availableHotfix Download Available
View and request hotfix downloads
This article was previously published under Q326483
BUG #: 361118 (SQL Server 8.0)

On This Page

Expand all | Collapse all

SYMPTOMS

In a merge replication environment, a row is missing at the publisher at and all the subscribers.

Additionally, two rows that have the same primary key value exist in the conflict table for the article. For example, the conflict table for the article contains text that is similar to the following:
Primary Key    Reason_Code  Conflict_Type   Reason_Text
 1             2627         6               The row was inserted at 'publisher' but could not be inserted at 'subscriber'. Violation of PRIMARY KEY constraint 'pkey_constraint'. Cannot insert duplicate key in object 'Article'.

Primary Key    Reason_Code  Conflict_Type   Reason_Text
 1             2627         5               The row was inserted at 'subscriber' but could not be inserted at 'publisher'. Violation of PRIMARY KEY constraint 'pkey_constraint'. Cannot insert duplicate key in object 'Article'.
				

CAUSE

During the download phase of the Merge Agent execution, the INSERT statement for the missing row is run before the compensating DELETE statement is run for the primary key violation.

RESOLUTION

Service pack information

To resolve this problem, obtain the latest service pack for Microsoft SQL Server 2000. For additional information, click the following article number to view the article in the Microsoft Knowledge Base:
290211  (http://support.microsoft.com/kb/290211/ ) How to obtain the latest SQL Server 2000 service pack

Hotfix information

Note The following hotfix was created before the release of Microsoft SQL Server 2000 Service Pack 3.

Note You must install SQL Server 2000 SP2 before you apply this hotfix.

A supported hotfix is available from Microsoft. However, this hotfix is intended to correct only the problem that is described in this article. Apply this hotfix only to systems that are experiencing this specific problem.

If the hotfix is available for download, there is a "Hotfix download available" section at the top of this Knowledge Base article. If this section does not appear, submit a request to Microsoft Customer Service and Support to obtain the hotfix.

Note If additional issues occur or if any troubleshooting is required, you might have to create a separate service request. The usual support costs will apply to additional support questions and issues that do not qualify for this specific hotfix. For a complete list of Microsoft Customer Service and Support telephone numbers or to create a separate service request, visit the following Microsoft Web site:
http://support.microsoft.com/contactus/?ws=support (http://support.microsoft.com/contactus/?ws=support)
Note The "Hotfix download available" form displays the languages for which the hotfix is available. If you do not see your language, it is because a hotfix is not available for that language.

The English version of this hotfix has the file attributes (or later file attributes) that are listed in the following table. The dates and times for these files are listed in coordinated universal time (UTC). When you view the file information, it is converted to local time. To find the difference between UTC and local time, use the Time Zone tab in the Date and Time tool in Control Panel.
   Date         Time     Size          File name
   -------------------------------------------------
   12-Jul-2002  22:28    32,580 bytes  Qfe359375.sql
				
Note Because of file dependencies, the most recent hotfix or feature that contains the files may also contain additional files.Note While this hotfix greatly reduces the chance of the problem occurring, the hotfix does not completely prevent the problem.

To install this hotfix, follow these steps:
  1. Install SQL Server 2000 SP2.
  2. Connect as a member of the system administrator role or as the sa by using Query Analyzer or Osql.exe, and then run Qfe359375.sql. Run this script on the publisher or on any subscriber.
  3. Stop all running replication agents on your server.
  4. Connect as a member of the system administrator role or as the sa by using Query Analyzer or Osql.exe, and then run sp_vupgrade_replication against the publisher and the subscriber database.
  5. Test the scenario for the bug that is fixed in this build to make sure that your problem is resolved.

WORKAROUND

If you still experience the problem after you apply the hotfix, we recommend that you increase the generation batch size of the Merge Agent. To do this, use the -UploadGenerationsPerBatch parameter or the -DownloadGenerationsPerBatch parameter.

Warning If the network is not stable, increasing the generation batch size of the Merge Agent can have an adverse effect. If you make the generation batch bigger, you increase the chance of interrupting the batch. If the batch is interrupted, you must resend the whole batch. Like the hotfix, this workaround corrects the problem. However, it does not prevent the problem.

STATUS

Microsoft has confirmed that this is a problem in the Microsoft products that are listed in the "Applies to" section.

APPLIES TO
  • Microsoft SQL Server 2000 Standard Edition
Keywords: 
kbautohotfix kbhotfixserver kbqfe kbbug kbfix kbsqlserv2000presp3fix kbsqlserv2000sp3fix KB326483
 

Article Translations

 

Related Support Centers