I deleted the database, how can I get it back?

Hakan AK 0 Reputation points
2024-11-27T11:42:33.2433333+00:00

hi

I deleted the database, how can I get it back?

Azure SQL Database
{count} votes

2 answers

Sort by: Most helpful
  1. Shikha Ghildiyal 695 Reputation points Microsoft Employee
    2024-11-27T12:07:46.9733333+00:00

    Hi @Hakan AK,

    Thanks for reaching out to Microsoft Q&A.

    If you've accidentally deleted an Azure SQL Database, recovery depends on several factors, including whether the database was deleted permanently or if backups are available. Here’s what you can do:

    1. Check the Retention Period for Automated Backups

    Azure SQL Database provides automated backups that include:

    Point-in-Time Restore (PITR): Can restore the database to a state at any point within the retention period.

    Long-Term Retention (LTR): If configured, can restore backups stored for months or years.

    Steps:

    Log in to the Azure Portal.

    Navigate to the SQL Server that hosted your database.

    Go to the Deleted databases section under the SQL Server:

    Check if the deleted database is listed here. If yes, restore it using the available backups.

    1. Restore Using Point-in-Time Recovery

    If the database is not listed under "Deleted databases," you can still recover it if it's within the PITR retention period.

    Steps:

    In the Azure Portal, go to the SQL Server that hosted the database.

    Click on Backups in the SQL Server menu.

    Select Point-in-time restore for the deleted database.

    Choose the time to restore the database to and specify a name for the new database.

    Confirm and start the restore process.

    1. Check Long-Term Retention (LTR) Backups

    If you had LTR configured, you can restore from an LTR backup.

    Steps:

    Navigate to the SQL Server in the Azure Portal.

    Go to the Manage Backups section.

    Check if there are LTR backups for the deleted database.

    Select the backup, click Restore, and specify the restore options.

    1. Contact Microsoft Support (Last Resort)

    If no backups are available and the database is critical:

    Open a support ticket with Microsoft Azure Support.

    Provide them with the database name, server name, and deletion time.

    Microsoft may be able to help retrieve the data if recovery is initiated promptly.

    1. Future Recommendations

    To prevent accidental deletion and ensure easier recovery:

    Enable Soft Delete for Azure SQL Databases, if available.

    Use Long-Term Retention (LTR) for critical databases.

    Set up Resource Locks in the Azure Portal to prevent accidental deletion:

    Go to the resource (SQL Database or Server).

    Click Locks and add a lock with type ReadOnly or Delete.

    Let me know if you need help with any of the recovery steps!

    Please do not forget to "Accept the answer” and “up-vote” wherever the information provided helps you, this can be beneficial to other community members.

    0 comments No comments

  2. Nandan Hegde 32,831 Reputation points MVP
    2024-11-27T13:07:58.4933333+00:00

    Adding to what Shika stated, assuming you have just deleted the database and not the server:

    User's image

    If server is also deleted, and not replicas are created at server level; then you need to raise a support tkt with MSFT team


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.