Wednesday, April 27, 2011

Msg 567, Level 16, State 7, Line 1 File 'D:\TraceFiles\vrijdag8161700.trc' either does not exist or is not a recognizable trace file. Or there was an error opening the file. fn_trace_gettable


If you have a SQL Profiler trace file which you want to open in the query analyzer you can make use of the fn_trace_gettable function.  Assume you are running this script from a server named: ServerA and you have a SQL Server named: ServerSQL. On ServerA you have stored a trace file in the folder D:\TraceFiles.

On ServerA you executed next command to open the trace file in the SQL Server Management Studio.

SELECT eventclass,TextData,ApplicationName,NTUserName,
LoginName,CPU,Reads,Writes, Duration, ClientProcessID,
SPID,StartTime,EndTime,BinaryData
FROM :: fn_trace_gettable('D:\TraceFiles\vrijdag8161700.trc',default )

This will return:
Msg 567, Level 16, State 7, Line 1


File 'D:\TraceFiles\vrijdag8161700.trc' either does not exist or is not a recognizable trace file. Or there was an error opening the file.

The error is caused by the fact that the function fn_trace_gettable is executed on the SQL Server named: ServerSQL. This server has no acces to the file in 'D:\TraceFiles\vrijdag8161700.trc' on ServerA.

To solve this share the folder D:\Tracefiles for the user who need access to it.
SELECT eventclass,TextData,ApplicationName,NTUserName,
LoginName,CPU,Reads,Writes, Duration, ClientProcessID,
SPID,StartTime,EndTime,BinaryData
FROM :: fn_trace_gettable('\\ServerA\TraceFiles\vrijdag8161700.trc',default )

Now the ServerSQL has access to the file on ServerA.
Enjoy using fn_trace_gettable in your SSMS.

:

No comments: