Trace user login

  • I need to execute a job when specific user login to the database with Query Analyzer Or EMS. How can I accomplish this?

    I look forward to hearing from you

  • login triggers are only supported with SQL2005 SP2

    Johan

    Learn to play, play to learn !

    Dont drive faster than your guardian angel can fly ...
    but keeping both feet on the ground wont get you anywhere :w00t:

    - How to post Performance Problems
    - How to post data/code to get the best help[/url]

    - How to prevent a sore throat after hours of presenting ppt

    press F1 for solution, press shift+F1 for urgent solution 😀

    Need a bit of Powershell? How about this

    Who am I ? Sometimes this is me but most of the time this is me

  • In earlier versions you can get this from the sysprocesses table but you would have to set up an agent job to query it frequently. As always caution should be exercised when using system tables directly.

  • You could setup a trace on Login events, store the events in a table and create a trigger on the table. The trigger can perform pretty whatever you want, including kicking off a job.

    Unfortunately if the trace stops that won't work anymore. Plus Profiler drops and recreates the table when you restart it (unless you pick a different table name).

    There are tools out there that allow you to monitor sql server on a continuous basis and store the login events in a centralized table. Unlike Profiler, these tools keep the log table intact - so your trigger would work all the time.

    Hope this helps

    Herve Roggero
    hroggero@pynlogic.com
    MCDBA, MCSE, MCSD
    SQL Server Database Proxy/Firewall and Auditing

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

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