Wednesday, 2 June 2021

Recover Deleted Azure Database using LTR backups


I have had many queries in past where there was scenario where PROD Azure DB has to be restored which mean a new DB is created in Azure DB and users were not sure if they will loose the LTR backups of the old databases if deleted and kept paying for an unused DB.

Most of the confusion comes when you delete the database in Azure option to access LTR backups of the deleted DB though portal goes away which makes the users think the backups are also deleted permanently. This is not true even though you have deleted the DB the LTR backups are always retained according to your retention policy. It is only not accessible though Poral, You can use Powershell or AzureCLI to access it.

use the below Powershell it will return all the LTR backups on your location,

Get-AzSqlDatabaseLongTermRetentionBackup -Location <yourAzDClocation>



You can use the filer at SQL instance level, DB level and Resource group level too. So don't be afraid of losing your LTR backup when you delete the DB.

But PiTR backups is a different story, by default the backup can be recovered within 7 days(unless you have set PiTR backups to one day) from deleted DB folder in portal or using Powershell ( https://docs.microsoft.com/en-us/azure/azure-sql/database/recovery-using-backups#deleted-database-restore ) After which you will loose the DB if there are not LTR backups so be careful before deleting Azure databases with no LTR backups.

No comments:

Post a Comment