Apr
7
2011

Repair SQL Server 2008 R2 Suspected Database

Just a day before , come across new issue of database . for some reason database found in suspect mode ! and that was horrible moment.

After some search , we got brief idea that , database can go in suspect mode for many reasons like improper shutdown of the database server, corruption of the database files etc.

To find out what exactly gone wrong with database we tried following query

DBCC CHECKDB (‘YOUR_DATABASE_NAME’) WITH NO_INFOMSGS, ALL_ERRORMSGS

(It wasn’t much helpful in my case . I am just posting here in-case it hepls other !)

After a while we run another block of code , to put the database in emergency mode (Ref  : MSDN )

EXEC sp_resetstatus ‘YOUR_DATABASE_NAME’;
ALTER DATABASE YOUR_DATABASE_NAME  SET EMERGENCY
DBCC checkdb(‘YOUR_DATABASE_NAME’)
ALTER DATABASE YOUR_DATABASE_NAME  SET SINGLE_USER WITH ROLLBACK IMMEDIATE
DBCC CheckDB (‘YOUR_DABASE_NAME’, REPAIR_ALLOW_DATA_LOSS)
ALTER DATABASE YOUR_DATABASE_NAME SET MULTI_USER

Finally we got database back online !

Happy Coding .

18 Comments+ Add Comment

  • THANK YOU

  • You Welcome Bahruz !

    Thanks
    Vinay

  • Hello Vinay,

    Good to see your article on SQL database issues & you have written it very nicely!! I am Adam & I also love to write article on database issues.

  • Thank you for sharing this information! I greatly appreciate that you took the time to write this and share.

    I am not a DBA and I really needed help.

  • This is an excellent post. This is all I needed to fix the issue.
    Thanks a lot.

  • Nice tip!

    Thanks…
    (Y)

  • Glad to hear that it helps you all !

    Thanks
    Vinay

  • This is amazing thanks men. it fixed ma problem.

  • Thanx patel

    this fix the problem

  • Thanks Vinay.

    Really it helps me to get my database back which was in suspect mode. I google everywhere that helps me but here i found out solution.

    Thanks once again.

    Arshad

    • That’s sounds good :) !

      Thanks
      Vinay

  • Thanks, it help me.
    Carlos

  • Thanks, it help me.
    Carlos

  • Thanks…..this solution helped me! :)

  • Nice.

    :)

    Thanks too much.

  • [...] Recently had a database in suspect mode. I didn’t have a backup of the database. After searching online I found this link. [...]

  • Thank you very helpful

Leave a comment