热门标签 | HotTags
当前位置:  开发笔记 > 编程语言 > 正文

AWSRDSSQLServer无法删除数据库-AWSRDSSQLServerunabletodropdatabase

ItriedtomigrateaSQLServerdatabasebyExportData-tierApplication(.bacpacfile)fromanAmaz

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:

我尝试通过导出数据层应用程序(.bacpac文件)将Amazon RDS实例的SQL Server数据库迁移到其他实例,但导入未成功。所以现在我想删除数据库(这是空的),当我尝试:

DROP DATABASE mydatabase;

I get the error:

我收到错误:

Cannot drop the database 'mydatabase', because it does not exist or you do not have permission

无法删除数据库'mydatabase',因为它不存在或您没有权限

Some context:

  • I've tried using SQL Server Management Studio, and choosing close connections: same error.
  • 我尝试过使用SQL Server Management Studio,并选择紧密连接:同样的错误。

  • 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).
  • 我只对这个数据库拥有这些有效权限:CONNECT,SHOWPLAN,VIEW DATABASE STATE,VIEW DEFINITION(不知道为什么或如何可能)。

Any help is greatly appreciated!

任何帮助是极大的赞赏!

2 个解决方案

#1


4  

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.

我遇到了同样的问题。尝试使用.bacpac通过SSMS还原数据库后,它会失败,并为您提供一个您似乎无权删除的数据库。

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.

解决方法是使用rdsadmin重命名功能将其重命名为其他内容,然后似乎修复了权限问题并允许您删除它。

EXEC rdsadmin.dbo.rds_modify_db_name N'', N''

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

然后放下数据库。希望能帮助其他人处于同样的困境。

#2


0  

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.

DAC只能由sysadmin或serveradmin固定服务器角色的成员或数据库所有者删除。名为sa的内置SQL Server系统管理员帐户也可以启动向导。

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.

SQL Server - 需要对数据库具有CONTROL权限,或ALTER ANY DATABASE权限或db_owner固定数据库角色的成员身份。

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.

Azure SQL数据库 - 只有服务器级主体登录(由配置过程创建)或dbmanager数据库角色的成员才能删除数据库。

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

并行数据仓库 - 需要对数据库具有CONTROL权限,或者具有ALTER ANY DATABASE权限或db_owner固定数据库角色的成员身份。


推荐阅读
author-avatar
闲看云天的快乐生活
这个家伙很懒,什么也没留下!
PHP1.CN | 中国最专业的PHP中文社区 | DevBox开发工具箱 | json解析格式化 |PHP资讯 | PHP教程 | 数据库技术 | 服务器技术 | 前端开发技术 | PHP框架 | 开发工具 | 在线工具
Copyright © 1998 - 2020 PHP1.CN. All Rights Reserved | 京公网安备 11010802041100号 | 京ICP备19059560号-4 | PHP1.CN 第一PHP社区 版权所有