Database Was in Suspect Mode, Now Detached, Can't Recover

Steps for Recovering Detached Database to Suspected State 
  1. Create a DB with Same Name as the Lost DB.
  2. Stop SQL Server Service.
  3. Replace the .mdf & .ldf files with Old Files(Lost DB).
  4. Start SQL Server Service.
Query For Recovering Suspected Database to ONLINE State 

EXEC sp_resetstatus 'yourDBname';
ALTER DATABASE 'yourDBname' SET EMERGENCY
DBCC checkdb('yourDBname')
ALTER DATABASE yourDBname SET SINGLE_USER WITH ROLLBACK IMMEDIATE
DBCC CheckDB ('yourDBname', REPAIR_ALLOW_DATA_LOSS)
ALTER DATABASE yourDBname SET MULTI_USER

1 comment:

  1. Such a wonderful post.
    https://michlstechblog.info/blog/virtualbox-no-boot-after-snapshot-efail-0x80004005/

    ReplyDelete