Upload
jasonclark03
View
669
Download
3
Embed Size (px)
Citation preview
SQL Error 5171- .mdf is not primary
database file
Topic Setups Overview - SQL Error 5171 Error Message Recovery Methods to fix Error 5171
oManual Solutions Single file attachment procedure Restore database from .bak file Manual method failure
o Alternate Solution Third party tool
Conclusion
Overview ~SQL Error 5171SQL Error 5171 states that MDF file is not primary file. The root cause of this error message is that the database file is corrupt. It may be possible because of various reasons such as: Power surges Human errors Virus infections, etc.
Error Message
Recovery Methods to fix Error 5171
1. Manual Solution: (I) Single file attachment procedure(II) Restore database file from .bak file
2. Alternative Solution
Single File Attachment ProcedureSingle file attachment process allows you to attach single file one by one to the database Execute sp_attach_single_db stored procedure. Syntax:
Restore Database From .bak File This method helps you to restore the database from full backup.
Open SQL Server Management Studio then Right Click on ‘Databases’ and select ‘Restore Database’
Manual Solutionso Due to high level corruption, sp_attach_single_db get fails to fix the SQL Error 5171
Sometimes you don’t have a healthy backup to restore database, In such situation, you must have an alternative solution.
Third Party Tool
Recover both MDF and NDF file
Recover Deleted SQL Tables Data
Directly export into SQL Server 2014
Quick and Advanced scan option
Support XML Data Type
The SysTools SQL Recovery tool is a secure, trustworthy and result oriented way to recover & restore MDF file.
Conclusion Restoration from manual method turns difficult when you don’t have a clean backup of the database and 'sp_attach_db' method won’t work if you do not use 'sp_detach_db' for detaching the same database In such situation you need to have an SQL recovery software like SysTools SQL Recovery, which can easily recover your database