Intellipaat Back

Explore Courses Blog Tutorials Interview Questions
0 votes
2 views
in AWS by (19.1k 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.4k 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

0 votes
1 answer
Want to get 50% Hike on your Salary?

Learn how we helped 50,000+ professionals like you !

+1 vote
1 answer

31k questions

32.8k answers

501 comments

693 users

Browse Categories

...