FIX: A blocking issue occurs when you run the Merge Agent in SQL Server 2005

Symptoms

In Microsoft SQL Server 2005, you configure a merge publication. When you run the Merge Agent, a blocking issue occurs. When you monitor the blocking issue, you find the following behaviors:
  • In the output of the blocking script that you created to monitor this issue, some threads that are running replication stored procedures are blocked. For example, you may notice that the blocked threads are running the following replication stored procedures:
    • The sp_MSinsertgenhistory stored procedure
    • The sp_MSgetmakegenerationappl stored procedure
    • The sp_MSenumgenerations stored procedure
    Note You can also find the threads that are blocked by using the Activity Monitor in SQL Server Management Studio.

    For more information about how to monitor an issue by creating a blocking script, click the following article number to view the article in the Microsoft Knowledge Base:

    271509 How to monitor blocking in SQL Server 2005 and in SQL Server 2000

  • In a SQL Server trace, a transaction that is opened through the sp_mergemetadataretentioncleanup stored procedure may still be running even though the stored procedure that calls the sp_mergemetadataretentioncleanup stored procedure has completed. Additionally, you may find an Attention event in the transaction. The stored procedure that calls the sp_mergemetadataretentioncleanup stored procedure may be one of the following stored procedures:
    • The sp_MSinsertgenhistory stored procedure
    • The sp_MSgetmakegenerationappl stored procedure
    • The sp_MSenumgenerations stored procedure.
    For example, you may find records that resemble the following in the SQL Server trace:
    EventClass
    TextData
    ObjectName
    DBID
    TransactionID
    HostName
    ClientProcessIDApplicationName
    SPID
    RPC:Completed
    exec sp_MSenumgenerations 1051201,'9B9CC268-A43A-4736-9481-0B99227C3BF0',1
    sp_Msenumgenerations
    5
    525491216
    HostName1896
    ApplicationName69
    EventClass
    TextData
    ObjectName
    DBID
    TransactionID
    HostName
    ClientProcessIDApplicationName
    SPID
    SP:StmtCompletedbegin transactionsp_mergemetadataretentioncleanup5
    525491216
    HostName1896
    ApplicationName69
    SP:StmtStarting select NULL from dbo.MSmerge_contents with(TABLOCK ,HOLDLOCK) where 1=2sp_mergemetadataretentioncleanup5
    525491216
    HostName1896
    ApplicationName69
    EventClass
    TextData
    ObjectName
    DBID
    TransactionID
    HostName
    ClientProcessIDApplicationName
    SPID
    Attention5
    525491216
    HostName1896
    ApplicationName69

Cause

This issue occurs because the merge metadata cleanup process does not set the XACT_ABORT option to ON for the transaction. When the sp_mergemetadataretentioncleanup stored procedure is running, if an unexpected exception such as a network issue occurs, the transaction is not rolled back. When the transaction is not rolled back, the lock resources that are held by the transaction is not released.

Resolution

Service pack information

To resolve this problem, obtain the latest service pack for SQL Server 2005. For more information, click the following article number to view the article in the Microsoft Knowledge Base:
913089 How to obtain the latest service pack for SQL Server 2005

Status

Microsoft has confirmed that this is a problem in the Microsoft products that are listed in the "Applies to" section. This problem was first corrected in SQL Server 2005 Service Pack 3.

More Information

For more information about software update terminology, click the following article number to view the article in the Microsoft Knowledge Base:
824684 Description of the standard terminology that is used to describe Microsoft software updates
Özellikler

Makale No: 959023 - Son İnceleme: 15 Ara 2008 - Düzeltme: 1

Geri bildirim