Use SQL Profiler to view captured event data in a trace. SQL Profiler displays data based on defined trace properties. One way to analyze Microsoft® SQL Server™ data is to copy the data to another program, such as SQL Query Analyzer or the Index Tuning Wizard. The Index Tuning Wizard can use a trace file that contains SQL batch and remote procedure call (RPC) events (and Text data columns). By specifying a server and database name when using the wizard, the captured data can be analyzed against a different server and database. For more information, see Index Tuning Wizard.
When a trace is opened using SQL Profiler, it is not necessary for the trace file to have the .trc file extension if the file was created by either SQL Profiler or the Profiler stored procedures.
Note SQL Profiler can also read SQL Trace .log files and generic SQL script files. When opening a SQL Trace .log file that does not have a .log file extension, for example trace.txt, specify SQLTrace_Log as the file format.
The SQL Profiler display can be configured with customized font, font size, preview lines, and client buffer size to assist in trace analysis.
Using SQL Profiler, you can troubleshoot data, such as queries that perform poorly or have exceptionally high numbers of logical reads, can be found by grouping traces or trace files by the Duration, CPU, Reads, or Writes data columns.
Additional information can be found by saving traces to tables and using Transact-SQL to query the event data. For example, to determine which SQL:BatchCompleted events had excessive wait time, execute:
SELECT TextData, Duration, CPU
FROM trace_table_name
WHERE EventClass = 12 -- SQL:BatchCompleted events
AND CPU < (.4 * Duration)
If you capture the Server Name and Database ID data columns in your trace, SQL Profiler displays the object name instead of the object ID (for example, Orders instead of the number 165575628). Similarly, if you capture the Server Name, Database ID, and Object ID, SQL Profiler displays the index name instead of the index ID.
If you choose to group by the Object ID data column, group by the Server Name and Database ID data columns first, and then Object ID. Similarly, if you choose to group by the Index ID data column, group by the Server Name, Database ID, and Object ID data columns first, and then Index ID. You need to group in this way because object and index IDs are not unique between servers and databases (and objects for index IDs).
Here are the basic steps for finding and grouping events in a trace:
The same technique can be used to find events grouped by Server Name, Database ID, and Object ID. Once you have found the events for which you are looking, group by ClientProcessID, Application Name, or another event class to view related activity in chronological order.
To view a saved trace
To view filter information
To open a trace data file
If a trace file is located on a computer running Microsoft Windows 95 or Windows 98, the trace file cannot be opened by SQL Profiler while the file is also being used to capture events. Additionally:
To open a trace table