[Company Logo Image] 

Home Up Contents Coffee Break Credits Glossary Links Search

Not a Valid Database File Header



Analysis Services
CLR Integration
High Availability
Open Source
SQL Server 2008
SQL Server 2012
SQL Server 2014
SQL Server 2016
SQL Server 2017
SQL Server 2019

Not a Valid Database File Header.

Applies to: SQL Server 2014.

Problem Description.

One of my students copied the AdventureWorksDW database from a USB drive into a Laptop disk drive and proceeded to attach it to the SQL Server instance installed on that laptop, when he received the following error message.

Attach database failed for Server 'XXXXX'. (Microsoft.SqlServer.Smo).
An exception occurred while executing a Transact-SQL statement or batch.

The header for file 'C:\Program Files\Microsoft SQL Server\MSSQL12.MSSQLSERVER\MSSQL\DATA\AdventureWorks_Log.ldf' is not a valid database
file header. The FILEID property is incorrect. (Microsoft SQL Server, Error: 5172)



The database file was corrupted. Every database file has a 8 KB page where the metadata of the database is stored, and that page was corrupted on this database file.

The student told me he tried many times to transfer the 2 database files associated to the Adventure works database, since the USB drive he used was getting disconnected/reconnected by itself while transfering them from the USB to the PC disk drive.

Sometimes this may happen when downloading databases files from the Internet too. Sometimes the database files are corrupted on the source and sometimes they get corrupted during the download process.


I recommended the student to use a different USB drive to get a copy of the AdventureWorks database. That worked for him.

Downloading the files from a different source or downloading them again may work if you are getting the database files from the Internet.




.Send mail to webmaster@sqlcoffee.com with questions or comments about this web site.