Q
Problem solve Get help with specific problems with your technologies, process and projects.

Repairing corrupt MDF files

I had to run a query to delete duplicate records. There was not enough room to perform the transaction due to limited disk space, and I did not like not having a backup of the data. We moved the data to a new disk (so I could do a backup and have room for the transaction log to grow), although we had a few problems reattaching the database due to a log file we deleted. After reattaching (four hours later), I tried to run a query and received the following error message:
 Server: Msg 823, Level 24, State 2, Line 1 I/O error 23(Data error (cyclic redundancy check).) detected during read at offset 0x000000167b0000 in file 'F:MDFTriggerTrigger_Data.MDF'.
After much research, I discovered the issue is a corrupt block on the disk. I am now copying the files back to the original location. However, I fear that one of the MDF files is now corrupt. I know I am copying the corrupt data back too, but thought there may be utilities or methods of repairing the corrupt data? Have you any solutions you can offer to sort out this god forsaken mess?
Once you have copied it to a corrupt disk block, copying it back won't fix the problem. First run a DBCC on the database to determine where the problem is. If it is in an index, simply drop and recreate the index to clean it up. If it is in the table itself, you are going to have to pull out your backups at this point.

Dig Deeper on Microsoft SQL Server Installation

Have a question for an expert?

Please add a title for your question

Get answers from a TechTarget expert on whatever's puzzling you.

You will be able to add details on the next page.

Start the conversation

Send me notifications when other members comment.

Please create a username to comment.

-ADS BY GOOGLE

SearchBusinessAnalytics

SearchDataCenter

SearchDataManagement

SearchAWS

SearchOracle

SearchContentManagement

SearchWindowsServer

Close