How to rename a database (Not the instance) in mssql

0

I'm just trying to rename a created database on a 2019 MS SQL running on RDS. I have a database named mydb that for multi-tenant purposes, I need to rename to mydb2 as a workaround for hardcoded values in the app. However, in SSMS, when i try to rename the database, I get this error:

TITLE: Microsoft SQL Server Management Studio
------------------------------

Unable to rename mydb2. (ObjectExplorer)

------------------------------
ADDITIONAL INFORMATION:

Rename failed for Database 'mydb'.  (Microsoft.SqlServer.Smo)

For help, click: https://go.microsoft.com/fwlink?ProdName=Microsoft+SQL+Server&ProdVer=16.100.47021.0&EvtSrc=Microsoft.SqlServer.Management.Smo.ExceptionTemplates.FailedOperationExceptionText&EvtID=Rename+Database&LinkId=20476

------------------------------

An exception occurred while executing a Transact-SQL statement or batch. (Microsoft.SqlServer.ConnectionInfo)

------------------------------

User does not have permission to alter database 'mydb', the database does not exist, or the database is not in a state that allows access checks. (Microsoft SQL Server, Error: 5011)

For help, click: https://docs.microsoft.com/sql/relational-databases/errors-events/mssqlserver-5011-database-engine-error

------------------------------
BUTTONS:

OK
------------------------------

An using for forceful ways like changing the db to single-access, then altering the db doesn't work either because the error says my admin user doesn't have permissions to change that on a table.

Is the background user rdsadmin logged in and preventing me from changing this? Could I restart the service and close any zombie connections? Maybe I make a copy of the database and give it another name? These seems like overkill but I'm not sure what permissions on RDS are preventing me.

asked 2 months ago31 views
1 Answer
1
Accepted Answer

Hello - Thank You for reaching out to us via re:Post - The way to rename a database is a bit different than the native set up in AWS RDS - here you go - please follow the link below https://docs.aws.amazon.com/AmazonRDS/latest/UserGuide/Appendix.SQLServer.CommonDBATasks.RenamingDB.html

answered 2 months ago

You are not logged in. Log in to post an answer.

A good answer clearly answers the question and provides constructive feedback and encourages professional growth in the question asker.

Guidelines for Answering Questions