DBCC Shrinkfile unable to Shrinkfile

Many times it happens that you will not able to shrink datafile using DBCC Shrinkfile command. There may be various reason/error for it. One of them says as mentioned below:

“file id of database id cannot be shrunk as it is either being shrunk by another process or is empty”

This happens when already a DBCC shrinkfile has been run and due to some reason it was unable to shrink the file and the internal files are not re-organized or file has not grown to shrink. Or SQL server somewhere it feels that the file you are shrinking is in middle of Shrinking process

One of the solution for this file is to add some MB of data to the file which you are trying to shrink and then use DBCC Shrinkfile. This will work as adding a few MB to the data file resets an internal counter or switch that tells it it’s not in the middle of a shrink now

Advertisements

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s