I had the same issue. I ran an SQL trace on a remote server and transferred
the trace files to a local directory on my workstation so that I load the
data into a table on my local SQL Server instance for running queries
SELECT * INTO ProfileTracesTable
FROM ::fn_trace_gettable('C:\Users\anthony\Documents\SQL_traces\first.trc', default)
However, each time I tried, I got the following error:
File 'C:\Users\anthony\Documents\SQL_traces\first.trc' either does not
exist or is not a recognizable trace file. Or there was an error opening
At first I thought the error might be related permission but I ruled this
out since I had no problem loading the .trc files directly into SQL Profiler
or as a file into SSMS.
After trying a few other ideas, I thought about it a bit more and realised
that it was due to permissions after all: the query was being run by the SQL
Server process (sqlsrvr.exe) as the user
NT AUTHORITY\NETWORK SERVICE –
not my own Windows account.
The solution was to grant Read and Execute permissions to
SERVICE on the directory that the trace files were stored in and the trace
You can do this by right-clicking on the directory, go to the Security
NETWORK SERVICE as a user and then select
Read & Execute for
its Permissions (this should automatically also select
List folder contents). These file permissions (ACLs) should automatically
propagate to the directory contents.
If you prefer to use the command line, you can grant the necessary permissions to
the directory – and its contents – by running the following:
icacls C:\Users\anthony\Documents\SQL_traces /t /grant "Network Service:(RX)"