Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations TouchToneTommy on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

What happens to users currently logged on when Single User Mode is set

Status
Not open for further replies.

AWEinCA

Programmer
Oct 18, 2000
35
US
I have an application that does an "End of Day" Stored procedure. Lately, we have encountered several deadlocks with users trying to access tables that End of Day needs to update.

There is no reason for them to be in the database at the time of closing. I am trying to find a way to auto log them off during the closing and keep them logged out until end of day is complete.

So far the closest thing I can find is making the database single user mode. BUT what happens to the users that are currently logged in? Are they logged off?

Thanks. Any info will be useful.
AWEinCA [sig][/sig]
 
I don't think that the server will allow you to change to single user mode if anyone is still logged on....this was the case for 6.5, but maybe it has changed in 7.0 [sig]<p> <br><a href=mailto: > </a><br><a href= home</a><br> [/sig]
 
jnicho02,

Thanks for your reply. Is there a way to logout users programmatically and then change the database to single user mode? [sig][/sig]
 
You can kill their spids, but this can have bad side effects and it is not recommended. Use KILL very carefully, especially when critical processes are running.

A cleaner, but not so great, of a solution could be to pause the server, after a few minutes stop the server which kicks everyone off, start the server, then issue the sp_dboption command to put it in single user mode. This is not so great because you have to wait (if you are being nice by pausing first) and it kicks all users off that are connected to all databases.

[sig][/sig]
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top