Tuesday, August 31, 2010

Efficient SQL Profiling

 

When you have to run SQL Profiler to view activity, if database server is used by multiple people or accounts which you want to view, there could be a lot of activity going on the server. It gets very confusing or near impossible to find out which sql statements or profiler activity you should look at.

The best way to view activity initiated by you is to use a Hostname filter.

You can even create a template so you don't have to create a filter every time you want to run sql profiler.

1. Open SQL Server Profiler
2. Create New Template (Base it on Standard template)
  SQL Profile - New Template
3. Click on Column Filter in Event Selection Tab and Define Hostname Like as your machine name. Make sure to check show all columns
 SQL Profiler - Step2
4. Save Template
Once template is saved. You can create a new trace using the template you just created with Hostname filter.
SQL Profiler - Step3

Upon running the trace, you'll see traces originated only from your machine.

Happy tracing!

No comments: