Using Read80Trace in a batch file

It's 4:40AM in Barcelona and I can't sleep. I never seem to figure out jet lag. I'm sure I'll be sleeping just fine by the time I leave to come home on Saturday.

Every year at the PASS Conference I find one idea that pays for the cost of the conference. One tip or shortcut that saves me so much time it justifies attending the conference. I think this year that idea is going to be automating Read80Trace. It is a fantastic little tool that aggregates and summarizes performance data on your SQL Server.

The tool reads in a trace file (or files) and stores the data in SQL Server. It also "normalizes" the SQL statements that it finds. Normalizing standardizes the SQL to eliminate formatting and specific parameter values. This lets you summarize the performance of a statement when it's run with various different parameters. After it runs it pops up a web page with the resulting data. If you're doing any performance tuning at all this is definitely a tool you need to investigate.

The downside of this is that it pops up a web page when it runs. It's a command line utility so I had hopes of automating it. I was discussing the tool with Ken Henderson during a break in the pre-conference session and told me about trace flag 18. I was able to use this command line:

read80trace -It1.trc -SL30 -E -T18

to run Read80Trace without an Explorer window appearing. The magic is in the -T18 flag. Now I can automate the capturing of performance data at night. Woo hoo!