What happens to an Azure SQL Database LTR back-ups when the original database is deleted in Azure

Joel Fernandes 1 Reputation point
2021-12-11T01:23:07.673+00:00

I have a database that was deleted in the Azure portal. The database had LTR backups that will be retained for 10 years. The last restore point available for the database is 35 days. If I recall correctly, the database will be permanently deleted after 35 days. What will happen to the LTR backups in this case? If the LTR backups will also be permanently deleted along with the database, is there a way to restore the database with all the LTR backups?

I restored the database (PITR) to the point at which it was deleted. However, the LTR backups were not restored.

Azure SQL Database
0 comments No comments
{count} votes

1 answer

Sort by: Most helpful
  1. Alberto Morillo 34,676 Reputation points MVP Volunteer Moderator
    2021-12-11T03:23:10.353+00:00

    Before trying to restore from backups, could you open the Azure SQL logical server using Azure portal, and try to restore the deleted database? See image below:

    156738-image.png

    If you cannot restore the database using Azure portal, try using the following PowerShell commands:

    PS C:\>$DeletedDatabase = Get-AzSqlDeletedDatabaseBackup -ResourceGroupName "ResourceGroup01" -ServerName "Server01" -DatabaseName "Database01"  
    

    The above command gets the deleted database backup that you want to restore by using Get-AzSqlDeletedDatabaseBackup.

    Now, the next PowerShell command starts the restore from the deleted database backup by using the Restore-AzSqlDatabase cmdlet. If the -PointInTime parameter is not specified, the database will be restored to the deletion time.

    PS C:\> Restore-AzSqlDatabase -FromDeletedDatabaseBackup -DeletionDate $DeletedDatabase.DeletionDate -ResourceGroupName $DeletedDatabase.ResourceGroupName -ServerName $DeletedDatabase.ServerName -TargetDatabaseName "RestoredDatabase" -ResourceId $DeletedDatabase.ResourceID -Edition "Standard" -ServiceObjectiveName "S2" -PointInTime UTCDateTime.  
    

    Hope this helps.


Your answer

Answers can be marked as Accepted Answers by the question author, which helps users to know the answer solved the author's problem.