All Products
Search
Document Center

ApsaraDB RDS:Delete a database

Last Updated:Aug 28, 2023

This topic describes how to delete a database from an ApsaraDB RDS for SQL Server instance. You can use the ApsaraDB RDS console or an SQL statement to delete the database.

Use the ApsaraDB RDS console to delete a database

  1. Go to the Instances page. In the top navigation bar, select the region in which the RDS instance resides. Then, find the RDS instance and click the ID of the instance.
  2. In the left-side navigation pane, click Databases.

  3. Find the database you want to delete and click Delete in the Actions column.

  4. In the message that appears, click OK.

Use an SQL statement to delete a database

  1. Connect to the RDS instance to which the database belongs. For more information, see Connect to an ApsaraDB RDS for SQL Server instance.

  2. Execute the following statement to delete the database:

    DROP DATABASE [database_name];

    Example:

    DROP DATABASE [db_test];
    Note

    If your RDS instance runs SQL Server 2012 or later on RDS High-availability Edition and an error is reported after you execute the preceding DROP statement, you can use the following stored procedure to delete the database from the RDS instance. The stored procedure not only deletes the specified database but also removes associated images and closes connections to the database.

    EXEC sp_rds_drop_database 'database name'

Related operations

Operation

Description

DeleteDatabase

Deletes a database.