0 votes
1 view
in AWS by (19.2k points)

I tried to migrate a SQL Server database by Export Data-tier Application (.bacpac file) from an Amazon RDS instance to others, but import didn't succeed. So now I want to delete the database (which is empty) when I try to:

DROP DATABASE mydatabase;

I get the error: 

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

Some context:

  • 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).

1 Answer

0 votes
by (44.6k points)

We can use the RDSadmin rename function to change it to something else, this seems to fix the issue and allows you to drop it. 

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

Use this to just drop the DB.

Related questions

Welcome to Intellipaat Community. Get your technical queries answered by top developers !