sql-server-2005 – 没有行的Sql Server巨大的表

我有一个sql Server数据库,有几个表没有行数,但占用了10 GB的空间.我可以通过对所讨论的表执行右键单击/属性来看到这一点(数据空间很大,介于1到6 GB之间,并且这些表上的行计数为零).我不知道是什么导致这种情况,因为我认为零行意味着几乎为零空间.

有任何想法吗?

解决方法

重建表上的所有索引,包括聚簇索引.从 Books Online开始:

Rebuilding an index drops and
re-creates the index. This removes
fragmentation,reclaims disk space by
compacting the pages based on the
specified or existing fill factor
setting,and reorders the index rows
in contiguous pages.

就像是:

ALTER INDEX ALL ON [lc_db_user].[JMS_MESSAGES] REBUILD

DBCC SHRINKDATABASE或(更优选)DBCC SHRINKFILE只有在空间实际从表本身中释放时才会执行某些操作.另外请确保您熟悉issues associated with shrinking database files.执行摘要:永远不要使用自动收缩,只在必要时收缩文件,并始终跟进完整的重新索引,以对您刚刚分散的所有索引进行碎片整理.

相关文章

SELECT a.*,b.dp_name,c.pa_name,fm_name=(CASE WHEN a.fm_n...
if not exists(select name from syscolumns where name=&am...
select a.*,pano=a.pa_no,b.pa_name,f.dp_name,e.fw_state_n...
要在 SQL Server 2019 中设置定时自动重启,可以使用 Window...
您收到的错误消息表明数据库 'EastRiver' 的...
首先我需要查询出需要使用SQL Server Profiler跟踪的数据库标...