开发者

The mdf data file wont shrink even if there is free space available

开发者 https://www.devze.com 2023-01-10 03:21 出处:网络
One of my databases had 450 GB of size for the data mdf file. I Dropped the unecassary tables to reclaim some space in the database and to my surprise even if there was around 150 GB of freespace, the

One of my databases had 450 GB of size for the data mdf file. I Dropped the unecassary tables to reclaim some space in the database and to my surprise even if there was around 150 GB of freespace, the data file won't shrink below the Files initial size which has gro开发者_如何学编程wn to 450 GB. What could be the simplest solution/ workaround for this ?


If your database is in FULL Recovery mode you can switch to SIMPLE mode then do a shrink files to reclaim space.

Normally it's due to the logs not being able to successfully shrink rather than data file.

However ensure you leave enough space for growth as the resizing will cause a lot of extra work.

I wouldn't recommend shrinking for no reason as there are plenty of posts out there indicating why you shouldn't as it can lead to fragmentation.

Check books online for the DBCC SHRINKDATABASE statement as well.

0

精彩评论

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