Please start any new threads on our new site at https://forums.sqlteam.com. We've got lots of great SQL Server experts to answer whatever question you can come up with.

 All Forums
 General SQL Server Forums
 New to SQL Server Programming
 SQL in Single User Mode

Author  Topic 

kid_on_the_block
Posting Yak Master

172 Posts

Posted - 2005-09-07 : 05:13:53
Hi I have heard abt starting the SQL Server in Single User Mode,


1) Can any one tell my why would I have to do that , Can some one please give me real time examples as to why he/she started the SQL Server in Single User Mode

2) I have currently got 20 users online,howe can I start the SQL in single user mode.


Thankyou.

eyechart
Master Smack Fu Yak Hacker

3575 Posts

Posted - 2005-09-07 : 05:34:55
single user mode is required for some dbcc repair operations and for recovering the master database. To start in single user mode you would have to either 1) ask everyone nicely to get out of the database, or 2) just shut the system down and force them out.

This is not something that you would do that frequently btw.



-ec
Go to Top of Page

kid_on_the_block
Posting Yak Master

172 Posts

Posted - 2005-09-09 : 07:44:27
Dont we have some command to get the users offline , would shutting down the system be proper , what if someone is importing data to the system or some other critical work is in process.... ???
Go to Top of Page

robvolk
Most Valuable Yak

15732 Posts

Posted - 2005-09-09 : 07:53:40
ALTER DATABASE myDB SET SINGLE_USER WITH ROLLBACK_IMMEDIATE

That will boot everyone out pretty damn quick.
Go to Top of Page

derrickleggett
Pointy Haired Yak DBA

4184 Posts

Posted - 2005-09-09 : 19:57:43
You will need to identify if someone is currently importing data or performing some other critical work before running Rob's nifty little command though. Otherwise, there import or "critical work" will be relegated to the waiting line while you do your business. You could always perform this during slow time (if you have any) and use Profiler, sp_who, etc to make sure nothing important is going on.

MeanOldDBA
derrickleggett@hotmail.com

When life gives you a lemon, fire the DBA.
Go to Top of Page
   

- Advertisement -