Home Forums SQL Server 2005 Data Corruption Recovering a SQL Server 2005 Database from a Corrupt .mdf RE: Recovering a SQL Server 2005 Database from a Corrupt .mdf

  • I’d try the procedure described below or third party tool such as

    Recovery Toolbox for SQL Server https://repairsql.recoverytoolbox.com/[/url]

    If that doesn’t work and database is severely corrupted.

    There might be other options out there. This is something that worked for me once but there are no guarantees that it will work at all

    times.

    Stop SQL Server instance

    -> Copy MDF and LDF files to another location

    -> Delete original MDF and LDF files

    -> Start SQL Server instance again

    -> Create new database with exact same name and file names

    -> Stop SQL Server

    -> overwrite newly created MDF and LDF.

    After this your database should be back online. If it is then go ahead and put it into EMERGANCY mode and SINGLE USER mode.

    Finally go ahead and execute DBCC CHECKDB like this DBCC CHECKDB (databaseName, REPAIR_ALLOW_DATA_LOSS) WITH NO_INFOMSGS

    If you can get to this and execute last command successfully you should be good. If not then your only options are restoring from backup and/or using third party tool.