AWS RDS SQL Server无法删除数据库 [英] AWS RDS SQL Server unable to drop database
问题描述
我试图通过导出数据层应用程序(.bacpac
文件)将SQL Server数据库从Amazon RDS实例迁移到其他实例,但是导入未成功.因此,当我尝试执行以下操作时,我想删除数据库(为空):
I tried to migrate a SQL Server database by Export Data-tier Application (.bacpac
file) from an Amazon RDS instance to other, but import didn't succeed. So now I want to delete the database (which is empty), when I try to:
DROP DATABASE mydatabase;
我得到了错误:
无法删除数据库"mydatabase",因为它不存在或 您没有权限
Cannot drop the database 'mydatabase', because it does not exist or you do not have permission
某些上下文:
- 我尝试使用SQL Server Management Studio,并选择关闭连接:相同的错误.
- 我已以主用户身份登录.
- 我可以创建和删除其他数据库,但不能创建和删除其他数据库.
- 我对此数据库只有以下有效权限:
CONNECT
,SHOWPLAN
,VIEW DATABASE STATE
,VIEW DEFINITION
(不知道为什么或怎么可能).
- I've tried using SQL Server Management Studio, and choosing close connections: same error.
- I'm logged as master user.
- I can create and drop other databases, but not this one.
- I just have these effective permissions on this database:
CONNECT
,SHOWPLAN
,VIEW DATABASE STATE
,VIEW DEFINITION
(don't know why or how is this possible).
任何帮助将不胜感激!
推荐答案
我遇到了同样的问题.尝试使用.bacpac通过SSMS还原数据库后,它失败并留下您似乎无权删除的数据库.
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.
一种解决方法是使用rdsadmin重命名功能将其重命名为其他名称,这似乎可以解决权限问题并允许您删除它.
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.
这篇关于AWS RDS SQL Server无法删除数据库的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!