Thursday, March 29, 2012

cant start Trace

I just created a server side Trace with no filters for testing but Im not
able to start it. I call sp_trace_setstatus 1,1 and it says completed
successfully. It then creates the file it writes too but never writes to it
when I generate activity. Any ideas why?
TIA, ChrisR
sql2k sp3aHi Chris
With server side traces, SQL Server writes to the file in 128K chunks, so
you won't see anything written until you have 128K worth of activity.
Look at fn_trace_getinfo( ) to check that your trace really is running.
Then try stopping and closing the trace:
sp_trace_setstatus 1, 0 -- stop the trace
sp_trace_setstatus 1, 2 -- close the trace
You must stop before closing or the close won't do anything. Only after
closing SQL Server write to the file.
Or, you can stop the SQL Server services, and that will also flush the
collected trace events to the file.
--
HTH
--
Kalen Delaney
SQL Server MVP
www.SolidQualityLearning.com
"ChrisR" <noemail@.bla.com> wrote in message
news:u0nrZLfOFHA.904@.tk2msftngp13.phx.gbl...
>I just created a server side Trace with no filters for testing but Im not
>able to start it. I call sp_trace_setstatus 1,1 and it says completed
>successfully. It then creates the file it writes too but never writes to it
>when I generate activity. Any ideas why?
> TIA, ChrisR
> sql2k sp3a
>|||Kalen I know this will sound odd, but it almost seems as though nothing gets
written ubtil the box is rebooted. It stays at 0kb until I reboot, at which
time there is a larger size.
"Kalen Delaney" <replies@.public_newsgroups.com> wrote in message
news:OUzjYPfOFHA.2728@.TK2MSFTNGP15.phx.gbl...
> Hi Chris
> With server side traces, SQL Server writes to the file in 128K chunks, so
> you won't see anything written until you have 128K worth of activity.
> Look at fn_trace_getinfo( ) to check that your trace really is running.
> Then try stopping and closing the trace:
> sp_trace_setstatus 1, 0 -- stop the trace
> sp_trace_setstatus 1, 2 -- close the trace
> You must stop before closing or the close won't do anything. Only after
> closing SQL Server write to the file.
> Or, you can stop the SQL Server services, and that will also flush the
> collected trace events to the file.
> --
> HTH
> --
> Kalen Delaney
> SQL Server MVP
> www.SolidQualityLearning.com
>
> "ChrisR" <noemail@.bla.com> wrote in message
> news:u0nrZLfOFHA.904@.tk2msftngp13.phx.gbl...
>|||Are you saying you have stopped and closed the trace, and still nothing gets
written?
If so, can you show the output of fn_trace_getinfo and then exact commands
you are running to stop and close the trace?
HTH
--
Kalen Delaney
SQL Server MVP
www.SolidQualityLearning.com
"ChrisR" <noemail@.bla.com> wrote in message
news:uOTRg8iOFHA.2568@.TK2MSFTNGP14.phx.gbl...
> Kalen I know this will sound odd, but it almost seems as though nothing
> gets written ubtil the box is rebooted. It stays at 0kb until I reboot, at
> which time there is a larger size.
>
> "Kalen Delaney" <replies@.public_newsgroups.com> wrote in message
> news:OUzjYPfOFHA.2728@.TK2MSFTNGP15.phx.gbl...
>|||--Status before stopping
traceid property value
-- -- ----
----
----
--
--
1 1 0
1 2 c:\JobTrace
1 3 5
1 4 NULL
1 5 1
--stopping trace
sp_trace_setstatus 1,0
--status after stopping
traceid property value
-- -- ----
----
----
--
--
1 1 0
1 2 c:\JobTrace
1 3 5
1 4 NULL
1 5 0
I dont see a command to close the Trace, Im just closing Query Anyalyzer.
"Kalen Delaney" <replies@.public_newsgroups.com> wrote in message
news:eatZvLjOFHA.1396@.TK2MSFTNGP10.phx.gbl...
> Are you saying you have stopped and closed the trace, and still nothing
> gets written?
> If so, can you show the output of fn_trace_getinfo and then exact
> commands you are running to stop and close the trace?
> --
> HTH
> --
> Kalen Delaney
> SQL Server MVP
> www.SolidQualityLearning.com
>
> "ChrisR" <noemail@.bla.com> wrote in message
> news:uOTRg8iOFHA.2568@.TK2MSFTNGP14.phx.gbl...
>|||Closing Qa will not stop or close the trace and the file size may not update
that often while it is running. If you look at sp_trace_setstatus in BOL
you will see hope to stop and close the trace.
Andrew J. Kelly SQL MVP
"ChrisR" <noemail@.bla.com> wrote in message
news:u$QxpVjOFHA.1396@.TK2MSFTNGP10.phx.gbl...
> --Status before stopping
> traceid property value
> -- -- ----
----
----
--
--
> 1 1 0
> 1 2 c:\JobTrace
> 1 3 5
> 1 4 NULL
> 1 5 1
> --stopping trace
> sp_trace_setstatus 1,0
> --status after stopping
> traceid property value
> -- -- ----
----
----
--
--
> 1 1 0
> 1 2 c:\JobTrace
> 1 3 5
> 1 4 NULL
> 1 5 0
> I dont see a command to close the Trace, Im just closing Query Anyalyzer.
>
> "Kalen Delaney" <replies@.public_newsgroups.com> wrote in message
> news:eatZvLjOFHA.1396@.TK2MSFTNGP10.phx.gbl...
>|||As noted earlier I did this:
--stopping trace
sp_trace_setstatus 1,0
Was I supposed to do this:
--stopping trace
sp_trace_setstatus 1,2
I was hoping to avoid that because BOL say it will delete the definition
from the server. I was hoping to be able to reuse it. Will info not be
written until closed/ deleted?
"Andrew J. Kelly" <sqlmvpnooospam@.shadhawk.com> wrote in message
news:ui3XxrjOFHA.2788@.TK2MSFTNGP09.phx.gbl...
> Closing Qa will not stop or close the trace and the file size may not
> update that often while it is running. If you look at sp_trace_setstatus
> in BOL you will see hope to stop and close the trace.
> --
> Andrew J. Kelly SQL MVP
>
> "ChrisR" <noemail@.bla.com> wrote in message
> news:u$QxpVjOFHA.1396@.TK2MSFTNGP10.phx.gbl...
--[vbcol=seagreen]
--[vbcol=seagreen]
>|||This is what I said in my first reply to you. Nothing will be written to the
file until the trace is CLOSED.
Please read my first reply again. You must first stop (set status to 0) and
then close (set status to 2).
If you want to save the trace definition, save the SQL commands that you
used to start it, and write them to a file that you can load up again.
HTH
--
Kalen Delaney
SQL Server MVP
www.SolidQualityLearning.com
"ChrisR" <noemail@.bla.com> wrote in message
news:uZ8STvjOFHA.3512@.TK2MSFTNGP15.phx.gbl...
> As noted earlier I did this:
> --stopping trace
> sp_trace_setstatus 1,0
> Was I supposed to do this:
> --stopping trace
> sp_trace_setstatus 1,2
> I was hoping to avoid that because BOL say it will delete the definition
> from the server. I was hoping to be able to reuse it. Will info not be
> written until closed/ deleted?
>
> "Andrew J. Kelly" <sqlmvpnooospam@.shadhawk.com> wrote in message
> news:ui3XxrjOFHA.2788@.TK2MSFTNGP09.phx.gbl...
--[vbcol=seagreen]
--[vbcol=seagreen]
>|||Woops! Thanks Kalen.
"Kalen Delaney" <replies@.public_newsgroups.com> wrote in message
news:ursw1NkOFHA.3292@.TK2MSFTNGP12.phx.gbl...
> This is what I said in my first reply to you. Nothing will be written to
> the file until the trace is CLOSED.
> Please read my first reply again. You must first stop (set status to 0)
> and then close (set status to 2).
> If you want to save the trace definition, save the SQL commands that you
> used to start it, and write them to a file that you can load up again.
> --
> HTH
> --
> Kalen Delaney
> SQL Server MVP
> www.SolidQualityLearning.com
>
> "ChrisR" <noemail@.bla.com> wrote in message
> news:uZ8STvjOFHA.3512@.TK2MSFTNGP15.phx.gbl...
--[vbcol=seagreen]
--[vbcol=seagreen]
>sql

No comments:

Post a Comment