Tuesday, February 14, 2012

Corrupted mdf

Hi Everyone,

when i am trying to attach a 'xxx.mdf' file it is showing message 'xxx.mdf' is not a primary database file.

Please suggest me what could be the reasons and what are the possible ways to recover my database.

I have lot of important data in the database.

Thanks and Regards,
ShashidharWe need substantially more information here.

What version of SQL?
What OS?

How did the file become detached in the first place (deliberate action, a download, or was it recovered from some where?)

Is is possible that the file is one of multiple files belonging to a single database?

Where is the log file?

What is the precise error message you are getting?

Did you google that error message?

And, if it's got so much valuable information, where's your backup?

Regards,

hmscott|||Go back to the server that this database was detached from. If you only copied the files, as opposed to moving them, you should be able to find all the files needed for the database. The error message means that SQL Server can not find the system tables in the file you listed first in the sp_attach_db statement. If you have multiple data files (as I strongly suspect from the error message), try changing the order of them in the sp_attach_db statement.
Lesson for the future: Always write down the order of the files BEFORE attaching them.|||I would say it's not a primary database file|||Correct me if I am wrong but isn't the mdf file always the primary database files and the ndf is secondary?|||Consider yourself corrected. The file extension is only suggested, and in no way means that a file is a primary or secondary file. You can make all of your files MDF, NDF, LDF, or even BOB.|||... or even BOB.

BOB. I like BOB. ;)

Regards,

hmscott|||I think I might prefer LongTallSally

No comments:

Post a Comment