How to kill the "Sessions inactive for a long time"

  • Hello guys,

    I noticed there are some sessions which are inactive for almost 24 hours....Is there anyway to kill those sessions (without using the kill spid command).....Can the programmmers kill the session after some particular period of inactivity???

  • I believe tt is normal for connections to stay around but not doing anything. But yes, the application can (and should) close it's connection when appropriate. I think connection pooling will affect whether or not the spids actually go away though.

    Best,
    Kevin G. Boles
    SQL Server Consultant
    SQL MVP 2007-2012
    TheSQLGuru on googles mail service

  • first, i would suggest not killing any connections, whether you know they are in use or not.

    just because they 've connected for a long time, does not mean they are invalid and need to be cleaned up; if they are from a web server, they might be used for connection pooling, and if dropped would/could break a web application; or they might be connections from your developers, for example, who open a window, get distracted, and will need to come back to their code tomorrow.

    As a developer, i reboot my machine once every few weeks, so a connection to a server for a couple of days is normal for me.

    instead, investigate the spid with sp_who2 or something, and based on the hostname, check with the end user and ask why they connect for days at a time.

    Lowell


    --help us help you! If you post a question, make sure you include a CREATE TABLE... statement and INSERT INTO... statement into that table to give the volunteers here representative data. with your description of the problem, we can provide a tested, verifiable solution to your question! asking the question the right way gets you a tested answer the fastest way possible!

  • Thanks for the suggestions

Viewing 4 posts - 1 through 3 (of 3 total)

You must be logged in to reply to this topic. Login to reply