DataNumen logo Header Header
  Site Search:
 
  Home » Products » DataNumen SQL Recovery » SQL Server Errors and Problems » xxx.mdf Is Not A Primary Database File
 
         
 
Arrow DATANUMEN SQL RECOVERY
   
  News
  Recovery
  Download
  Order
  FAQ
  View Screenshot
  Awards
   
Arrow RELATED PRODUCTS
Arrow DataNumen Access Repair
Arrow DataNumen DBF Repair
Arrow DataNumen Database Recovery
Arrow DataNumen Oracle Recovery
 
Detailed Information about "xxx.mdf Is Not A Primary Database File" Error

Symptom:

When trying to attach a .MDF database in SQL Server, you see the following error message:

Failed to retrieve data for this request. (Microsoft.SqlServer.Management.Sdk.Sfc)

An exception occurred while executing a Transact-SQL statement or batch. (Microsoft.SqlServer.ConnectionInfo)

xxx.mdf is not a primary database file. (Microsoft SQL Server, Error: 5171)

where 'xxx.mdf is name of the MDF file to be attached.

Screenshot of error message:

Not a primary database file

Precise Explanation:

The data in MDF file are stored as pages, each page is 8KB. The first page is called the file header page, which contains the most important information about the whole file, such as the file signature, file size, compatibility, etc. The remaining pages also contain the important information, including the page allocation information as well as the actual data.

If the MDF file header page, or other important management pages are damaged or corrupted, and cannot be recognized by Microsoft SQL Server, then SQL Server will think the whole file is not a valid primary database file and report this error.

You can use our product DataNumen SQL Recovery to recover the data from the corrupt MDF file and solve this error.

 

Sample Files:

Sample corrupt MDF files that will cause the error:

SQL Server version Corrupt MDF file MDF file fixed by DataNumen SQL Recovery
SQL Server 2005 Error1_1.mdf Error1_1_fixed.mdf
SQL Server 2008 R2 Error1_2.mdf Error1_2_fixed.mdf
SQL Server 2012 Error1_3.mdf Error1_3_fixed.mdf
SQL Server 2014 Error1_4.mdf Error1_4_fixed.mdf