• charlesd (4/2/2013)


    The script is very useful. I know it was designed for SQL 2005, however it also seems to work on SQL 2008. I have tried it on several SQL 2008 servers successfully, but I am getting an error on one of them and I'm not sure exactly why. SQL Server would be running on a Windows 2008 R2 Virtual Server. Here is the error:

    Server: Msg 567, Level 16, State 7, Line 1

    File 'S:\Microsoft SQL Server\MSSQL.1\MSSQL\Data\MSSQL10.trc' either does not exist or is not a recognizable trace file. Or there was an error opening the file.

    This is definitely a valid file on the server. I am able to open it directly with SQL Profiler, but not using the script from a query window in SSMS.

    Thanks!

    Charles,

    Sorry for the delayed reply. This version of the script actually doesn't work on 2008 R2 because MS changed the path to the trace file a bit so the CASE that creates the path doesn't work correctly. Here's what you need to change for R2:

    sys.fn_trace_gettable(CASE WHEN PATINDEX('%Log[_]%', path)<> 0

    THEN LEFT(path, PATINDEX('%Log[_]%', path) + 2) +

    '.trc'

    ELSE T.[path]

    END, T.max_files)