You are here

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

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)
This question is for testing whether or not you are a human visitor and to prevent automated spam submissions.
1 + 6 =
Solve this simple math problem and enter the result. E.g. for 1+3, enter 4.

Theme by Danetsoft and Danang Probo Sayekti inspired by Maksimer