The header for file 'xxx.mdf' is not a valid database file header. The FILE SIZE property is incorrect
-1
votes
1
answer
3697
views
Updated Question :
The issue occurred when the SQL Data and Log Disk were unknowingly detached from the VM server.
After realizing this, the disks were reattached, but the detachment and reattachment at the VM level caused the database to enter a recovery pending state.
Subsequently, the emergency mode and recovery with data loss commands were executed. However, after this process, some records were found to be completely removed at the page level from the data file.
To recover the lost data, we attempted to restore from a backup taken before running the recovery with data loss command.
However, repairing and attaching the specific data file resulted in file header and other issues.
We are facing an issue after unknowingly detaching a disk from the server:
> Msg 5172, Level 16, State 15, Line 3
> The header for file 'E:\DATABASE\xxxx.mdf' is not a valid database file header. The FILE SIZE property is incorrect.
>
> Msg 1802, Level 16, State 7, Line 3
> CREATE DATABASE failed. Some file names listed could not be created. Check related errors.
>
> FileMgr::StartLogFiles: Operating system error 2 (the system cannot find the file specified.) occurred while creating or opening file 'D:\DATABASE\xxxx.LDF'. Diagnose and correct the operating system error, and retry the operation.
>
> Operating system error 38 (Reached the end of the file.) on file "D:\DATABASE\xxxx.LDF" during SQLServerLogMgr::ReadFileHdr.
We don’t have a recent backup—only a full backup from the previous day.
Asked by Selva
(25 rep)
Mar 11, 2025, 04:58 PM
Last activity: Mar 12, 2025, 10:17 PM
Last activity: Mar 12, 2025, 10:17 PM