0

I want to restore one of my databases from an old backup but the old backups were deleted. So, using a recovery tool, I was able to recover the old backup files. but when I try to restore them I get the below error.

An exception occurred while executing a Transact-SQL statement or batch. (Microsoft.SqlServer.ConnectionInfo). The media family on device '\backupshareBackups\filename.bak' is incorrectly formed. SQL Server cannot process this media family. RESTORE HEADERONLY is terminating abnormally. (.Net SqlClient Data Provider).

Please advise if there is a way I can restore the database from old .bak file. The old backups were taken from the same SQL Server from which I am performing the restore.

2
  • 1
    There shouldn't be any limitation to how old of a backup you can restore. It appears the backup may be corrupted. Can you provide more clarity around the recovery method you used, and what the "save" server is? Commented Jan 25, 2022 at 21:05
  • Hi brendan. thank your for checking. is there a way i can restore or make sql server recognize the media file. its a typo - i meant same server.. i am trying to restore the database from .bak file using gui. I also tried using tsql comands. with regard to .bak file i used external tool to recover the deleted files from my system.
    – anu
    Commented Jan 25, 2022 at 21:19

1 Answer 1

3

The ...filename.bak is incorrectly formed message indicates that the backup file is corrupt. Unfortunately, that error message is bad news when you have no other backup files to use.

File recovery tools that "undelete" files are imperfect, and partial data loss is a consequence. It would seem that whatever file recovery tools you used were not able to fully recover the entirety of the deleted file.

Your first step should be to confirm that you've got the right file, and the right path. If the RESTORE FILELISTONLY command still fails, you'll need to try to find a different backup file, including searching in alternate locations, or checking msdb.dbo.backupset for the possibility of out-of-band or ad hoc backups that might be hiding in unusual locations.

If you can't find a valid, non-corrupt backup, there's no way to force SQL Server to restore a corrupt backup file.

1
  • Typo: RESTORE FILELISTONLY But in this case, it's lost, indeed. Commented Jan 26, 2022 at 9:31

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.