Sunday, February 6, 2011

How to Resolve Error 5171 in Microsoft SQL Server Database

Most of the companies use Microsoft SQL server database for storing their database where database administrator handle all the issue for maintaining the database by the use appropriate SQL server commands. Microsoft SQL server database may be corrupted by Improper system shutdown, hardware failure, SQL Server malfunctioning, virus infection, hardware failure and many more. Once SQL server database gets damaged, the data stored in the SQL Server become inaccessible. In such scenarios, use latest and updated backup, if backup is not updated, then database administrator needs to used a third party MS SQL database recovery software to repair mdf file.

Consider a situation, wherein a database administrator is working on SQL Server database and creating a report. While doing this, the Windows automatically restarts due to power failure. When database administrator restart the system, the SQL server database becomes inaccessible. When the database administrator tries to attach MDF manually, he encounters the given below error message:

“An exception occurred while executing a Transact-SQL statement or batch. _db.mdf is not a primary database file. (Microsoft SQL Server, Error: 5171).”


“C:\Program Files\Microsoft SQL Server\MSSQL.1\MSSQL\Data\MYDATABASE.mdf is not a primary database file. (Microsoft SQL Server, Error: 5171)”

In such situations, most the database expert recommend to attach a single file. However, when the database administrator uses sp_attach_single_db Stored Procedures, the database administrator encounters the given below error message:

“Server: Msg 5172, Level 16, State 15, Line 1 The header for file path……\.mdf is not a valid database file header. The PageAudit property is incorrect.”

The above problem generally occurs when the Master database file header gets damaged/corrupted or some invalid value is inserted in the master database header file. All of these situations became, inaccessibility of the SQL server database. To accessibility of the SQL server database, the database administrator needs to recover mdf by using the updated backup. But sometime database administrator has not created any backup of its SQL server database, then he needs to perform MDF file repair. To do so, database administrator needs to use an effective and efficient SQL recovery application.

Most of the database experts recommend Stellar Phoenix SQL Recovery software to repair the corrupted mdf file. This software uses an advanced scanning algorithm to repair and recover corrupted mdf file. It is compatible with SQL server 2008, 2005, 2000, and 7.0

Related article is available here: How to restore MSSQL error 5171 

1 comment:

  1. This comment has been removed by a blog administrator.