Microsoft KB Archive/308784

= FIX: DATABASEPROPERTYEX Function Reports Incorrect Status After You Restore Database and Set the Database to OFFLINE =

Article ID: 308784

Article Last Modified on 10/17/2003

-

APPLIES TO


 * Microsoft SQL Server 2000 Standard Edition

-



This article was previously published under Q308784



BUG #: 355132 (SHILOH_BUGS)



SYMPTOMS
If you restore a database with the NORECOVERY option and you then set the database OFFLINE, the DATABASEPROPERTYEX function may report an incorrect status for the database. The DATABASEPROPERTYEX functions reports the database status as ONLINE.

In addition, if you run a RESTORE DATABASE WITH RECOVERY statement, an EXCEPTION_ACCESS_VIOLATION may occur.



RESOLUTION
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 INF: How to Obtain the Latest SQL Server 2000 Service Pack



STATUS
Microsoft has confirmed that this is a problem in Microsoft SQL Server 2000.

This problem was first corrected in Microsoft SQL Server 2000 Service Pack 2.



MORE INFORMATION
The DATABASEPROPERTYEX function returns the current setting of the specified database option or property for the specified database. For detailed information about the function, refer to SQL Server Books Online.

TO illustrate the problem, in Query Analyzer, use these steps:  Restore the pubs database from disk='c:\pubs.dmp' with the NORECOVERY option. Alter the pubs database and set it OFFLINE.  Run this code: SELECT databasepropertyex ('pubs','Status') 

The status returns ONLINE.

After you set the database to an OFFLINE status, if you run RESTORE DATABASE WITH RECOVERY, an EXCEPTION_ACCESS_VIOLATION may occur. A stack trace similar to the one that follows may appear in the SQL Server error log: 2001-10-17 16:59:36.81 spid52   SqlDumpExceptionHandler: Process 52 generated fatal exception c0000005 EXCEPTION_ACCESS_VIOLATION. SQL Server is terminating this process..
 * BEGIN STACK DUMP:
 * 10/17/01 16:59:36 spid 52
 * Exception Address = 0080C1F6 (BackupManager::EndRestore + 0000001A Line 0+00000000)
 * Exception Code   = c0000005 EXCEPTION_ACCESS_VIOLATION
 * Access Violation occurred writing address 00000064
 * Input Buffer 414 bytes -
 * restore database content from disk='d:\mssql7\backup\content.bak' with n
 * orecovery alter database content set offline  select databasepropertyex
 * ('content','Status') restore database content with recovery
 * restore database content from disk='d:\mssql7\backup\content.bak' with n
 * orecovery alter database content set offline  select databasepropertyex
 * ('content','Status') restore database content with recovery

Additional query words: AV access violation exception

Keywords: kbbug kbfix KB308784

-

[mailto:TECHNET@MICROSOFT.COM Send feedback to Microsoft]

© Microsoft Corporation. All rights reserved.