I recently had to take some AWS RDS databases offline, and when I tried to get them online or edit them in any way I was met with an error saying I did not have permission, this is due to the way AWS manages the databases using the rdsadmin user, which you should never login as or know the password of, but even as “sa” I was not able to do any actions with the following error message:
User does not have permission to alter database 'MyDatabase' the database does not exist, or the database is not in a state that allows access checks. ALTER DATABASE statement failed. (Microsoft SQL Server. Error: 5011)

The solution is to run the following command on the database as “sa” user to bring it back online:
EXEC [rdsadmin].[dbo].[rds_set_database_online] <database name>
Hope this helped you 🙂
Hi, my name is Niels, I am a passionate software developer from Denmark with a love for coding and solving real-world problems! I taught myself C# back in 2012 in my spare time and I loved it! I went on and graduated from Computer Science in 2016 where I got hired by