x

Get details about an sql trace

Is there any way to figure out the host machine name from where an sql trace was originated or some other details like spid against which the trace is running ?

When I execute the following query -

 SELECT *  
 FROM :: fn_trace_getinfo(default)  
 where property = 5 and value = 1

I get there are two sql traces running ,for the first one I am sure is the default one initiated by the sql server but not sure about the other one.

I am also not able to get any idea when I query the following -

 select * 
 from sys.sysprocesses  
 where program_name like '%profiler%'

Regards, Hemant

more ▼

asked Feb 16, 2011 at 10:18 PM in Default

avatar image

Hemant
277 12 12 17

Are you asking which client/spid actually started a trace?

Feb 16, 2011 at 11:39 PM Fatherjack ♦♦
(comments are locked)
10|1200 characters needed characters left

1 answer: sort voted first

I adopted the following query from @Håkan Winther great script to find "who changed what"

 SELECT * 
 FROM    
 [fn_trace_gettable](CONVERT(VARCHAR(150), ( SELECT TOP 1
 value
 FROM    [fn_trace_getinfo](NULL)
 WHERE   [property] = 2
 )), DEFAULT) T

Credit to @Håkan Winther!

more ▼

answered Feb 16, 2011 at 10:54 PM

avatar image

Cyborg
10.8k 37 54 51

This query will not return any details about those traces where file name property is not available.Even if this file name property is available for a trace how would I retrieve the session id against which this particular trace process is running or say host name from where the trace was originated ?

Thanks, Hemant

Feb 17, 2011 at 02:03 AM Hemant
(comments are locked)
10|1200 characters needed characters left
Your answer
toggle preview:

Up to 2 attachments (including images) can be used with a maximum of 524.3 kB each and 1.0 MB total.

Follow this question

By Email:

Once you sign in you will be able to subscribe for any updates here

By RSS:

Answers

Answers and Comments

SQL Server Central

Need long-form SQL discussion? SQLserverCentral.com is the place.

Topics:

x38
x20

asked: Feb 16, 2011 at 10:18 PM

Seen: 1464 times

Last Updated: Feb 16, 2011 at 11:34 PM

Copyright 2016 Redgate Software. Privacy Policy