Sql-server – Why is the lease locked for a some full sql backups to Azure Blob using Ola Hallengren backup scripts

azure-sql-databaseola-hallengrensql server

I'm using SQL Server 2012 and working on backing up to Azure Blob using Ola Hallengren backup scripts.

Some backups are lease locked (ex. model) while others are not (ex. msdb). It's inconsistent, it can be vice-versa, completely locked or unlocked.

Why are the backups being lease locked? How do I have them all unlocked?

Best Answer

Do you know what version of each you are using? How close are you watching this in real time? I'm hoping the below quotes and links with the questions above will help spur you towards the right direction here.

When backing up to or restoring from Windows Azure storage, SQL Server acquires an infinite lease in order to lock exclusive access to the blob. When the backup or restore process is successfully completed, the lease is released. If a backup or restore fails, the backup process attempts to clean up any invalid blob.

Reference

The Lease Blob operation establishes and manages a lock on a blob for write and delete operations. The lock duration can be 15 to 60 seconds, or can be infinite. In versions prior to 2012-02-12, the lock duration is 60 seconds.

Starting in version 2012-02-12, some behaviors of the Lease Blob operation differ from previous versions. For example, in previous versions of the Lease Blob operation you could renew a lease after releasing it. Starting in version 2012-02-12, this lease request will fail, while calls using older versions of Lease Blob still succeed. See the Changes to Lease Blob introduced in version 2012-02-12 section under Remarks for a list of changes to the behavior of this operation.

Reference