Amazon RDS SQL Server - Drop Database with Mirroring

,

Dropping database in RDS follows different method than dropping the database in local SQL Server.

Below is the command to DROP the database in Amazon RDS

EXECUTE msdb.dbo.rds_drop_database N'demodb'

GO

However when the SQL Server is configured with Multi-zone mirroring, then you need to set the partner to OFF and drop all active connections and then rollback any active sessions and drop the database.

FYI - Please make sure you test the script in DEV / lower environment before you implement on actual live database.

 

EXEC msdb.dbo.sp_delete_database_backuphistory @database_name = N'demodb'
GO
use [master];
GO
ALTER DATABASE [demodb] SET PARTNER OFF
USE [master]
GO
ALTER DATABASE [demodb] SET SINGLE_USER WITH ROLLBACK IMMEDIATE
GO
USE [master]
GO
EXECUTE msdb.dbo.rds_drop_database N'demodb'
GO

Rate

5 (1)

Share

Share

Rate

5 (1)