tags:

views:

40

answers:

2

Hi there, i was just wondering if anybody knows how to detect what is calling the sa login on my sql server 2005. I have a stack of websites and i swear i configured these with a different user id and password but my event viewer logs tell me that something is constantly trying to login using the sa credentials. Any help would be appreciated.

+5  A: 

run profiler, create a new trace, use event audit login and audit login failed you can filter for username sa if you want

see image below

alt text

See also this post by onpnt: To SA or not to SA

you could also use a Logon Trigger but that will only fire if the authentication is succesful

SQLMenace
Just as an aside, the application name and host name you will see here are the same that sys.dm_exec_sessions uses, and are subject to the same warnings about spoofing.
Aaron Bertrand
Aaron, you are of course absolutely right
SQLMenace
+2  A: 

If they are successfully connected then you can look in sys.dm_exec_connections, this will at least tell you the client_net_address (IP address as reported to Windows). You can also look at PROGRAM_NAME and HOST_NAME in sys.dm_exec_sessions, but be aware that these are not necessarily populated, and are easy to spoof.

Aaron Bertrand
hi mate, thx for the help, however, doing a select using the "PROGRAM_NAME" and "HOST_NAME" properties of sys.dm_exec_connections tells me that these yield invalid column names in the query result
Johnny Lamho
Johnny, try sys.dm_exec_sessions or plain old proc sp_who2
SQLMenace
That's because those columns are in sys.dm_exec_sessions.
Aaron Bertrand
thanks Aaron. these have been much help.
Johnny Lamho