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 🙂