Re: Problem using SP_TRACE_SETFILTER - it doesn't seem to apply th

From: Wanderer (Wanderer_at_discussions.microsoft.com)
Date: 01/03/05


Date: Mon, 3 Jan 2005 00:15:01 -0800

Hi David, thanks for the response!

Thanks for the heads-up on not being able to see the traces! Learnt
something new, there. The problem is I am attempteing to Filter on duration >
1000, but seem to be getting everything. I really don't want to run in our
production environment and capture everything, I strongly suspect that I will
end up with GB's of tracefiles.

Regards the " SELECT * FROM ::fn_trace_getfilterinfo(1)", I also used:
 SELECT * FROM ::fn_trace_getfilterinfo(@TraceId)
where @TraceId was the @TraceID variable used to assign the traces in the
SP, and is an output variable. And still got 0 rows returned.
Here is how I called the SP, and then checked the settings:
--Create trace, writing out to tracefile, until endtime
exec @Rc=Up_Auto_Profiler_Perf
                          
@FileName,@RunStopTime,@MaxSize,@DurationFilter,@TraceID output
--Error Handling
select @rc
select @TraceID
SELECT * FROM ::fn_trace_getfilterinfo(1)
SELECT * FROM ::fn_trace_getfilterinfo(default)
SELECT * FROM ::fn_trace_getfilterinfo(@TraceID)
select * from ::fn_trace_getinfo(1)
select * from ::fn_trace_getinfo(default)
select * from ::fn_trace_getinfo(@TraceID)

The 3 ::fn_trace_getfilterinfo select ALL return 0 rows, whereas the 3
::fn_trace_getinfo ALL return data about the trace I had just created!

I stringly suspect that either I have somehow failed to exec the
SP_TRACE_SETFILTER (and when debugging it certainly didn't seem like a
problem), or it failed (and I do do fairly complete error checking, per the
error codes listed in the BOL), or else, for some reason, it is just not
being applied.

"David Gugick" wrote:

> Wanderer wrote:
> > Ok - so it seems that, for some reason, the sp_trace_setfilter is not
> > working. Going to try and build in some logic to catch and check why.
> > Anything that you can see from my SP, that points the way, I'd
> > appreciate hearing it.
> >
>
> You wouldn't see the filter in Profiler if you opened a TRC file after a
> server-side trace. All you see in Profiler is the events captured during
> the trace. The other information (filters) are not saved anywhere in the
> trace file.
>
> Also, I assume when you ran the following statement, you knew that the
> running trace had a handle of 1? It seems unlikely that the handle would
> be 1 unless you just cycled the server.
> SELECT * FROM ::fn_trace_getfilterinfo(1)
>
> I can't read your script file because of the wrapping. What events did
> you capture that are not showing the filter applied?
>
> --
> David Gugick
> Imceda Software
> www.imceda.com
>
>



Relevant Pages

  • Re: [PATCH 0/3] ftrace: updates for tip
    ... I added a "trace" flags field in the task structure. ... The second patch uses this for the ftrace pid code. ... Regarding the filter functions, ... to only specify the PID, ...
    (Linux-Kernel)
  • Re: Continuous Network Diagram for a Single Task
    ... Go to my website and download the "Trace" macro. ... Now switch to the network diagram. ... >From the project menu select filtered for, ...
    (microsoft.public.project)
  • Re: SQL Profiler Scheduling
    ... What I do is simply to add a filter on StartTime to the trace, ... It's possible to set a stop time when you set up a trace. ... Erland Sommarskog, SQL Server MVP, esquel@xxxxxxxxxxxxx ... Books Online for SQL Server 2005 at ...
    (microsoft.public.sqlserver.tools)
  • Re: Update Process in Stored Procedure
    ... The trace can/should be filtered to only trap the specific events you need. ... William (Bill) Vaughn ... > William Vaughn wrote: ... >> Why not just write a filter for use with the Profiler and record a trace? ...
    (microsoft.public.vb.database.ado)
  • sp_trace_setfilter does not work
    ... I am trying to create a server side trace via script. ... However the trace is created but the filter is not there. ... declare @TraceID int ...
    (microsoft.public.sqlserver.tools)