SQL Server – Lots of Empty Space But Database Won’t Shrink

ben himself's picture

Today I ran a script to delete a huge portion of data in a DEV environment and I was excited to get back a few hundred GB, but I only got back a portion of the free space that the Properties window said I had.  What was going on?

It turns out that when shrinking a database, the smallest a file will get is back to the “Initial Size” in the database properties/files window.

To shrink it more, simply lower the Initial Size and then shrink the database again.  You can use the GUI or use:

DBCC ShrinkFile (N'FileName', 1000)
GO

Tags: 

Categories: