Sql-server – Database ‘msdb’ cannot be opened. it has been marked suspect by recovery

corruptionmsdbrecoverysql serversql-server-2008

I'm using SQL Server 2008. I got suddenly today an error while i was accessing a database from Visual Studio. The error is:

Database 'msdb' cannot be opened. It has been marked SUSPECT by recovery. Error: 926

error while accessing database

I don't know what to do to get out from this type of error.

Best Answer

The fastest way is to restore the MSDB database, but if it's your first time doing that, here's an easier shortcut.

  1. Restore the MSDB backup onto an existing (working) database server, but use a different database name than MSDB. The restore should go quickly (because MSDB is typically very small), and you can then verify that your objects are in there.
  2. Detach the database, and copy the mdf/ldf files over to the broken instance.
  3. Move the broken mdf/ldf files somewhere for safekeeping, and replace them with your newly restored mdf/ldf files.

Start the SQL Server instance again, and you're set.

One gotcha - in step 1, make sure you're restoring onto the same major version of SQL Server. If the broken server is SQL Server 2005, don't do the restore on SQL Server 2012, because the SQL 2005 instance won't be able to attach databases that have been touched by a newer version of SQL Server.