When using Microsoft SQL Server to attach or access a corrupt MDF database file, you may encounter a variety of error messages that can be confusing. Below, we will list all errors, sorted by frequency. For each error, we will outline its symptoms, explain the exact cause, and provide sample files along with the files fixed by DataNumen SQL Recovery. This will help you better understand these errors. Note ‘xxx.MDF’ will represent the name of your corrupt SQL Server MDF database file.

Based on SQL Server or CHECKDB error messages, there are three kinds of errors:

    1. Allocation errors: We know the data in MDF & NDF files are allocated as pages. And there are some special pages that are used for allocation management, as follows:
Page Type Description
GAM Page Store global allocation map(GAM) info.
SGAM Page Store shared global allocation map(SGAM) info.
IAM Page Store index allocation map(IAM) info.
PFS Page Store PFS allocation info.

If any of the above allocation pages have errors, or the data managed by these allocation pages are inconsistent with the allocation information, then SQL Server or CHECKDB will report allocation errors.

  • Consistency errors: For pages that are used to store data, including the data pages and index pages, if SQL Server or CHECKDB find any inconsistency between the page contents and the checksum, then they will report consistency errors.
  • All other errors: There may be other errors not fall into the above two categories.

 

SQL Server has a built-in tool called DBCC, which has CHECKDB and CHECKTABLE options that can help to repair a corrupt MDF database. However, for severe damaged MDB database files, DBCC CHECKDB and CHECKTABLE will also fail.

Consistency errors reported by CHECKDB:

Allocation errors reported by CHECKDB:

All other errors reported by CHECKDB: