How to restore Azure SQL database without losing backup history

Josh Ashwood 91 Reputation points
2023-09-19T23:36:08.31+00:00

We would like to be able to restore an Azure SQL database to the same name. This isn't possible and the best we can do is to restore to a new name, delete the old, and then rename the new database to what the old one was originally called.

But in doing so we lose all the backup history of the original database.

How can we retain the backup history? Or is this a showstopper that forces us to use managed instance?

thanks

Josh

Azure SQL Database
{count} votes

Accepted answer
  1. Alberto Morillo 33,611 Reputation points MVP
    2023-09-20T04:00:22.2766667+00:00

    Somebody made the same question 3 years ago in Stackoverflow as you can see here My answer for you is the same. Unfortunately, restoring from a backup in Azure SQL Database always creates a new database. The secret here is to rename the newly restored database with the name of the original database. You will even see that the restored database once renamed it then shows all the security recommendations, automatic tuning recommendations of the original database.

    So, delete existing database, restore the database, and rename it as the original database and all the backup history will be preserved.

    1 person found this answer helpful.
    0 comments No comments

1 additional answer

Sort by: Most helpful
  1. Josh Ashwood 91 Reputation points
    2023-09-20T05:59:51.27+00:00

    So, delete existing database, restore the database, and rename it as the original database and all the backup history will be preserved.

    EDIT: Ah yes, i see this will work for us, albeit that the backup history is only retained in the deleted datbase - which is fine

    Thanks


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.