释放 SQL Server 中的空间
我想知道是否有人能指出我正确的方向。
我在 SQL Server 数据库中有许多表,并且使用脚本来分析每个表所使用的空间。
如果有人感兴趣,可以在这里找到该脚本: http://www.sqlteam.com /forums/topic.asp?TOPIC_ID=61762
我的表大小只占数据库大小的三分之一左右,所以我的问题是什么在使用其余空间以及如何减少数据库的总体大小?
非常感谢您的指点。
I wonder if anyone can point me in the right direction with this please.
I have a number of tables in a SQL Server database and I have used a script to analyze the space that's being used by each table.
The script can be found here if anyone's interested: http://www.sqlteam.com/forums/topic.asp?TOPIC_ID=61762
My table sizes only account for about a third of the size of the database, so my question is what is using the rest of space and how can I reduce the overall database size?
Many thanks for any pointers.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
您是否因为遇到磁盘空间问题而需要回收空间?如果没有,就离开吧。
几乎可以肯定,收缩数据库和/或文件会导致问题:
引用上一篇:
通常,如果数据库是基于以前的auotgrows的大小,则数据库需要是这个大小。
例如,重建索引时,您需要大约 1.2 倍于最大表的可用空间。如果一张表占您数据的 25%,那么该表在索引重建期间将消耗 55%。
所以,除非您有迫切需要,否则不要这样做......
Do you need to reclaim space because you have disk space problems? If not, leave it.
You are almost certain to cause issues by shrinking database and/or files:
Quoting from the last one:
Generally the database needs to be this size if it is this size based on previous auotgrows.
For example, you need free space of approximately 1.2 times your biggest table when indexes are being rebuilt. If one table is 25% of your data then this table consumes 55% during index rebuilds.
So, don't do it unless you have a severe need...
假设这是 SQL Server 特定的,
DBCC SHRINKDATABASE
http ://msdn.microsoft.com/en-us/library/aa258287%28v=sql.80%29.aspx
Assuming that this is SQL Server specific,
DBCC SHRINKDATABASE
http://msdn.microsoft.com/en-us/library/aa258287%28v=sql.80%29.aspx