1

我有一个问题,即我发现我的mdf 大小:13 GBldf 大小:96 GB,我从数据库表中删除了所有记录以减少 mdf 和 ldf 的大小,我确实使用了 DATA_AQUA go exec sp_updatestats go即使DBCC SHOW_STATISTICS命令给出空值,我的期望是我删除了所有记录,但它应该显示较小的大小,但它仍然显示旧大小,如何解决这个问题请帮助我。

4

2 回答 2

1

Start reading the documentation.

NONE of your steps will make any of those files smaller per documentation.

  • The LDF points to you not having made a backup and truncated the log, quite "ever". That is significantly bad and I dare saying the file size is not your problem but the fact that you have no backup and do not seem to care about your data.

  • Once you have backups, you can reinitialize the LDF using a sequence of switching to simple recovery then running a shrink operation.

  • Regarding the MDF - same thing. You have to reorganize the database using a maintenance task to shrink it.

Why do you think that deleting records, using updatestats will magically shrink the file?

于 2012-12-10T04:45:16.207 回答
0

对于 LDF,您应该进行常规事务日志备份,或者从完全恢复模式切换到简单恢复模式。它会增长,直到你采取这两个行动之一。请注意,在任何一种情况下,执行操作后都应缩小 ldf文件。

如果您从主数据库中删除了记录,则 mdf 不会自动收缩,但您可以使用与 ldf 相同的收缩机制(又名 database->tasks->shrink->files 或DBCC Shrinkfile (<DBName>, <TargetSize>)

于 2015-04-08T14:16:35.003 回答