Author Options:

I had a SQL that got destroyed by someone re-initializing the disks on a RAID array and destroying the data. Answered

I have managed to restore the DB from a very old backup, and I tried replacing the MDF and LDF files with the ones that I recovered from a backup.  The problem is that the new MDF and LDF files were not detached in the copy that I have, so when I start up the SQL server EM shows the DB as Loading/Suspect.  I have tried restoring the database using sp_attach_db, sp_attach_single_file_db.  I get the error The log for database DBName is corrupt' when I use sp_attach_db, and when I use sp_attach_single_file_db I get the error 'Database 'DBName' cannot be opened because some of the files could not be activated'



The forums are retiring in 2021 and are now closed for new topics and comments.

Best Answer 6 years ago

Hi..U can get info here:


Click the Windows "Start" button and enter "cmd"
into the text box. Press "Enter" to open your command line utility.

Type the
following command into the command prompt and press "Enter":

cd C:\Program Files\Microsoft SQL Server\100\Setup

This points the command prompt to the location of the
rebuild executable files.

Type the
following text into the command line and press "Enter":

Setup.Exe /Action=RebuildDatabase
/InstanceName=MSSQLSERVER /SqlSysAdminAccounts=Admin

This command rebuilds the database. It may take
several minutes to complete. Once it is finished, the command line returns a
success message.

Or try here: SQL Server Fix Toolbox

version is available here: http://www.fixsqldatabase.com/