Bringing back the dead, restoring the deleted database in Azure SQL Server

This is a part of series “Stairway to being an Azure SQL DBA“, where I will be covering all the topics that an Azure SQL DBA should know about.

You never know when the need arises, may be someone deleted the wrong database, pretty possible if you have provided everyone contributor access at the Resource Group level in Azure, or you want an intentionally deleted database, or some other reason.

The databases can be recovered but only when you are within the time of Retention policy you had set for the Azure SQL databases.

If you have been following along you might already know that by default Backup policy maintains PITR for 7 days, so if you haven’t changed the defaults or set the Long term Retention configurations you will not be able to restore the database after the 7 day period.

Backup Policies

If you are within this period you can easily restore the database using the Deleted Database tab in the SQL Server.

Deleted Database

Just select the database that you wish to restore back, and in the next tab it will provide the option to restore back your database.

Restoring the deleted database

Select the restore point and database name and you are good to go.

Point to note here is you can only restore a deleted database only from the same SQL Server where that database existed. If you have deleted the whole SQL Server then all the backups are also deleted and so you won’t be able to restore.

Secondly, I’ll prefer the PowerShell way to restore the Azure SQL Database as using the portal it creates a new database of Gen5 – General Purpose configuration.

To restore using PowerShell check this link.

I hope it helps!

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Google photo

You are commenting using your Google account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s