I have a 2008 sql database that is offline that I would like to take online and set to multi-user. Using sql server management studio – new query window – when i execute the following:
ALTER DATABASE mydb SET ONLINE;
ALTER DATABASE mydb SET MULTI_USER;
I receive this error message:
Msg 5064, Level 16, State 1, Line 1
Changes to the state or options of
database ‘mydb’ cannot be made at this
time. The database is in single-user
mode, and a user is currently
connected to it.
Msg 5069, Level 16,
State 1, Line 1 ALTER DATABASE
statement failed. Msg 5064, Level 16,
State 1, Line 3 Changes to the state
or options of database ‘mydb’ cannot
be made at this time. The database is
in single-user mode, and a user is
currently connected to it. Msg 5069,
Level 16, State 1, Line 3 ALTER
DATABASE statement failed.
How would I get the database online and in multi-user mode?
^ This is the problem you need to solve.
Make sure you are not IN that database. Close any query windows that are connected to it, shut down Object Explorer Details, close SSMS and re-open it without Object Explorer connected to that server, etc. Run this:
That should allow you to bring it online, then you would run the commands you listed.
However:
sys.dm_tran_locks– it may be that you need to suspend connecting applications and/or shut down SQL Server Agent.