How to record disconnection time of a session

  • Hi,

    I want to record the connection and disconnection of SQL session i.e. any connections/disconnections to the SQL Server from Application or through management studio

    With the help of sys.dm_exec_connection and sys.dm_exec_sessions i am able to get details when connection is established. But since these tables does not store disconnected session ids, i am not able to record the disconnection related details.

    Please guide.

    Regards,

    Saumik Vora

  • If you are running SQL 2008, then a server-side trace with Audit login success and Audit logout. If you're on 2012 or above, the same thing with Extended Events.

    Gail Shaw
    Microsoft Certified Master: SQL Server, MVP, M.Sc (Comp Sci)
    SQL In The Wild: Discussions on DB performance with occasional diversions into recoverability

    We walk in the dark places no others will enter
    We stand on the bridge and no one may pass

Viewing 2 posts - 1 through 1 (of 1 total)

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