vendredi 29 juin 2012 11:29Can we audit on sql logins from SSMS and show which windows user or machine connected?
Toutes les réponses
vendredi 29 juin 2012 12:49
You can use sys.dm_exec_connections DMV to get details of current connections
dimanche 1 juillet 2012 06:11
You can get the current login connection with what operation they are doing by following
SELECT * FROM SYS.SYSPROCESSES CROSS APPLY ::FN_GET_SQL(@SQL_HANDLE)
dimanche 1 juillet 2012 07:24
I use Adam's great utility
Best Regards,Uri Dimant SQL Server MVP,http://sqlblog.com/blogs/uri_dimant/
mardi 3 juillet 2012 13:13
The previous answers focus on examining the existing connections. It seems that you are only concerned about who is using SSMS to connect to your server. If that is your narrow focus, perhaps you want to record the SSMS logins in an audit table.
You could create a login trigger that would record data only when it seems to be a connection from SSMS. The login event data includes the login_name and the client_host, but not the program name. As mentioned earlier, the sys.dm_exec_sessions DMV also contains the Program Name. (Notice that client_host and program name are not 100% reliable, since the application sets those values.)
Here is a 2006 article on using logon triggers: http://www.sqlservercentral.com/articles/SQLServerCentral/sqlserver2005logontriggers/2366/
Also, you can use event notifications for auditing purposes. These are asynchronous and would record all logins. See the following to get started:
All the best,