Sql Server 2008 R2 DBCC SHRINKFILE Severe Error I am trying to run the following command in Sql Server 2008 R2:

DBCC SHRINKFILE('filename')


When I try to run this command, I get the following error:

Msg 0, Level 11, State 0, Line 0
A severe error occurred on the current command.  The results, if any, should be discarded.


Can anyone tell me why I am getting this error and how to resolve this issue?

Thanks!
Have you tried specifying both the file name and the target size in MB, e.g.

DBCC SHRINKFILE('filename', 20);


Or the TRUNCATEONLY option, which doesn't try any of the nasty stuff like reorganizing all of your physical data:

DBCC SHRINKFILE('filename', TRUNCATEONLY);


Also you could try making sure the database is in single user mode first:

ALTER DATABASE db SET SINGLE_USER WITH ROLLBACK IMMEDIATE;


...and turn off any backup / log backup or other maintenance jobs that may be conflicting with your shrink operation. If it still occurs, please run a CHECKDB against this database and let us know the results:

DBCC CHECKDB (db) WITH NO_INFOMSGS, ALL_ERRORMSGS;


But just as a side note, you do know that shrinking is bad and should usually be reserved for extraordinary events and circumstances, right?