X
xxhadsg
Unregistered / Unconfirmed
GUEST, unregistred user!
数据库是SQL Server 2000,发现数据库文件增大的特别快,不是日志文件,而是数据文件(mdf),试过收缩,但收缩的有限,仔细看了一下,是表的空间浪费太多。sp_spaceused显示有的表unused空间到几百M。找到了微软的一个解释,可试了之后仍不能释放表的剩余空间,哪位大侠知道怎么回事?谢谢<br>附:微软的官方解释。<br><br><br>Space is not released after you delete some rows from a table in SQL Server 2000<br>View products that this article applies to.<br>Article ID : 934378 <br>Last Review : April 4, 2007 <br>Revision : 1.0 <br>SYMPTOMS<br>Consider the following scenario. You delete some rows from a table in Microsoft SQL Server 2000. You run the sp_spaceused stored procedure against the table. In this scenario, the result of the sp_spaceused stored procedure shows that lots of space in the table is not released. This problem is not resolved even after you run the DBCC UPDATEUSAGE statement against the table.<br>Back to the top<br><br>CAUSE<br>This problem occurs because the Page Free Space (PFS) ghost flag is not set correctly on the PFS page. Therefore, the ghost row clean-up thread thinks that no ghost row exists in the data pages that are covered by the PFS page.<br>Back to the top<br><br>WORKAROUND<br>To work around this problem, use one of the following methods:? Rebuild the index or the heap that the data that you deleted belongs to. After the index or the heap is rebuilt, the PFS page will be re-created. Additionally, the PFS ghost flag will be set correctly on the PFS page. <br>? Add a new record to the table, and then delete the row that you added. <br><br>Back to the top<br><br>STATUS<br>Microsoft has confirmed that this is a problem in the Microsoft products that are listed in the "Applies to" section.<br>Back to the top<br><br>MORE INFORMATION<br>When a row is deleted from a table, the following things occur:? The row is marked to be a ghost row. <br>? The PFS page is updated. It indicates that the data page where the deleted row originally existed contains a ghost row. <br>? A PFS ghost flag is set on the PFS page. <br>When the ghost row clean-up thread runs, the thread performs the following steps:1. The thread checks whether the PFS ghost flag is set on the PFS page. If the PFS ghost flag is not set, the thread knows that no ghost row exists in the data pages that are covered by the PFS page. The thread will skip the PFS page and check the next PFS page. <br>2. If the PFS ghost flag is set on the PFS page, the thread searches in the PFS page to find data pages that have ghost rows. <br>3. For each data page that the thread finds, the thread deletes the ghost rows in the data page. <br><br>Back to the top<br><br><br>--------------------------------------------------------------------------------<br><br>APPLIES TO<br>? Microsoft SQL Server 2000 Standard Edition <br>? Microsoft SQL Server 2000 Workgroup Edition <br>? Microsoft SQL Server 2000 Developer Edition <br>? Microsoft SQL Server 2000 Enterprise Edition