Oracle9i uses the SQL Trace facility to collect performance data on individual SQL statements. The information generated by SQL Trace is stored in SQL trace files. SQL Performance Analyzer consumes the following information from these files:
SQL text and username under which parse occurred
Bind values for each execution
CPU and elapsed times
Physical reads and logical reads
Number of rows processed
Execution plan for each SQL statement (only captured if the cursor for the SQL statement is closed)
Although it is possible to enable SQL Trace for an instance, it is recommended that you enable SQL Trace for a subset of sessions instead. When the SQL Trace facility is enabled for an instance, performance statistics for all SQL statements executed in the instance are stored into SQL trace files. Using SQL Trace in this way can have a severe performance impact and may result in increased system overhead, excessive CPU usage, and inadequate disk space. It is required that trace level be set to 4 to capture bind values, along with the execution plans.
For production systems running Oracle Database 10g Release 1, use the DBMS_MONITOR
.SESSION_TRACE_ENABLE
procedure to enable SQL Trace transparently in another session. You should also enable binds explicitly by setting the binds
procedure parameter to TRUE
(its default value is FALSE
).
After enabling SQL Trace, identify the SQL trace files containing statistics for a representative set of SQL statements that you want to use with SQL Performance Analyzer. You can then copy the SQL trace files to the SQL Performance Analyzer system. Once the SQL workload is captured in the SQL trace files, disable SQL Trace on the production system.
Oracle Database SQL Tuning Guide for additional considerations when using SQL Trace, such as setting initialization parameters to manage SQL trace files
Oracle Database PL/SQL Packages and Types Reference for information about the DBMS_MONITOR
package