Estado droppoing PostgreSQL Flexible Server

Brayan Riveros 0 Reputation points
2025-10-23T18:45:35.5+00:00

Trate de hacer restore a mi DB y esta se quedo en estado Dropping por algún motivo

Quiero que se elimine completamente

Azure Database for PostgreSQL
0 comments No comments
{count} votes

1 answer

Sort by: Most helpful
  1. Swapnesh Panchal 750 Reputation points Microsoft External Staff Moderator
    2025-10-23T19:03:37.21+00:00

    Hi Brayan Riveros ,

    Thank you for reaching out to Microsoft Q&A.

    “Dropping” can mean two different things in Azure Database for PostgreSQL – Flexible Server. The fix depends on whether the database inside the server is stuck, or the entire server resource is stuck. Try the matching section below.

    1. If a database is stuck in “Dropping” This usually happens because sessions are still connected.

    Steps (safe):

    1. Block new connections and terminate existing ones.
    ALTER DATABASE mydb CONNECTION LIMIT 0;
    REVOKE CONNECT ON DATABASE mydb FROM PUBLIC;
    
    SELECT pg_terminate_backend(pid)
    FROM pg_stat_activity
    WHERE datname = 'mydb' AND pid <> pg_backend_pid();
    
    1. Drop it with force (PG 13+):
    DROP DATABASE IF EXISTS mydb WITH (FORCE);
    
    1. Confirm it’s gone:
    SELECT 1 FROM pg_database WHERE datname = 'mydb';
    

    If apps keep reconnecting, briefly stop them (firewall/NSG) or restart the server, then repeat step 1 and 2.

    1. If the server resource is stuck in “Deleting/Dropping” Do these quick checks in the Azure portal: • Resource group → Locks: remove any Delete lock. • Server → Networking → Private endpoint connections: remove/detach any that still point to this server. • Replication: delete read replicas first (you can’t delete a primary while replicas exist). • Activity log: open the last Delete/Update entry and note the Operation/Correlation ID and any error.

    Then try a command-line delete by resource ID:

    # Get the resource ID
    az postgres flexible-server show -g <rg> -n <server> --query id -o tsv
    
    # Delete using the resource ID
    az resource delete --ids "<resource-id>"
    

    If it still shows Dropping after these steps, please share required detail in private message


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.