December 22, 2009 at 1:57 pm
You can get the SPID from activity monitor too.
December 23, 2009 at 2:04 am
I was also facing the same issues even I tried all the solutions mentioned here & some other solution except stopping or pausing the server.
I used another trick for it.
1. Query the sysprocessess
2. You will receive the same message stating "Changes to the state or options of database 'test' cannot be made at this time. bla..bla..bla"
3. Check the resultset, get the highest spid from the result. add "1" value to it. say if you got spid as 75 you have to kill the spid 76.
4. Your whole & sole connection to database is killed now.
5. use "Alter database [MyDatabase] set multi_user with rollback immediate"
Abhijit - http://abhijitmore.wordpress.com
July 12, 2011 at 2:07 pm
Excellent, worked like a charm. Thanks.
- Subah Ramakrishnan
May 6, 2013 at 10:04 am
Hi,
use the same session for which you have used to make the database single_user. By default that session will have the access. run the
Alter database db_name with multi_user command in same window. Yuo will get the access and database will be in multi user mode.
Thanks
Amol Solunkhe
May 6, 2013 at 10:19 am
note you replied to a thread more than two years old.
Lowell
July 30, 2018 at 5:42 am
j.a.c - Tuesday, June 23, 2009 5:19 PMHi,Suppose you had a database stuck in single user mode that is in a busy OLTP environment.Given that:1. The connection that originally put the database into single user mode is gone.2. The DAC has not been set up on that instance.3. It is almost guaranteed that if you kill the spid holding the only connection to the database, another connection will grab it in milliseconds.How would you get the db back into multi-user mode?Thanks,Andy
Had same issue today, here's what I did to solve it:-
1. select * from sys.dm_tran_locks where resource_database_id=db_id('databasename')
go
2.kill <request_session_id>
3.alter databse <databasename> set multi_user with no_wait
Execute commands 2 and 3 at the same time. There won't be enough time for the creation of another connection to the database and you should now get
Commands completed successfully.
Hope this helps.
Viewing 6 posts - 16 through 20 (of 20 total)
You must be logged in to reply to this topic. Login to reply