Thursday, March 22, 2012

Detecting when an user connects to a database

Greetings,
Is there any way to detect when a user connects to my database?
I mean, I want to know when a user connects to my database and when he/she
disconnects, and do something when this happens (a trigger, I guess).
Any ideas'
Thanks!Hi
If the user is only connecting to your database through a bespoke
application, then you will have control of this. If you don't have this
option you may want to check out the C2 auditing abilities and processing
the audit file, using SQL profiler or poling the sysprocesses table.
John
"Arnau Font" <afont@.nospam-ipssoft.com> wrote in message
news:uATVAOA5DHA.2576@.TK2MSFTNGP11.phx.gbl...
quote:

> Greetings,
> Is there any way to detect when a user connects to my database?
> I mean, I want to know when a user connects to my database and when he/she
> disconnects, and do something when this happens (a trigger, I guess).
> Any ideas'
> Thanks!
>
|||HI,
Simple option is enable Audit level (ALL)
How to enable audit,
1. In Enterprise manager , select the server name and right click and select
properties
2. Select the security tab and select Audit level as "ALL"
3. Restart SQL server Service
From now all the successful Login and Failure attempts will stored in SQL
server errorlog, but we can not set a trigger for this.
I belive to set a trigger we may need write our own custom trigger in
sysprocesses table.
Thanks
Hari
MCDBA
"Arnau Font" <afont@.nospam-ipssoft.com> wrote in message
news:uATVAOA5DHA.2576@.TK2MSFTNGP11.phx.gbl...
quote:

> Greetings,
> Is there any way to detect when a user connects to my database?
> I mean, I want to know when a user connects to my database and when he/she
> disconnects, and do something when this happens (a trigger, I guess).
> Any ideas'
> Thanks!
>

No comments:

Post a Comment