How To Fix "Cannot detach a suspect or recovery pending database. It must be repaired or dropped." Error



TODO:

Have you ever received the error "Cannot detach a suspect or recovery pending database. It must be repaired or dropped." when trying to detach a database that is suspect?

 

SOLUTION:

ALTER DATABASE MyDB SET EMERGENCY;
GO
ALTER DATABASE MyDB set single_user
GO
DBCC CHECKDB (MyDB, REPAIR_ALLOW_DATA_LOSS) WITH ALL_ERRORMSGS;
GO
ALTER DATABASE MyDB set multi_user
GO

 

NOTES:

Once that is done, you can then detach, and attach, or just bring online.



Add comment

  Country flag

biuquote
  • Comment
  • Preview
Loading