Monday, March 26, 2012

Forcing Users to log out of SQL 2000

I am a begginer to SQL. I am truly limited with SQL language.

Every month we have to do a month end closing for our company. In order for us to do this we need to get everyone off the database to proceed. This process is horrible and generally takes at least 1/2hr to 45 min. to do so. i am looking for a command that i can use in query analyzer if possible to force the users out of the database. if that isnt an option can you recommend another program in which i can do this.? i am at a loss and need some help..... thanks

Did you have a look in the BOL for ALTER DATABASE ?

ALTER DATABASE SomeDatabase
SET SINGLE_USER
WITH ROLLBACK IMMEDIATE

or from the syntax with a delay of x seconds:

<termination> ::=
{
ROLLBACK AFTER integer [ SECONDS ]
| ROLLBACK IMMEDIATE
| NO_WAIT
}

HTH, Jens Suessmeyer.

http://www.sqlserver2005.de

|||

i am unsure of what you mean. as i stated i am truly a beginner with SQL.

can you explain it to me like i am 4? lol

thanks

|||

SUre thisis quite easy, the command kills all the user sessions immediately. If you want to wait a respective moment you can use the WAIT FOR keyword, but with the keyword IMMEDIATELY all User will be banned out of the database and their transactions will be roled back (if any transaction is open)

HTH, Jens Suessmeyer.


http://www.sqlserver2005.de

|||

what is the command?

can i use it in query analyze?

thanks again

|||You can use it in QA to force the users (as I mentioned before) to log out, current transactions will be rolled back. Make sure if this complies with your maintaince strategy (not every user is pleased to be logged out while he is doing a transaction :-) )

HTH, Jens Suessmeyer.

http://www.sqlserver2005.de
|||

ok thank you i will try this at the end of the month

i do appriciate your time!!

thanks

No comments:

Post a Comment