Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to debug SQL Server 2014 Managed Backup to Azure?

I'm hoping to configure and use SQL Server 2014's Managed Backup to Azure feature. I've tested a manual backup to URL T-SQL query, and it worked. But, the backups created by the managed backup to Azure feature are failing to finish.

The managed backup process leaves a bunch of 0 byte backup files on Azure storage, and they're all locked (active leases) because of the failed backup process. I'm trying to figure out what the issue is. My SQL Server 2014 edition is the Web edition, which apparently does not support compression. The SQL Server Management Studio dialog for configuring the managed backup to Azure feature does not provide any options for compression, though. So, perhaps it's trying to compress the backup file and failing? I don't know how to see what's actually being tried by SQL Server while it does its automated backup to Azure, though. Anybody have any ideas there?

I'm seeing the following errors in the event log ...

Date 10/1/2014 3:10:39 PM Log SQL Server (Current - 10/1/2014 2:42:00 PM) Source Backup Message BACKUP failed to complete the command BACKUP LOG CaseLaw. Check the backup application log for detailed messages.

Date 10/1/2014 3:12:01 PM Log SQL Server (Current - 10/1/2014 2:42:00 PM) Source spid71 Message Error: 18210, Severity: 16, State: 1.

Date 10/1/2014 3:12:01 PM Log SQL Server (Current - 10/1/2014 2:42:00 PM) Source spid71 Message BackupVirtualDeviceFile::DetermineFileSize: SetPosition(0,EOF) failure on backup device 'https://caselaw.blob.core.windows.net/sqldb01-mssqlserver/CaseLaw_d68e6c91feba4f7f891a66cb86fcce8d_20141001151038-05.log'. Operating system error Backup to URL received an exception from the remote endpoint. Exception Message: The remote server returned an error: (409) Conflict..

I can't read the full 409 error message, so I've got no idea what the actual 409 error is. According to MSDN, there are multiple possible 409 responses.

I have been struggling with this issue for several days. I tried a manual scheduled task that runs my T-SQL query, which works, but I can't have it automatically clean itself up after X days, using that method. Any ideas? Thanks!

like image 779
Ryan Avatar asked Oct 01 '14 20:10

Ryan


1 Answers

This is indeed related to COMPRESSION being set on the backup command that gets called by the Managed Backup process.

Enabling debug messages pointed me to the stored procedure getting called: [msdb].[smart_admin].[sp_do_backup]. If you look inside this stored procedure you will see "COMPRESSION" hard coded into the various backup commands that it issues.

A find and replace for "COMPRESSION" to "NO_COMPRESSION" should fix your issue.

Note this only need apply to SQL 2014 Web Edition, as other versions support compression, and this shouldn't even come up.

like image 123
Paul Avatar answered Sep 25 '22 19:09

Paul