如何收缩我的SQL Server数据库? [英] How do I shrink my SQL Server Database?
问题描述
我有一个数据库近1.9Gb数据库的大小,而MSDE2000不允许超过2.0Gb的数据库
I have a Database nearly 1.9Gb Database in size, and MSDE2000 does not allow DBs that exceed 2.0Gb
我需要收缩这个DB(和许多其他人
I need to shrink this DB (and many others like this at various client locations).
我已经找到并删除了100多个1000的记录,这些记录被认为是不需要的:
这些记录占很大百分比数据库中的一些主(最大)表。因此,假设现在可以检索到很多空间是合理的。
I have found and deleted many 100's of 1000's of records which are considered unneeded: these records account for a large percentage of some of the main (largest) tables in the Database. Therefore it's reasonable to assume much space should now be retrievable.
现在我需要缩小数据库以解决缺失的记录。
So now I need to shrink the DB to account for the missing records.
- 我执行
DBCC ShrinkDatabase('MyDB')
......没有效果。 - 我尝试了MSSMS中提供的各种压缩工具....
- 我已经备份了数据库并恢复了它...仍然没有效果。
- I execute
DBCC ShrinkDatabase('MyDB')
...... No effect. - I have tried the various shrink facilities provided in MSSMS.... Still no effect.
- I have backed up the database and restored it... Still no effect.
还是1.9Gb
为什么?
无论我最终找到什么过程,都需要在客户端机器上重放,而无需使用OSql或类似的东西。
Whatever procedure I eventually find needs to be replayable on a client machine with access to nothing other than OSql or similar.
推荐答案
ALTER DATABASE MyDatabase SET RECOVERY SIMPLE
GO
DBCC SHRINKFILE (MyDatabase_Log, 5)
GO
ALTER DATABASE MyDatabase SET RECOVERY FULL
GO
这篇关于如何收缩我的SQL Server数据库?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!