开发者

Freeing up space in SQL Server

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 any开发者_运维问答one'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.


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:

  • http://blogs.msdn.com/b/sqlserverstorageengine/archive/2006/06/13/629059.aspx
  • http://technet.microsoft.com/en-us/magazine/ff808322.aspx
  • http://www.sqlskills.com/blogs/paul/post/Why-you-should-not-shrink-your-data-files.aspx
  • http://www.sqlskills.com/BLOGS/PAUL/post/A-SQL-Server-DBA-myth-a-day-%28930%29-data-file-shrink-does-not-affect-performance.aspx

Quoting from the last one:

Myth #9: Data file shrink does not affect performance.

Hahahahahahahahahahahahahahaha! <snort>

<wipes tears from eyes, attempts to focus on laptop screen, cleans drool from keyboard> 

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...


Assuming that this is SQL Server specific,

DBCC SHRINKDATABASE

http://msdn.microsoft.com/en-us/library/aa258287%28v=sql.80%29.aspx

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜