Please start any new threads on our new site at https://forums.sqlteam.com. We've got lots of great SQL Server experts to answer whatever question you can come up with.

 All Forums
 SQL Server 2000 Forums
 Transact-SQL (2000)
 fn_trace_gettable error

Author  Topic 

tr702
Starting Member

7 Posts

Posted - 2008-03-06 : 16:46:27
When I run

Select * fn_trace_gettable('tracefilename',1)

I receive the following error before the last record can be retrieved

Server: Msg 568, Level 16, State 10, Line 1
Server encountered an error

I stopped the trace before executing this query. Any ideas what could be causing this?
Thanks

Haywood
Posting Yak Master

221 Posts

Posted - 2008-03-06 : 16:51:01
Is the trace file still open?

You have to stop and you have to close the trace. It's two operations...
Go to Top of Page

tr702
Starting Member

7 Posts

Posted - 2008-03-06 : 16:55:59
I have stopped and closed the trace.
Go to Top of Page

Haywood
Posting Yak Master

221 Posts

Posted - 2008-03-06 : 16:58:17
Are you using the profiler gui or the fn_trace* functions?


Did the file save completely before you closed it?
Go to Top of Page

tr702
Starting Member

7 Posts

Posted - 2008-03-06 : 17:07:08
I am using the profiler and the fn_trace_gettable function. When I open the trace file in profiler i am able to see all of the records. However when i run the fn_trace_gettable function for the same file in query analyzer i am getting all of the records except for the last one and i get the "Server: Msg 568, Level 16, State 10, Line 1 Server" error.

The file was saved completely before it was closed
Go to Top of Page

Haywood
Posting Yak Master

221 Posts

Posted - 2008-03-06 : 17:14:23
What does "SELECT * FROM ::fn_trace_getinfo(default)" return?
Go to Top of Page

tr702
Starting Member

7 Posts

Posted - 2008-03-06 : 17:17:10
It retrieves all of the records from the trace file except for the last one??
Go to Top of Page

Haywood
Posting Yak Master

221 Posts

Posted - 2008-03-06 : 17:19:43
Run the query that I posted, it will tell you what other (if any) traces are running. You might find that your other trace is still open...
Go to Top of Page

tr702
Starting Member

7 Posts

Posted - 2008-03-06 : 17:21:23
AH! You are right it says that the trace is still running. Can it be stopped through Query Analyzer?
Go to Top of Page

tr702
Starting Member

7 Posts

Posted - 2008-03-06 : 17:23:58
But i did make a local copy of the trace file and receive the same error on that copy too. Could that be happening because i made a copy of a trace that was not closed?
Go to Top of Page

Haywood
Posting Yak Master

221 Posts

Posted - 2008-03-06 : 17:28:05
Not at this point most likely...

You can stop it via:

exec sp_trace_setstatus <TraceID>, 0 -- Stop trace_id using 0
exec sp_trace_setstatus <TraceID>, 2 -- Close trace_id using 2
Go to Top of Page

tr702
Starting Member

7 Posts

Posted - 2008-03-06 : 18:37:07
I stopped and closed the trace. It turns out there is something really odd going on here. If i open the problem trace file in profiler then save that trace with a different name and then run fn_trace_gettable() from query analyzer on newly saved trace it works fine but still gives me the error on the original trace file. Even after it's stopped and closed
Go to Top of Page
   

- Advertisement -