patternsqlMinor
SQL Server Database is corrupted
Viewed 0 times
sqlcorrupteddatabaseserver
Problem
Unfortunately hard disk of my system is damaged, now I recovered my database. But it cannot be attached again to SQL management studio 2005.
The error is:
The error is:
myfile.mdf is not a primary database file. (SQL server , error 5171)Solution
the error is myfile.mdf is not a primary database file.
It means the original database had more files. You need to attach all files, including the log (.ldf) and secondary files. Usually these are named .ndf but in your case they appear to had been named *.mdf, like the primary. It can also happen that you renamed files during your 'recovery'.
If the file name is correct and truly is the original primary file yet it refuses to attach it may be that is corrupted and all data on it is lost. You need to restore from a backup or recreate the DB and re-enter the data again.
It means the original database had more files. You need to attach all files, including the log (.ldf) and secondary files. Usually these are named .ndf but in your case they appear to had been named *.mdf, like the primary. It can also happen that you renamed files during your 'recovery'.
If the file name is correct and truly is the original primary file yet it refuses to attach it may be that is corrupted and all data on it is lost. You need to restore from a backup or recreate the DB and re-enter the data again.
Context
StackExchange Database Administrators Q#74625, answer score: 5
Revisions (0)
No revisions yet.