SQLProfiler 2
SQLProfiler 2
This tutorial complements the article “Tracing ArcSDE Queries with SQL Profiler,”
by Shannon Shields and Joseph Buckles which appeared in the January–March
2002 issue of ArcUser magazine. It provides an introduction to tracing queries with
SQL Profiler and using SQL Query Analyzer and will teach you how to create a
trace template to capture events passed from ArcMap and ArcSDE to Microsoft SQL
Server. You will also learn how to
Ü Choose events and data columns
Ü Set filters in SQL Profiler
Ü Evaluate query statements captured by SQL Profiler using the SQL Query
Analyzer
SQL Profiler and SQL Query Analyzer are performance monitoring tools that are
included with SQL Server. These tools can be used by a database administrator to
diagnose problems and optimize performance. This tutorial introduces only a small
portion of the functionality available with SQL Profiler and SQL Query Analyzer.
More information on both tools can be found in the HTML Help file, SQL Server
Books Online, available from the Microsoft Web site (www.microsoft.com/sql/techinfo/
productdoc/2000/). HTML Help file, SQL Server Books Online, avail-
able from the Microsoft Web site provides, infor-
To learn more about administering SQL Server with ArcSDE, enroll in ArcSDE mation on SQL Profiler and SQL Querry Analyzer.
Administration for SQL Server, a five-day instructor-led course offered by ESRI.
Visit the ESRI Web site (www.esri.com) for information about this course and other
resources.
Data for This Tutorial
The data for this tutorial, based on a dataset containing land-use parcels for Wilson
County, North Carolina, consists of a personal geodatabase feature class containing
parcel data. Download the archived data file, Parcels.zip, from the ArcUser Online
Web site.
Important: After downloading and unzipping Parcels.zip, open the parcels per-
sonal geodatabase. Copy or import the parcels feature class into ArcSDE. If you
do not have permission to load data into ArcSDE, get your ArcSDE administra-
tor to copy the data and grant you SELECT privileges for the feature class.
Tutorial Overview
Before beginning this tutorial, verify that the ArcSDE server is running and that your
login to SQL Server has appropriate permissions to view the data.
In this tutorial you will
Ü Create a SQL Profiler trace template
Ü Connect to ArcSDE from ArcMap
Ü Perform an attribute query
Ü View the results of the query in SQL Profiler
Ü Copy the traced query to SQL Query Analyzer
Ü View query statistics
Ü Create a column index in ArcCatalog
Ü View query statistics using the new index
Step 1: Create a SQL Profiler trace template
This step defines a new trace definition in SQL Profiler by specifying which events to
trace and what type of information to record for each event. A trace template must be
created first to store the trace definition.
1. From the Start menu, choose Programs > Microsoft SQL Server > Profiler to
start SQL Profiler.
2. From the SQL Profiler menu, choose File > New > Trace Template. Add the TextData, Duration, and Reads columns
to the Selected data list when defining the Trace
3. Click Save As to save the trace template.
Properties.
4. Save the Template as tutorial.tdb in the default directory for SQL Server.
5. In the Trace Properties dialog box, click the Events tab.
6. In the Available Event Classes list, expand the Stored Procedures event category
by clicking on the plus sign (+) next to it.
7. Select SP:StmtCompleted.
8. Click the Add button to add it to the Selected Event Classes list.
9. Click the Data Columns tab.
10. From the Unselected Data column, add the TextData, Duration, and Reads
columns to the Selected data list.
11. Click Save to create the template but do not close SQL Profiler.
Step 2: Connect to ArcSDE from ArcMap
In this step you will query the Parcels feature class using ArcMap to find Railway
right-of-way features. During this step a trace running in SQL Profiler will capture the