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
- 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.
In the left-side navigation pane, click Databases.
Find the database you want to delete and click Delete in the Actions column.
In the message that appears, click OK.
Use an SQL statement to delete a database
Connect to the RDS instance to which the database belongs. For more information, see Connect to an ApsaraDB RDS for SQL Server instance.
Execute the following statement to delete the database:
DROP DATABASE [database_name];
Example:
DROP DATABASE [db_test];
NoteIf 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 |
Deletes a database. |