Please start any new threads on our new site at https://forums.sqlteam.com. We've got lots of great SQL Server experts to answer whatever question you can come up with.

 All Forums
 General SQL Server Forums
 New to SQL Server Administration
 SQL Server Profiler issue

Author  Topic 

Apples
Posting Yak Master

146 Posts

Posted - 2012-04-26 : 13:10:39
We have about 10 or so users who have access to login to our database and run SQL Server Profiler.

The problem is that they're all using the same username/password to access the database, and every once in a while SQL Server Profiler causes everything to time out. So we're trying to track down who is running the profiler so we can see what exactly is causing the problem.

My developers are all over the country, so is there any way to see the IP address of who is running SQL Server Profiler on the database?

robvolk
Most Valuable Yak

15732 Posts

Posted - 2012-04-26 : 13:45:03
This should work:
select c.session_id, c.client_net_address from sys.dm_exec_sessions s 
inner join sys.dm_exec_connections c on s.session_id=c.session_id
where s.program_name like '%profiler%'
Of course the actual problem is;
quote:
We have about 10 or so users who have access to login to our database and run SQL Server Profiler.

The problem is that they're all using the same username/password to access the database,
It's kinda like trying to track down the manufacturer of the bullets that were loaded in the guns of the gang that broke into your (unlocked and unalarmed) store and trashed the place. Developers should never be allowed to run Profiler, much less in production, and absolutely never using the same login (which I'm going to assume is sa).
Go to Top of Page

Apples
Posting Yak Master

146 Posts

Posted - 2012-04-26 : 15:09:17
Thanks Rob.

This works, but it only shows me who is currently running SQL Server Profiler. Is there any way to see a history of who has run it?
Go to Top of Page

robvolk
Most Valuable Yak

15732 Posts

Posted - 2012-04-26 : 16:08:11
Only if you run...wait for it...another trace. Or use a logon trigger or event notification to capture such information. You'd have to store that data in a table to maintain a historical record.
Go to Top of Page
   

- Advertisement -