FIX: A database shrink may not succeed or unexplained transaction log growth may occur in SQL Server 2005

Article translations Article translations
Article ID: 959012 - View products that this article applies to.
Expand all | Collapse all

On This Page

SYMPTOMS

Consider the following two scenarios in Microsoft SQL Server 2005:

  1. When you execute DML statements against a table that does not have a clustered index, the database continues growing. The database becomes very large. When you shrink the database, the shrink operation does not complete successfully. This may happen if you enable the SNAPSHOT transaction isolation level or the read committed SNAPSHOT transaction isolation level for a database.
  2. The database transaction log may grow continuously with very little or no activity in the database. If you run the following statements, the values of the ghost_record_count column and of the forwarded_record_count column are very large: 
    SELECT 
    DB_NAME (database_id) AS database_name,
    OBJECT_NAME (object_id) AS object_name,
    index_type_desc AS index_type,
    alloc_unit_type_desc AS alloc_unit_type,
    page_count,
    record_count,
    ghost_record_count,
    version_ghost_record_count,
    forwarded_record_count
    FROM sys.dm_db_index_physical_stats (
    DB_ID ('<DatabaseName>'),
    OBJECT_ID ('<TableName>'),
    NULL,
    NULL,
    'DETAILED')

    The large values indicate that the Ghost Cleanup process does not work.
    Also if you query the following DMV, you may find error 669:

    Select * from sys.dm_os_ring_buffers
    where ring_buffer_type = 'RING_BUFFER_EXCEPTION'

    </Task><Error>669</Error><Severity>25</Severity>

CAUSE

When you shrink the database or the Ghost Cleanup process runs, forwarded versioned records in a heap are not handled correctly. Therefore, the Ghost Cleanup process skips these records, and the Ghost Cleanup transaction rolls back. Because Ghost Cleanup will try to execute the transaction again and then roll back repeatedly, the transaction log grows. In addition, because Ghost Cleanup does not delete records, you cannot shrink the database, and the database grows continuously. Therefore, you have less disk space.

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

WORKAROUND

To work around this issue, you can create a clustered index on the table. Then, you can drop the clustered index.

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

Properties

Article ID: 959012 - Last Review: November 9, 2010 - Revision: 3.0
APPLIES TO
  • Microsoft SQL Server 2005 Standard Edition
  • Microsoft SQL Server 2005 Developer Edition
  • Microsoft SQL Server 2005 Enterprise 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
  • Microsoft SQL Server 2005 Workgroup Edition
Keywords: 
kbtshoot kbexpertiseadvanced kbfix kbsql2005engine KB959012

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