Restoring sql database from recovered .bak file



  • 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.



  • 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.




Suggested Topics

  • 2
  • 2
  • 2
  • 2
  • 2
  • 2
  • 2
  • 2
  • 2
  • 2
  • 2
  • 2
  • 2
  • 2
  • 2