Share via

How to recover deleted sql server

VPI Hodling 0 Reputation points
2025-11-14T07:24:19.4333333+00:00

Hi, I have deleted a SQL server and resource and databse. How do I go about recovering it

Azure SQL Database

Answer recommended by moderator
  1. Anonymous
    2025-11-15T01:31:49.5033333+00:00

    Hi VPI Hodling ,

    Welcome to Microsoft Q&A and thank you for posting your question!

    Unfortunately, once an Azure SQL Server resource is permanently deleted, it cannot be recovered. However, you can restore the database if it was deleted within the retention period and backups are still available.

    Recovery Options

    1. Check if the server still exists
      • Go to Azure Portal → SQL Servers.
      • If the server is gone, create a new SQL Server in the same region and subscription.
    2. Restore from Backup
      • Navigate to Azure Portal → SQL Databases → + Create → Restore.
      • Select Backup source:
        • Deleted database (within retention period, usually 7 days).
        • Backup from another server (if available).
      • Configure:
        • Target server (existing or newly created).
        • Database name, compute, and storage.
      • Click Review + Create.
    3. Elastic Pool Scenario
      • If the database was part of an elastic pool, recreate the pool first, then restore the database into it.
    4. Validate After Restore
      • Test connectivity using SSMS or Azure Data Studio.
      • Update connection strings if the server name changed.

    If Both Server and Database Are Permanently Deleted

    Recovery is not possible unless:

    • You have Geo-restore backups in another region.
    • You exported a BACPAC file to storage earlier.

    References

    0 comments No comments

1 additional answer

Sort by: Most helpful
  1. Q&A Assist
    2025-11-14T07:24:47.8733333+00:00
    AI generated content. This question contains an answer created with AI from Q&A Assist. Learn more

    To recover a deleted SQL server and its databases, you can use the following methods based on the context provided:

    1. Azure SQL Database: If you deleted a database, you can restore it to the deletion time or an earlier point in time using the Azure portal, Azure CLI, Azure PowerShell, or the REST API. However, if the server itself was deleted, all databases and their backups are also deleted, and you cannot restore them from point-in-time restore (PITR) backups.
      • If you had configured Long-Term Retention (LTR) backups, you can restore the databases to a different server using those backups.
      • Use Azure CLI or PowerShell commands to view and restore LTR backups if the logical server has been deleted.
    2. Recovering Deleted Servers: If you accidentally deleted a server, you can recover it using Azure CLI with point-in-time restore (PITR) if backups are available. Here’s a sample command:
         az mysql flexible-server restore \
         --resource-group <RESOURCE_GROUP_NAME> \
         --name <NEW_SERVER_NAME> \
         --source-server <DELETED_SERVER_NAME> \
         --restore-time <TIMESTAMP>
      
      Make sure to replace <TIMESTAMP> with the time just before deletion.
    3. Resource Locks: To prevent accidental deletions in the future, consider applying Azure Resource Locks to your SQL servers and databases. This will help safeguard critical resources from unintended deletions.

    Make sure to check the availability of backups and follow the appropriate recovery procedures based on your specific scenario.

    0 comments No comments

Your answer

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