I'm attempting to backup a database (full backup, in simple recovery) to Azure storage, replacing a bak file that already exists, then restoring the new backup. Doing a regular backup and restore works fine, but when I replace a backup in Azure using WITH FORMAT, any subsequent restore commands fail with The media family on device 'https://account.blob.core.windows.net/container/dbname.bak' is incorrectly formed. SQL Server cannot process this media family.

Here's the backup SQL:

TO URL = 'https://account.blob.core.windows.net/container/dbname.bak'

This is with a backup already existing at that URI. This part succeeds, and I can see that the modify date of the blob has been updated. Then running:

FROM URL = 'https://account.blob.core.windows.net/container/dbname.bak'

fails with the above mentioned error. I get the error whether I'm on a different instance or on the same instance as the original database. Is using WITH FORMAT actually corrupting the backup? What am I doing wrong here?

This seems to be the recommended way to overwrite Azure blob backups.

  • 2
    Have you tried it using WITH FORMAT, INIT ? – Max Vernon May 24 '18 at 18:57
  • Also, I would add the CHECKSUM option to the backup to ensure the file is being written correctly. If the backup operation detects a checksum error when creating the backup file, you'll know before you even attempt the restore. See docs.microsoft.com/en-us/sql/relational-databases/… for details – Max Vernon May 24 '18 at 19:15
  • Also, what version of SQL Server is this? – Max Vernon May 24 '18 at 19:16
  • SQL Server 2016 SP2. I tried CHECKSUM and didn't get any error. I'll attempt again using INIT. – D. Azucena May 25 '18 at 19:39
  • Did you find a fix for this? I'm having the same issue. – Martin Gibson Apr 9 at 11:05

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.