Ad Code

Set databases from SINGLE USER mode to MULTI USER Mode

Set databases from SINGLE USER mode to MULTI USER Mode

We already know that the query below can be used to set single database's status from Single User mode to Multi User mode.


 USE master;

 GO

 ALTER DATABASE SampleDB

 SET SINGLE_USER

 WITH ROLLBACK IMMEDIATE;

 GO

 ALTER DATABASE SampleDB

 SET READ_ONLY;

 GO

 --You can also set the database to Multiple or Restricted access.

 ALTER DATABASE SampleDB

 SET MULTI_USER;

 GO

 --Check if all DBS are in Multi user Mode

Select name as DBName,state_desc,user_access_desc

from sys.databases

where user_access_desc='MULTI_USER'

and database_id>4

 




Post a Comment

0 Comments

Close Menu