Appendix C - Using SQL TraceSQL Trace is a graphical utility that is used to monitor database activity. The monitoring can be done in real-time or can be done on particular users, applications, or hosts. This utility can only be used with SQL Server 6.5 servers.
Starting SQL TraceThe name of the SQL Trace executable file is SQLTRACE.EXE and it should be located in the SQL Server BINN directory. By default, the SQL Server 6.5 installation will place a shortcut to SQL Trace in the SQL Server program group. This (or another) shortcut can be used to start the utility or it can be started from the command line. Figure C.1 shows SQL Trace immediately after it is started.Fig. C.1 - When started, SQL Trace will prompt the user to log in to a database. After successfully connecting to a database, the user is prompted to select which defined filters should be started (see Fig. C.2). If no filters are defined, this dialog box does not appear. Fig. C.2 - Filters can begin monitoring a database as soon as the user successfully logs in to that database. Filters can now be added, deleted, edited, started, stopped, and paused. In addition, several other utilities can be started from within SQL Trace:
Using SQL TraceThe SQL Trace interface is divided into two sections:
Activities that meet a filter's criteria are displayed in the active filter pane (or window). The name of the filter being displayed is shown in the title bar. Later, in the Setting Up a Filter section, filters will be explained in more detail. At the bottom of the SQL Trace window is the filter status pane. This pane is made up of several items that display information about filters defined for the current server. Figure C.3 shows a SQL Trace window with an active filter pane and filter status pane visible. Fig. C.3 - The filter status pane can be toggled between visible and invisible. The filter status bar tracks the following information about defined filters for the current server:
Setting Up a FilterTo create a new filter, follow these steps:
SQL Trace is a simple but powerful tool. It can be used for many purposes. Debugging applications can be simplified by using SQL Trace to monitor SQL statements issued from an application. Performance issues can be addressed by recording a particular user's activity. And security can be enhanced by checking for dangerous activity on a server.
|