1

I have a huge mdf file (61 GB) and it is 95% empty

I want to release unused space.

I tried to Shrink the file

but when I click OK the Shrink screen closes and nothing happens

the file still 61 GB

How to resolve this?

enter image description here

1
  • 3
    Shrinking can often be a really bad idea though. Do you actually need to shrink it? In real life terms, 61GB is a pretty small database. Certainly not the smallest, no, but still not huge.
    – Thom A
    Dec 25, 2020 at 21:03

1 Answer 1

1

Relase unused space frees only the space after the last allocated extend in the data file. Since 95% of the space in the data file is not in use you need to perform file reorganization. You can do it from SSMS by choosing Reorganize pages before releasing unused space and setting the suggested Shrink file size to 2490 MB or higher value.

As an alternative you can execute command (I recommend to do it this way):

DBCC SHIRINKFILE ( Res )
2
  • does not work this way
    – asmgx
    Dec 28, 2020 at 7:42
  • You need to give us more to go on than "does not work this way". Please explain. Jacek's post is correct. The GUI does TRUNCATEONLY by default, which doesn't move any data. You need to remove that option so that data is indeed moved towards the beginning of the file. And be prepared that the shrink can take a very very long time. Dec 28, 2020 at 12:35

Not the answer you're looking for? Browse other questions tagged or ask your own question.