FIX: DBCC ShrinkDatabase or ShrinkFile Commands May Cause Errors 5042 and 3140 (254253)
The information in this article applies to:
This article was previously published under Q254253
BUG #: 56280 (SQLBUG_70)
SYMPTOMS
If you use the DBCC ShrinkDatabase or ShrinkFile commands,
the following errors may occur:
Error 5042 - The file '%' cannot be removed because it is not empty.
Error 3140 - Could not adjust the space allocation for file '%'.
CAUSE
The shrink code line in the SQL Server 7.0 product does not account for empty text or image extents created when multiple deletions take place on the same extent simultaneously.
The Page Free Space (PFS) entries are scanned when SQL attempts to locate the target page to "shrink to". However, under these conditions the Index Allocation Map (IAM), Global Allocation Map (GAM) and Shared Global Allocation Map (SGAM) bits are correctly set to show the extent is still in use. However, the PFS bits correctly show no pages on the extent that remains in use (allocated).
The first pass of the shrink is responsible for deallocating all extents that no longer have pages in use. This scan does not account for text or image indexes resulting in a condition where an extent is allocated in the database at a higher location than the last allocated page shown in the PFS scan. When the shrink attempts to remove the extent in the file, the errors occur because the text or image extent is still valid.
WORKAROUND
Some tables lend themselves to BCP or SELECT INTO operations, which allows the original table to be dropped or truncated.
STATUS
Microsoft has confirmed this to be a problem in SQL Server 7.0. This problem has been corrected in U.S. Service Pack 3 for Microsoft SQL Server 7.0. For more information, click the following article number to view the article in the Microsoft Knowledge Base: 274799 INF: How to Obtain Service Pack 3 for Microsoft SQL Server 7.0 and Microsoft Data Engine (MSDE) 1.0
For more information, contact your primary support provider.
Modification Type: | Major | Last Reviewed: | 3/14/2006 |
---|
Keywords: | kbBug kbfix kbQFE KB254253 |
---|
|