Fix SQL Server Header Error 5172 – The File Size Property Is Incorrect

Admin | October 22nd, 2019 | SQL Server

Without a doubt, Microsoft SQL Server is the most widely used relational database management system for storing and retrieving data. Two types of database files are supported to store their data i.e. MDF (Primary Database File) and NDF (Secondary Database File). It also has a log file with the extension .ldf, which is a transaction log file. However, some disadvantages are also associated with SQL Server. Sometimes users experience Microsoft SQL Server error 5172 – The file size property is incorrect and does not know how to resolve it. To fix this error, we have comes with the successful solution here to fix SQL Server header error 5172. Read on for a 100% working and safe solution.

Error-Free Solution: If you do not have a backup of the database for SQL database file header corruption recovery, you need to download the SQL Server Database Recovery Tool. With this utility, you can fix 5172 error in SQL Server 2019, 2017, 2016, 2014, 2012, and other versions in just a few mouse clicks.
Free Download

Microsoft SQL Server Error 5172

SQL Server stores its physical data in the primary database file, which contains the data by pages. The header information of a .mdf file is stored by the first page, called a header page. This page contains the important information of this database file like file size, signature, etc. When a user attempts to attach the MDF / LDF database file stored on their system, a message box appears “The header for the “test.mdf” is not a valid database file header. The FILE SIZE property is incorrect. (SQL Server error 5172). It occurs when the header information of a .mdf file becomes corrupted.

SQL Server Header Error 5172

Reason For SQL Server Header Error 5172

There can be several reasons for SQL database file header corruption. It may have the following reasons:

  1. Corrupted or damaged log file or data file.
  2. If you try to attach a higher version of the SQL database server file to a lower version.
  3. A sudden power failure that affects the driver and controller.
  4. Failure to shut down the system or restart SQL Server.

Because of all these issues, SQL Server displays a “The file size property is incorrect” error that makes the database file inaccessible.

Read More– How to recover SQL database from suspect mode?

Manual Solution to Fix 5172 Error in SQL Server

To resolve the SQL Server error 5172, you can use the backup of the SQL Server database and restore the data from the backup. However, it may happen that the backup is also in the same location and a sudden power failure occurs, which can damage the SQL backup file. In this case, the following steps had to be performed to fix SQL Server header error 5172:

Step 1: First of all, stop the SQL Server instance.

Step 2: Copy MDF and LDF files to another location.

Step 3: Delete the original MDF and LDF files.

Step 4: Now, restart the SQL Server instance.

Step 5: Create a new database (DB) with the same DB name and file name.

Step 6: Quit SQL Server Management Studio.

Step 7: Overwrite newly created MDF and LDF files.

What if the Error Not Fixed After Performing Manual Method?

There is a possibility that the above mentioned manual process does not resolve Microsoft SQL Server Error 5172 – the header for file is not a valid database file header. If the user does not have a backup of their SQL Server database, then he/she does not execute the manual method. To overcome this problem and resolve SQL database file header corruption without backup, you need to opt for an automated solution.

There is a possibility that the manual process mentioned above does not resolve Microsoft SQL Server error 5172 – The File Size Property Is Incorrect. If the user does not have a backup of the SQL Server database, he/she is unable to execute the manual method. To resolve all these issues and fix SQL database file header corruption without backup, you must opt for an automated solution.

One-Stop Solution to Fix SQL Server Header Error 5172

To rapidly resolve this error, you can take the help of the SQL Server Database Recovery Tool. This will let you fix Microsoft SQL Server error 5172 header issue without backup. Using this utility, you can recover corrupt MDF file and NDF file with all database components like table, views, indexes, stored procedures, etc. It supports all versions of SQL Server including 2019, 2017, 2016, 2014, 2012, 2008, and others. The tool helps to recover SQL Server Database from MDF file and restore data into the live SQL Server database or Compatible SQL Script.

Free Download

The MDF file recovery software can also recover deleted records from SQL Server table and display the preview in red color. It allows you to restore SQL Server database to a new database or an existing database without any issue of data loss. The tool is capable to fix the header for file is not a valid database file header error and gives you 100% reliable and quick result.

Procedure to Resolve SQL Database File Header Corruption

Follow the below-listed steps to fix SQL Server header error 5172 using the SQL Database Recovery tool.

Step 1. Download and launch the software. Click the Open button and select the MDF file which is corrupted.

Select Corrupt MDF File

Step 2. Choose the Scan Mode option from Quick and Advanced. Select SQL Server .mdf file version. If you want to view the deleted records, check the “Preview Deleted Records” box.

Scan Mode

Step 3. Now, the tool displays the preview of recovered database items after the scanning process. You can see the deleted records in red color.

Recover Deleted Records

Step 4. Click the Export button and export the MDF file to SQL Server Database or SQL Server Compatible SQL Scripts according to the needs.

Restore SQL Server Database

Step 5. Export MDF file with schema only or schema & data both. In the end, click the Export button.

Export

Conclusion

This blog described the whole solution of how to deal with Microsoft SQL Server error 5172. Here we explained the manual approach for fixing this error using the backup. If users do not have a backup of their SQL Server database, we also mentioned the automated solution that can fix SQL Server Header Error 5172 – The FILE SIZE property is incorrect without backup. You can choose any of the methods to resolve SQL database file header corruption issue that meets your needs.