Database size bigger after delete from table

倾然丶 夕夏残阳落幕 提交于 2019-12-25 01:35:15

问题


After I delete huge amount of data from a SQL Server database table, the database size increased.

When I run sp_spaceused it shows me 2625.25 MB. It used to be ~ 1800.00 MB before I deleted from table.

Is there any specific reason it keeps growing even if I delete data?


回答1:


A temporary transaction log is often the reason for a notable increase of size after a huge delete.

It will eventually disappear on its own but you may remove the files if you need to reclaim the space.




回答2:


I'm assuming that you are using SQL Server (sp_spaceused). Deleting is logged, so your log file has grown.

See SQL Server 2008 log will not truncate on how to truncate your log (depending on your DB and recovery model), and then you can run

DBCC SHRINKFILE(N)

to reclaim lost space

Edit As per @Aaron, Truncating is also a logged operation. Answer corrected.



来源:https://stackoverflow.com/questions/10865201/database-size-bigger-after-delete-from-table

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!