[Company Logo Image] 

Home Up Contents Coffee Break Credits Glossary Links Search

 
Not a Valid Database File Header

 

 

Home
Analysis Services
Azure
CLR Integration
High Availability
Open Source
Security
SQL Server 2008
SQL Server 2012
SQL Server 2014
SQL Server 2016
Tips
Troubleshooting
Tuning

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.
(Microsoft.SqlServer.ConnectionInfo)

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)





 

Cause
 

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.


Workaround
 

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.