question

ramesh 1 avatar image
ramesh 1 asked

idle users connected to the server in sql server 2005 snt edition

hi team, i have executed the below query select * from sys.dm_exec_sessions where dateadd(hour, 2, last_request_end_time) < getdate() order by last_request_end_time desc and found that more than 300 users are connected to the server,who are purely idle,.my question it that what is the saffest way to delete them, i am thinking to use this command ***alter database DbaWorks set online with no_wait*** is there any other best to to kill idle users
sqlserverperformance-tuning
10 |1200

Up to 2 attachments (including images) can be used with a maximum of 512.0 KiB each and 1.0 MiB total.

ThomasRushton avatar image
ThomasRushton answered
SQL Server thoughtfully provides a [KILL][1] command in T-SQL... However, you might want to make sure that they really are up to nothing. I used to only kill connections that had been idle for 24 hours... [1]: http://msdn.microsoft.com/en-us/library/ms173730(v=SQL.90).aspx
10 |1200

Up to 2 attachments (including images) can be used with a maximum of 512.0 KiB each and 1.0 MiB total.

Grant Fritchey avatar image
Grant Fritchey answered
I wouldn't necessarily remove the connections. It might just be connection pooling waiting for the next round to come through. As long those connections aren't holding locks and there are only a few of them (300 isn't much), I wouldn't sweat it necessarily. If they're holding locks or the number escelates by quite a bit, then you have cause for serious concern.
10 |1200

Up to 2 attachments (including images) can be used with a maximum of 512.0 KiB each and 1.0 MiB total.

CirqueDeSQLeil avatar image
CirqueDeSQLeil answered
Same advice - I would only kill connections that had been idle for a lengthy period of time. The length of time depends on the database and application - thus one should understand those things. Be careful before trying to kill any connections. It is well worth it to gain an understanding of the app and the database before killing these connections.
10 |1200

Up to 2 attachments (including images) can be used with a maximum of 512.0 KiB each and 1.0 MiB total.

Write an Answer

Hint: Notify or tag a user in this post by typing @username.

Up to 2 attachments (including images) can be used with a maximum of 512.0 KiB each and 1.0 MiB total.