Change the database to "online" and set db to "multi-user"

I have a 2008 sql database that is down, which I would like to do online and set to multi-user. Using sql server management studio - a new query window - when I do the following:

ALTER DATABASE mydb SET ONLINE; ALTER DATABASE mydb SET MULTI_USER; 

I get this error message:

Msg 5064, Level 16, State 1, Line 1 Changes to the state or parameters of the database 'mydb' cannot be made while doing this. The database is in single-user mode, and the user is currently associated with it.
Msg 5069, Level 16, State 1, Line 1 ALTER DATABASE expression failed. Msg 5064, Level 16, State 1, Line 3 State changes or database parameters "mydb" cannot at this time. The database is in single-user mode, and the user is currently connected to it. Msg 5069, Level 16, State 1, Line 3 ALTER The DATABASE operation did not complete.

How can I get the database online and in multi-user mode?

+8
sql sql-server-2008
source share
2 answers

Make sure you are not in this database. Close all query windows that are connected to it, close information about the browser object, close SSMS and open it without the object explorer connected to this server, etc. Run this:

 USE [master]; GO ALTER DATABASE mydb SET SINGLE_USER WITH ROLLBACK IMMEDIATE; GO 

This should allow you to connect it to the network, then you will run the commands you quoted.

+6
source share

Well, I stopped this database service in Admin Tools> Services. Then, right-clicking on the database server to get the parameters, and then changed staus to multi-user mode.

0
source share

All Articles