Corruption in MDF of SQL Server 2012!

While accessing to an .mdf file, I receive this: MyFileName.mdf is not a primary database file. Does it mean the file is corrupted?

Please help in repairing this file. I heard about some manual tricks to fix SQL database corruption, but I’m not aware of it.

Please share it.
Thanks. :slight_smile:

When you try to attach a MDF database to SQL Server and get the error “xxx.mdf is not a primary database file”, then for most of the cases, that means your MDF file is corrupt or damaged.

There are two possible solutions based on the situation:

  1. If the corruption is not severe, then you can use the SQL Server build-in command DBCC CheckDB to correct the errors. See . I guess that is what you mean “manual tricks”.

  2. If the corruption is severe, then you may try some third party tools to scan and recover the data from your corrupted MDF and NDF database files. Below is a list of SQL recovery tools:

The list seems to rather comprehensive that including nearly all the popular tools in the market.

Hope this will help. Good luck!


As the OP hasn’t returned that must have solved the problem

Thread Closed