With Microsoft Azure pitching in the market, I am getting few clients who want me to assist them for errors related to Azure as well. As a part of growth, I do learn them and try to help the clients. Let us learn about Block Blobs in this blog post.
My client was migrating their on-premise SQL Severs to SQL running under Azure virtual machines. They have decided to move database via backup restore.
- Source SQL Server (On-Premise): SQL 2012 Standard.
- Destination SQL Server (SQL on Azure VM): SQL 2014 Enterprise
While restoring from the Azure storage using “Restore … from URL” command, we were seeing below error in ERRORLOG.
BackupVirtualDeviceFile::DetermineFileSize: SetPosition(0,EOF) failure on backup device ‘https://sqlauth storagehdd.blob.core.windows.net/sqlbackup/DBName.bak’. Operating system error The specified URL points to a Block Blob. Backup and Restore operations on Block Blobs are not permitted.
BackupVirtualDeviceFile::DetermineFileSize: SetPosition(0,EOF) failure on backup device ‘https://sqlauth storagehdd.blob.core.windows.net/sqlbackup/DBName.bak’. Operating system error The specified URL points to a Block Blob. Backup and Restore operations on Block Blobs are not permitted.
I asked the method to transfer the data from the source server to Azure. They told that they have used AzCopy to copy the data from the local machine to Azure storage. So essentially, database backup was taken locally on On-Prem machine and then AzCopy was used to copy the backup files. They have not used “BACKUP … to URL”
Transfer data with the AzCopy on Windows
I looked into documentation of SQL 2012 and SQL 2014 and found below.
SQL Server Backup and Restore with Windows Azure Blob Storage Service
Blob: A file of any type and size. There are two types of blobs that can be stored in the Windows Azure Blob storage service: block and page blobs. SQL Server backup uses page Blobs as the Blob type. Blobs are addressable using the following URL format: https://<storage account>.blob.core.windows.net/<container>/<blob>
Caution |
If you choose to copy and upload a backup file to the Windows Azure Blob storage service, use page blob as your storage option. Restores from Block Blobs are not supported. RESTORE from a block blob type fails with an error. |
Separately, in SQL Server 2014, we were able to see the same limitation listed, but under a different topic: SQL Server Backup to URL
Blob: A file of any type and size. There are two types of blobs that can be stored in the Windows Azure Blob storage service: block and page blobs. SQL Server backup uses page Blobs as the Blob type. Blobs are addressable using the following URL format: https://<storage account>.blob.core.windows.net/<container>/<blob>
Warning |
If you choose to copy and upload a backup file to the Windows Azure Blob storage service, use page blob as your storage option. Restores from Block Blobs are not supported. RESTORE from a block blob type fails with an error. |
SOLUTION / WORKAROUND
It looks like, the backup file was turned into a block blob, and that explains the cause of the error during restore. I think the above is implying that the transfer tool (AZCopy) may have been configured to use block blob to transfer the backup file by default. After reading further about the tool, I found there is a parameter called /BlobType:Page. Once we used that parameter, restore worked like a charm.
Reference: Pinal Dave (https://blog.sqlauthority.com)
First appeared on SQL SERVER – Unable to Restore from URL – The Specified URL Points to a Block Blob. Backup and Restore Operations on Block Blobs are not Permitted