SQL Server – How to Attach a Corrupted Database

corruptionsql server

In a little C# tool, I use an a mdf file to save my data.

The file became inconsistent, which isn't really a problem as there only a few changes since my last backup.

Anyway, I would still like to take a look at my last transaction to see what went wrong.

But I can't find a free tool to do so.

  • ApexSQL requires an SQL Server connection.
  • SysTool SQL Analyzer only allows for the first 50 rows, I have about 250.
  • ::fn_dump again only on the SQL Server.

I have a running SQL Server available but can't attach the mdf file due to its corrupted state.

Is there a (free) way to view the log file? Doesn't need to be pretty, doesn't need special filters or search functions just plain and simple viewing.

Best Answer

Try creating a dummy database as documented in:

Creating, detaching, re-attaching, and fixing a SUSPECT database by Paul Randal

This sometimes can "trick" the server into mounting a corrupt database.