2

Is it possible to see who is running SQL Server Profiler against a certain database and possibly from what machine? Say through Profiler itself or by T-SQL statement.

I wonder if it is even possible to find out Active Directly user name under which the profiler is running.


[UPDATE] As a reference, here is a way to retrieve only SQL Server Profile processes

declare @sp_who2 table (
    SPID    int,
    status  varchar(50),
    login   varchar(100),
    HostName    varchar(100),
    BlkBy   varchar(100),
    DBName  varchar(100),
    Command varchar(100),
    CPUTime int,
    DiskIO  int,
    LastBatch   varchar(50),
    ProgramName varchar(150),
    SPID2   int,
    REQUESTID   int
)
insert  @sp_who2
exec sp_who2

select  *
from    @sp_who2
where   ProgramName like 'SQL Server Profiler - %'
Zoredache
  • 130,897
  • 41
  • 276
  • 420
dance2die
  • 2,011
  • 7
  • 32
  • 41

2 Answers2

7

Execute

sp_who2

Look at the ProgramName column and you will see something like SQL Server Profiler - 362b6154-2d69-4ce0-987b-2573bed3ce45. From that query you can define a user name and HostName...

Bogdan_Ch
  • 483
  • 1
  • 3
  • 12
2

use SQL Profiler and look for existing connection and login events from application name "SQL Server Profiler - {guid}" where {guid} varies by run (and by default SQL Profiler runs exclude themselves based on its own application name.

Richard
  • 5,324
  • 1
  • 23
  • 20