永久删除表时回收 SQL Server 2005 数据库中的空间 [英] Reclaim space in SQL Server 2005 database when dropping tables permanently

查看:32
本文介绍了永久删除表时回收 SQL Server 2005 数据库中的空间的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在从 SQL Server 2005 数据库中删除大量表.如何缩小数据库 - 假设我不替换数据或表?我正在将内容归档到另一个数据库.

I'm dropping out massive numbers of tables out of a SQL Server 2005 database. How do I shrink the database - assuming I'm not replacing the data or the tables? I'm archiving stuff to another db.

推荐答案

DBCC Shrinkdatabase(0) --  Currently selected database

DBCC Shrinkdatabase(<databasename>) --  Named database

然而,缩小文件可能会使您的表格碎片化,尤其是较大的表格,因为表格的内容在文件中移动,因此一旦缩小,最好对表格进行碎片整理.当然,这会使您的文件再次增长,但可能不会像删除旧表之前那样大.(呃,假设删除的表包含大量数据......)

However, shrinking files will likely fragment your tables, particularly larger onces, as contents of tables get moved about within the file, so once shrunk it's a good idea to defragment your tables. This, of course, will make your files grow again, but probably not so large as they were before you dropped your old tables. (Err, that assumes that the dropped tables contained large quantities of data...)

这篇关于永久删除表时回收 SQL Server 2005 数据库中的空间的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆