AWS RDS SQL Server unable to drop database

家住魔仙堡 提交于 2019-12-03 12:54:52

I ran into this same issue. After trying to restore a database via SSMS using a .bacpac, it fails and leaves you with a database that you appear to not have permissions to drop.

A workaround, is to use the rdsadmin rename function to rename it to something else, which then seems to fix the permission issue and allows you to drop it.

EXEC rdsadmin.dbo.rds_modify_db_name N'<OldName>', N'<NewName>'

Then just drop the DB. Hope that helps someone else in the same predicament.

This is answer for old thread but the answer would help somebody running over the same issue.

I run in to the same problem , but in my-case my database was in offline mode. If the database is in offline mode , it won't allow you to drop it with drop command. first you should bring the database back to online by running this sp and then execute drop table command.

EXEC rdsadmin.dbo.rds_set_database_online databasename

Sounds like your not a member of the correct role.

https://msdn.microsoft.com/en-us/library/ee240822.aspx

Permissions

A DAC can only be deleted by members of the sysadmin or serveradmin fixed server roles, or by the database owner. The built-in SQL Server system administrator account named sa can also launch the wizard.

https://msdn.microsoft.com/en-us/library/ms178613.aspx

Permissions

SQL Server - Requires the CONTROL permission on the database, or ALTER ANY DATABASE permission, or membership in the db_owner fixed database role.

Azure SQL Database - Only the server-level principal login (created by the provisioning process) or members of the dbmanager database role can drop a database.

Parallel Data Warehouse - Requires the CONTROL permission on the database, or ALTER ANY DATABASE permission, or membership in the db_owner fixed database role.

user11765174

If your database is in a Multi-AZ deployment, then you need to run this command to drop those databases:

EXECUTE msdb.dbo.rds_drop_database N'DBName'
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!