FIX: You may receive an access violation error message when you run a parallel execution plan in SQL Server 2005

Article translations Article translations
Article ID: 912885 - View products that this article applies to.
BUG #: 420246 (SQLBUDT)
Microsoft distributes Microsoft SQL Server 2005 fixes as one downloadable file. Because the fixes are cumulative, each new release contains all the hotfixes and all the security fixes that were included with the previous SQL Server 2005 fix release.
Expand all | Collapse all

On This Page

SUMMARY

This article describes the following about this hotfix release:
  • The issues that are fixed by the hotfix package
  • The prerequisites for installing the hotfix package
  • Whether you must restart the computer after you install the hotfix package
  • Whether the hotfix package is replaced by any other hotfix package
  • Whether you must make any registry changes
  • The files that are contained in the hotfix package

SYMPTOMS

In Microsoft SQL Server 2005, you may receive an access violation error message when the following conditions are true:
  • You create an index that uses the IGNORE_DUP_KEY option for a table.
  • You run an INSERT statement that inserts a new row into this index.
  • The plan for the INSERT statement is parallel.
  • The value for one of the key columns of the IGNORE_DUP_KEY option is provided by using a parameter.
Additionally, you may receive an error message that is similar to the following:
A server error occurred on the current command. The results, if any, should be discarded.

RESOLUTION

Hotfix information

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. This hotfix might receive additional testing. Therefore, if you are not severely affected by this problem, we recommend that you wait for the next software update that contains this hotfix.

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, contact 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
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.

Prerequisites

There are no prerequisites for this hotfix.

Restart information

You do not have to restart the computer after you apply this hotfix.

Registry information

You do not have to change the registry.

File information

This hotfix contains only those files that are required to correct the issues that this article lists. This hotfix may not contain all the files that you must have to fully update a product to the latest build.

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 item in Control Panel.
SQL Server 2005 for x86-based systems
Collapse this tableExpand this table
File nameFile versionFile sizeDateTimePlatform
Msvcp80.dll8.0.50727.42548,86414-Oct-200506:26x86
Msvcr80.dll8.0.50727.42626,68814-Oct-200506:26x86
Sqldiscoveryapi.dll2005.90.1518.0527,06421-Jan-200600:11x86
SQL Server 2005 x64 edition
Collapse this tableExpand this table
File nameFile versionFile sizeDateTimePlatform
Msvcp80.dll8.0.50727.421,097,72814-Oct-200518:46x64
Msvcr80.dll8.0.50727.42822,78414-Oct-200518:46x64
Sqldiscoveryapi.dll2005.90.1518.0745,68821-Jan-200604:14x64
SQL Server 2005 for Itanium-based systems
Collapse this tableExpand this table
File nameFile versionFile sizeDateTimePlatform
Msvcp80.dll8.0.50727.421,385,47214-Oct-200518:35IA-64
Msvcr80.dll8.0.50727.421,484,80014-Oct-200518:35IA-64
Sqldiscoveryapi.dll2005.90.1518.01,924,31221-Jan-200603:30IA-64

WORKAROUND

To work around this problem, follow these steps:
  1. Determine the problematic INSERT statement that causes the access violation.
  2. Force the query optimizer to generate a serial plan for the problematic INSERT statement. Therefore, the statement can be executed on one thread.
Note If you cannot determine the problematic INSERT statement that causes the access violation, you can use the method that is described in Method 3 to work around this problem.

To determine the problematic INSERT statement that causes the access violation, follow these steps:
  1. In the SQL Server error log file, locate the access violation error message.
  2. Near the top of the access violation error message, locate the input buffer information.
  3. Locate the batch information that follows the input buffer information.

    Note The batch contains the problematic INSERT statement that causes the access violation.
  4. If the batch contains only one INSERT statement, this statement is exactly the problematic INSERT statement. If the batch contains multiple INSERT statements, perform the follow operations to determine the problematic INSERT statement:
    1. In SQL Server Profiler, create a trace against the instance of SQL Server 2005.
    2. In the Errors and Warnings event category, select the Attention event class and the Exception event class.

      Note You can use these event classes to determine the last statement that begins to run before the access violation occurs.

      If the batch contains only Transact-SQL statements, select the following additional event classes under the TSQL event category:
      • SQL:BatchStarting
      • SQL:BatchCompleted
      • SQL:StmtStarting
      • SQL:StmtCompleted
      If the batch contains a stored procedure in which the access violation occurs, select the following additional event classes under the Stored Procedures event category:
      • SP:Starting
      • SP:Completed
      • SP:StmtStarting
      • SP:StmtCompleted
    3. Run the same batch from the client application.

      You follow this step to reproduce the access violation. Then, you can determine the problematic INSERT statement. When you run the batch, make sure that the trace is running.

      If the client application is not SQL Server Management Studio, you may also manually run the same batch in SQL Server Management Studio. However, you may not obtain the same execution plan as the original execution plan that causes the problem. This behavior occurs if SQL Server 2005 recompiles the problematic INSERT statement in the batch by using a different execution plan or by using different parameters.
    4. Stop the trace, and then analyze the trace results to determine the problematic INSERT statement. To determine the problematic INSERT statement, determine the SPID that experiences the access violation and that disconnects the client application. Then, on the SPID, notice the INSERT statement that meets the following requirements:
      • The INSERT statement is started.
      • The same INSERT statement is not completed.
To force the query optimizer to generate a serial plan for the problematic INSERT statement, use one of the following methods.

Method 1

Note Use this method if you can access the problematic INSERT statement.

Add the OPTION (MAXDOP 1) expression to the problematic INSERT statement. The following is an example of the new INSERT statement.
INSERT INTO MyTable (Col1, Col2)
SELECT Col1, Col2 FROM OtherTable
OPTION (MAXDOP 1) 
For more information about the MAXDOP query hint, see the "Using MAXDOP" section on the following Microsoft Developer Network (MSDN) Web site:
http://msdn2.microsoft.com/en-us/library/ms181714.aspx

Method 2

Note Use this method if you cannot access the problematic INSERT statement. For example, the problematic INSERT statement is from a client application. However, you cannot reconfigure the client application or you cannot recompile the client application to add the OPTION (MAXDOP 1) expression. Or, the problematic INSERT statement is in a stored procedure. However, the stored procedure is encrypted. You cannot change the statements in the stored procedure.

Use the sp_create_plan_guide stored procedure against the problematic INSERT statement. By doing this, you force the OPTION (MAXDOP 1) expression on the problematic INSERT statement. The following is an example of how to use the sp_create_plan_guide stored procedure.
sp_create_plan_guide @name = N'planguide_for_MyFailingProc', -- Arbitrary name
@stmt = N'INSERT INTO MyOneFailingStatementTable VALUES (@a,@b,@c)', -- The problematic INSERT statement
@type = N'OBJECT', @module_or_batch = N'dbo.MyFailingProc', -- The name of the stored procedure that contains the problematic INSERT statement
@params = NULL, @hints = N'OPTION (MAXDOP 1)'-- Query hint to prevent parallelism
For more information about the sp_create_plan_guide stored procedure, visit the following MSDN Web site:
http://msdn2.microsoft.com/en-us/library/ms179880.aspx

Method 3

Note Use this method if one of the following conditions is true:
  • The problematic INSERT statement is dynamically generated.
  • You cannot determine the INSERT statement that causes the access violation.
Important This method enables all queries on the instance of SQL Server 2005 to run on one thread. We do not suggest that you use this method. This method may cause performance issues on the other queries that run on the instance.

Run the following Transact-SQL statements.
sp_configure 'show advanced options', 1;
GO

RECONFIGURE WITH OVERRIDE;
GO

sp_configure 'max degree of parallelism', 1;
GO

RECONFIGURE WITH OVERRIDE;
GO
For more information about the max degree of parallelism option, visit the following MSDN Web site:
http://msdn2.microsoft.com/en-us/library/ms181007.aspx

STATUS

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

MORE INFORMATION

For more information about the naming schema for SQL Server updates, click the following article number to view the article in the Microsoft Knowledge Base:
822499 New naming schema for Microsoft SQL Server software update packages
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

Properties

Article ID: 912885 - Last Review: October 9, 2011 - Revision: 4.0
APPLIES TO
  • Microsoft SQL Server 2005 Enterprise Edition
  • Microsoft SQL Server 2005 Enterprise X64 Edition
  • Microsoft SQL Server 2005 Enterprise Edition for Itanium-based Systems
  • Microsoft SQL Server 2005 Developer Edition
  • Microsoft SQL Server 2005 Standard Edition
  • Microsoft SQL Server 2005 Standard X64 Edition
Keywords: 
kbautohotfix kbsql2005engine kbsql2005presp1fix kbhotfixserver kbfix kbbug kbsqlserv2005fix kbqfe KB912885

Give Feedback

 

Contact us for more help

Contact us for more help
Connect with Answer Desk for expert help.
Get more support from smallbusiness.support.microsoft.com