Forum Discussion
Unable to change Single User Mode to Multi User Mode in SSMS v18.12.1
Hi, Desmond.
Yes, using the [master] database is totally fine - even expected in some cases.
Technically, you can run Javier's command from any database as it's not targeting the currently-scoped database anyway.
The database you're currently scoped to does not prevent you from running commands against other databases, so being focused on [master] is not an issue at all.
Cheers,
Lain
Thank you for the heads up. For the SQL script that Javier has recommended, do I run it on the database whereby I right click on the specific database that I am having the issue and select "New Query" or something else?
- LainRobertsonJan 18, 2024Silver Contributor
Hi, Desmond.
You can right-click on any database (that you can access, of course) and run it, or simply just right-click the root node at the top of the Object Explorer:
It doesn't matter, just so long as you're on the correct server.
The very first command of "USE [master]" will switch focus from whatever database you were on to the [master] database anyway, which is why it doesn't matter.
Cheers,
Lain
- Jan 18, 2024Hello,
You have to replace YOURDATABASE by the database name that you have the issue with. And the script is fine to go to master since you cannot run the script if you are in the content of the DB you need to change so it is OK to run
Regards
Javier
Use master
Go
ALTER DATABASE YOURDATABASE SET MULTI_USER WITH ROLLBACK IMMEDIATE
GO- LainRobertsonJan 18, 2024Silver Contributor
Tagging desmondfmw99 as this isn't for my benefit.
Strictly-speaking, you can execute SET MULTI_USER, SINGLE_USER, etc. from any database you have access to - it's more about obtaining the exclusive lock on the target database.
It's not a requirement to use master. It's simply established wisdom.
Here, I'm happily switching to single user mode and back out again from within the target database.
Anyhow, stick to using [master] as per Javier's original post above. This is just additional information, since the question of the significance of [master] was asked.
Cheers,
Lain