How do I run a SQL Server trace to start and end at specific times?
I found the recipe for creating a SQL Profiler trace.
How do I set up something to have this trace start and end at specific times, can I do this with a management task??
We are trying to find when and how locks or failed connections may be occurring but we don't know when they will occur -- a very intermittent problem.
Another solution would be to explain how I could run such a trace for a couple weeks without having logs get too big, can the trace files' save location be manually specifie开发者_如何学Cd??
Thank you, Tom
What do you mean by "failed connections"? Login Failures? If so these are already captured by the default trace.
SELECT f.*
FROM sys.traces t
CROSS APPLY fn_trace_gettable(t.path, default) f
WHERE f.EventClass=20
Also what do you mean by "locks"? It sounds like you might want to investigate setting up the Blocked Process report. This should be relatively light weight and capable of running for weeks at a time as long as you configure the blocked process threshold option sensibly.
You can use SQL Profiler to set up the trace initially and then script the trace definition from the export menu and put it in a start up stored procedure
精彩评论