Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations gkittelson on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Repair a corrupt .mdf file that is detached

Status
Not open for further replies.

bmclaws

Technical User
Nov 19, 2001
9
US
After SQL Server crashed, one of my databases showed up as suspect. I attempted to detach and reattach it, but the reattach process will not complete due to Code Page errors in the .mdf file.

Is there any way of 'repairing' the .mdf file so that I can reattach it? Any attemp at running dbcc checkdb results in a message saying that the database isn't found in the sysdtabases table.

Thanks,

Barry
 
Terry,

Thanks for the quick reply. I reviewed the article and found that in order to use that method, the database has to still be attached. Unfortunately, since I detached it, the error in the .mdf file (Code Page error), prevents me from re-attaching it.

Each time I try to attach it, EM tries to undue the last transactions prior to the crash (using the log, I assume) and stops about 40% of the way through and gives me the Code Page error.

I renamed the log and tried to reattch as a single db, but that fails due to missing files.

Any ideas?

Thanks again,

Barry
 

The best option would seem to be restoring the database from a backup if one is available. Did you try setting the server in emergency mode (per the FAQ) and then attempting the attach? I have no idea if that would work.

Sorry that I can't be of more help. Terry L. Broadbent
FAQ183-874 contains tips for posting questions in these forums.
NOTE: Reference to the FAQ is not directed at any individual.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top