Friday, March 30, 2012

Is there a sp_trace method to read input from a template file?

Is there a way to pass to template file to an sp_trace method to specify the
trace parameters to the profiler?
Thanks,
Reshma.Reshma wrote:
> Is there a way to pass to template file to an sp_trace method to
> specify the trace parameters to the profiler?
> Thanks,
> Reshma.
You can specify the following on the Profiler command-line:
/S Server
/D Database
/B Trace table to load
/E Trusted Connection
/U Login Name
/P Password
/F Trace File to load
/T Template file to load or use when starting a new trace
You can also script your own traces using the SQL Trace API (see
sp_trace* procs in BOL).
David Gugick
Imceda Software
www.imceda.com|||Yes, Do you know what sp_trace api can be used to read in the trace
parameters from a template. I did not find such a functionality with any of
sp_trace methods.
Is there any other way of doing it?
Thanks,
Reshma.
"David Gugick" wrote:
> Reshma wrote:
> > Is there a way to pass to template file to an sp_trace method to
> > specify the trace parameters to the profiler?
> >
> > Thanks,
> > Reshma.
> You can specify the following on the Profiler command-line:
> /S Server
> /D Database
> /B Trace table to load
> /E Trusted Connection
> /U Login Name
> /P Password
> /F Trace File to load
> /T Template file to load or use when starting a new trace
> You can also script your own traces using the SQL Trace API (see
> sp_trace* procs in BOL).
>
> --
> David Gugick
> Imceda Software
> www.imceda.com
>|||Reshma wrote:
>> Is there a way to pass to template file to an sp_trace method to
>> specify the trace parameters to the profiler?
>> Thanks,
>> Reshma.
When you define a server-side trace, you do not use templates.
Everything is added to the trace programmatically using the sp_trace*()
procedures:
sp_trace_create
sp_trace_setevent
sp_trace_setfilter
sp_trace_setstatus
You can query running trace information with the fn_trace*() system
functions:
fn_trace_geteventinfo
fn_trace_getfilterinfo
fn_trace_getinfo
You can query data from a trace table (created with a server-side trace)
using:
fn_trace_gettable
The easiest way to see the generated server-side trace T-SQL, is to
define the trace and filters in Profiler, start the trace, and then
select the File --> Script Trace menu option. Profiler creates the
script to create and start the trace. Stopping the trace is your
responsibility. Keep in mind that Profiler binds all columns to all
selected events. It's not necessary to do this programmatically. You can
select the columns you're interested in for each event and only bind
those.
You might also want to take a look at our Coefficient product, which
provides an easy method to perform SQL performance analysis. If you have
any questions about Coefficient, our support staff is available to
assist you.
--
David Gugick
Imceda Software
www.imceda.com

No comments:

Post a Comment