Back up the . mdf,. ndf, and . ldf files before you do any recovery operations.
Use master
Go
--Set the database in the suspect state to a state of emergency
ALTER DATABASE <DatabaseName> SET emergency
Go
--Set the database as a single user immediate rollback mode
ALTER DATABASE <DatabaseName> set Single_user with rollback immediate
Go
Use <DatabaseName>
Go
-Rebuild the log file, note to delete the old LDF file first, the log file to give the full path
ALTER DATABASE <DatabaseName> Rebuild Log on (name=<databasename>,filename= ' C:\sql\logs\<databasename >_log. LDF ')
Go
--Perform database checks and execute multiple times
DBCC CHECKDB (' <DatabaseName> ', Repair_allow_data_loss)
Go
--Set to multi-user mode
ALTER DATABASE <DatabaseName> set Multi_user
Go
Copyright NOTICE: This article for Bo Master original article, without Bo Master permission not reproduced.
Processing of MS SQL Server 2008 databases in suspect cases