Deleting Custom Databases
Scenarios
You can use a stored procedure to delete a custom database.
Prerequisites
An RDS for SQL Server DB instance has been connected. .
Constraints
- This stored procedure cannot be used to delete system databases. If you attempt to delete a system database, the system displays the following information:Error DBName can not in ('msdb','master','model','tempdb','rdsadmin','resource') .
- The stored procedure cannot be used to delete a database that does not exist. If you attempt to delete a database that does not exist, the system displays the following information:Cannot find database XXX.
Procedure
Run the following command to delete a custom database:
EXEC rdsadmin.dbo.rds_drop_database '@DBName';
In the preceding command, @DBName indicates the name of the database to be deleted.
For example, to delete custom database testDB_1, run the following command:
EXEC rdsadmin.dbo.rds_drop_database 'testDB_1';
Parent topic: Usage of Stored Procedures
- Scenarios
- Prerequisites
- Constraints
- Procedure