Getting a Suspect Database Back Online

If you are ever in a place where you find your SQL Server database in suspect and the data file and the log file no longer match, you can follow these instructions to attempt to get the database back in an operational state without the log file.

Verify that the Server Properties are storing log files in the correct default location.

If you made changes to the database default locations, you will need to restart SQL Server.

Take the database offline

Right-click on the database and go to tasks > Take Offline.

Detach the Database

Rename the log file

Navigate to the location of the log file for the given database and rename the file from dbname.ldf to dbname.ldf.old.

Create the database from the existing mdf file

Execute the following command from the master database:

CREATE DATABASE [dbname] ON
(Filename = N'c:\absolute\path\dbname.mdf')
for attach_force_rebuild_log

Refresh database view

Right-click on the server and click on refresh to see the newly created database that should no longer be in suspect.