DetailPage-MSS-KB

Microsoft small business knowledge base

Article ID: 934459 - Last Review: June 21, 2014 - Revision: 4.0

On This Page

Symptoms

In Microsoft SQL Server 2005 Service Pack 2 (SP2), the following tasks in a maintenance plan may lose database context in certain circumstances:
  • Check Database Integrity
  • Execute T-SQL Statement
For example, if a Check Database Integrity task is configured to check integrity on multiple databases, the task repeatedly checks the default database.

For the Execute T-SQL Statement task, this problem occurs if the following conditions are true:
  • The Execute T-SQL Statement task contains multiple batches.
  • The batches are separated by the GO statement.
  • No batches use the USE statement to specify the database.
  • The statements in each batch do not contain the database name.
In this scenario, those statements in the second batch and in succeeding batches will be executed against the default database.

Note You can confirm that this problem has occurred by using SQL Server Profiler. When you trace the maintenance plan execution, see the Database column in SQL Server Profiler.

Resolution

This problem occurs in SQL Server 2005 builds 3042 through 3053 and in SQL Server 2005 builds 3150 through 3158. If you are running a build of SQL Server 2005 SP2 between 3150 and 3158, download and install the following file from the Microsoft Download Center.
The following file is available for download from the Microsoft Download Center:

Collapse this imageExpand this image
Download
Download the SQL2005-KB934459-ENU package now. (http://www.microsoft.com/downloads/details.aspx?FamilyId=A7C903FE-35A7-4BB2-8E73-932770099711&displaylang=en)

For more information about how to download Microsoft support files, click the following article number to view the article in the Microsoft Knowledge Base:
119591  (http://support.microsoft.com/kb/119591/ ) How to obtain Microsoft support files from online services
Microsoft scanned this file for viruses. Microsoft used the most current virus-detection software that was available on the date that the file was posted. The file is stored on security-enhanced servers that help prevent any unauthorized changes to the file.

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, 32-bit version

Collapse this tableExpand this table
File nameFile versionFile sizeDateTimePlatform
Microsoft.sqlserver.maintenanceplantasks.dll9.0.3159.0296,30424-Mar-200707:44x86
Msmdlocal.dll9.0.3159.015,930,22424-Mar-200707:44x86
Rdistcom.dll2005.90.3159.0644,46424-Mar-200707:44x86
Sqlaccess.dll2005.90.3159.0350,57624-Mar-200707:44x86
Sqlservr.exe2005.90.3159.029,192,04824-Mar-200707:44x86

SQL Server 2005, x64-based version

Collapse this tableExpand this table
File nameFile versionFile sizeDateTimePlatform
Microsoft.sqlserver.maintenanceplantasks.dll9.0.3159.0296,30424-Mar-200707:44x86
Msmdlocal.dll9.0.3159.015,930,22424-Mar-200707:44x86
Rdistcom.dll2005.90.3159.0828,27224-Mar-200703:53x64
Sqlaccess.dll2005.90.3159.0357,74424-Mar-200703:53x86
Sqlservr.exe2005.90.3159.038,516,59224-Mar-200703:53x64

SQL Server 2005, Itanium-based version

Collapse this tableExpand this table
File nameFile versionFile sizeDateTimePlatform
Microsoft.sqlserver.maintenanceplantasks.dll9.0.3159.0296,30424-Mar-200707:44x86
Msmdlocal.dll9.0.3159.049,815,92024-Mar-200703:27ia64
Rdistcom.dll2005.90.3159.01,885,04024-Mar-200703:27ia64
Sqlaccess.dll2005.90.3159.0352,11224-Mar-200703:27x86
Sqlservr.exe2005.90.3159.072,542,57624-Mar-200703:27ia64
If you are running any build of SQL Server 2005 SP2 between 3042 and 3053, click the following article number to view the article in the Microsoft Knowledge Base:
934458  (http://support.microsoft.com/kb/934458/ ) FIX: The Check Database Integrity task and the Execute T-SQL Statement task in a maintenance plan may lose database context in certain circumstances in SQL Server 2005 builds 3042 through 3053
To obtain this fix in an automated way, visit the following Microsoft Update Web site:
http://update.microsoft.com (http://update.microsoft.com)
For more information about how to determine the SQL Server version and edition, click the following article number to view the article in the Microsoft Knowledge Base:
321185  (http://support.microsoft.com/kb/321185/ ) How to identify your SQL Server version and edition

Status

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

More information

In the original release version of SQL Server 2005 SP2 and earlier versions, commands that are related to maintenance plan tasks are accumulated and then executed at the same time. When an error occurs, tasks are no longer executed, and the remaining maintenance tasks are not performed. In SQL Server 2005 SP2, individual batches are submitted one at a time. In the original release version of SQL Server 2005 SP2, the database connection was reset between batches. Later batches were left in the context of the default database instead of in the context that was present before the GO statement was executed. The tasks that were affected depended on the context that was present before the GO statement was executed, specifically the Check Database Integrity task and the Execute T-SQL Statement task.

This hotfix is also included in the cumulative update package (build 3161) for SQL Server 2005 Service Pack 2. For more information, click the following article number to view the article in the Microsoft Knowledge Base:
935356  (http://support.microsoft.com/kb/935356/ ) Cumulative update package (build 3161) for SQL Server 2005 Service Pack 2 is available

Applies to
  • Microsoft SQL Server 2005 Developer Edition
  • Microsoft SQL Server 2005 Enterprise Edition
  • Microsoft SQL Server 2005 Standard Edition
  • Microsoft SQL Server 2005 Standard X64 Edition
  • Microsoft SQL Server 2005 Standard Edition for Itanium-based Systems
  • Microsoft SQL Server 2005 Enterprise X64 Edition
  • Microsoft SQL Server 2005 Enterprise Edition for Itanium-based Systems
Keywords: 
kbsql2005ssis kbexpertiseadvanced atdownload kbqfe KB934459
Share
Additional support options
Ask The Microsoft Small Business Support Community
Contact Microsoft Small Business Support
Find Microsoft Small Business Support Certified Partner
Find a Microsoft Store For In-Person Small Business Support