Oracle8(TM) Server Tuning Release 8.0 A54638-01 |
|
This chapter describes how to use the Oracle Trace product to collect Oracle Server event data. It covers:
Server performance data can be collected using the Oracle Trace product. Oracle Trace is a general-purpose data collection product that has been introduced with the Oracle Enterprise Manager systems management product family. The Oracle Trace data collection API can be used in any software product to collect data for a variety of uses, such as performance monitoring, diagnostics, and auditing. Oracle Trace collects specific data for events defined within the host product.
The server performance data that can be collected by Oracle Trace includes:
See Also: Oracle Trace User's Guide and Oracle Trace Developer's Guide contained in the Oracle Enterprise Manager Performance Pack documentation set. These book contain a complete list of events and data that can be collected for Oracle Server.
You can use Oracle Trace to collect server performance data for a specific database session or for the entire instance. You can also select the server event set for which you want to collect.
Oracle Trace allows host application events to be organized into event sets. This allows the user to collect data for a specific subset of all potential host application events. Oracle has defined the following event sets: ALL, DEFAULT, and EXPERT. The ALL set includes all server events, the DEFAULT set excludes server WAIT events, and the EXPERT set is specifically defined for use in the Oracle Expert tuning application. Oracle recommends using the DEFAULT event set.
Server collections can be enabled and controlled in the following ways:
The following sections describe the server-based controls.
See Also: Oracle Trace User's Guide
Six parameters are set up by default to control Oracle Trace. By logging into the internal account in your database and executing a "show parameters trace" command, you will see the following parameters:
The Oracle Trace parameters may be modified and used by adding them to your initialization file.
Note: This chapter references file pathnames on UNIX-based systems. For the exact path on other operating systems, please see your Oracle platform-specific documentation.
See Also: A complete discussion of these parameters is provided in Oracle8 Server Reference Manual.
Note that the ORACLE_TRACE_ENABLE parameter is set to FALSE by default. A value of FALSE disables any use of Oracle Trace for that Oracle server.
To enable Oracle Trace collections for the server, the parameter should be set to TRUE. Setting the parameter to TRUE does not start an Oracle Trace collection, but allows Oracle Trace to be used for that server. Oracle Trace can then be started in one of the following ways:
When ORACLE_TRACE_ENABLE is set to TRUE, you can initiate an Oracle Trace server collection by entering a collection name in the ORACLE_TRACE_COLLECTION_NAME parameter. The default value for this parameter is NULL. A collection name can be up to 16 characters long. You must then shut down your database and start it up again before the parameters take effect. If a collection name is specified, when you start the server, you automatically start an Oracle Trace collection for all database sessions.
To stop the collection, the server instance must be shut down and the ORACLE_TRACE_COLLECTION_NAME must be reset to NULL. The collection name specified in this value is also used in two collection output file names: the collection definition file (collection_name.cdf) and the binary data file (collection_name.dat.
The ORACLE_TRACE_FACILITY_NAME determines the event set that Oracle Trace will collect. The name of the DEFAULT event set is oracled. The ALL event set is oracle and the EXPERT event set is oraclee.
If, once restarted, the database does not start collecting data, you should check the following:
You can invoke an Oracle Trace collection for your own session or for another session by using the Oracle Trace stored procedure packages. To collect Oracle Trace data for your own database session, execute the following stored procedure package:
dbms_oracle_trace_user.set_oracle_trace(true/false, collection_name, server_event_set)
Example:
EXECUTE dbms_oracle_trace_user.set_oracle_trace(TRUE,"MYCOLL","oracle");
To collect Oracle Trace data for a database session other than your own, execute the following stored procedure package:
dbms_oracle_trace_agent.set_oracle_trace_in_session(sid, serial#, true/
false, collection_name, server_event_set)
Example:
EXECUTE dbms_oracle_trace_user.set_oracle_trace_in_session (8,12,TRUE,"MYCOLL", "oracled");
If the collection does not occur, you should check the following:
Another option for controlling Oracle Trace server collections is the Oracle Trace command line interface (CLI). The CLI collects event data for all server sessions attached to the database at collection start time. Sessions that attach after the collection is started are excluded from the collection. The CLI is invoked by the otrccol command for the following functions:
The job_id can be any numeric value. The user must remember this value in order to stop the collection. The input parameter file contains specific parameter values required for each function. Examples follow. The coll_name (collection name) and cdf_file (collection definition file) are initially defined in the start function input parameter file.
The otrccol start command invokes a collection based upon parameter values contained in the input parameter file. For example:
otrccol start 1234 my_start_input_file
where my_start_input_file contains the following input parameters:
col_name= my_collection
dat_file= <usually same as collection name>.dat
cdf_file= <usually same as collection name>.cdf
fdf_file= <server event set>.fdf
regid= 1 192216243 0 0 5 <database SID>
The server event sets that can be used as values for the fdf_file include oracle, oracled, and oraclee. See "Using Initialization Parameters to Control Oracle Trace" on page 23-4 for more information on the server event sets.
The otrccol stop command halts a running collection, as follows:
otrccol stop 1234 my_stop_input_file
where my_stop_input_file contains the collection name and cdf_file name.
The otrccol format command formats the binary collection file to Oracle tables. An example of the format command is as follows:
otrccol format my_format_input_file
where my_format_input_file contains the following input parameters
username= <database username>
password= <database password>
service= <database service name>
cdf_file= <usually same as collection name>.cdf
full_format= <0/1>
A full_format value of 1 will produce a full format, and a value of 0 will produce a partial format. See "Formatting Oracle Trace Data to Oracle Tables" on page 23-10 for information on formatting part or all of an Oracle Trace collection, and other important information on creating the Oracle Trace formatting tables prior to running the format command.
The otrccol dcf command is used to delete collection files for a specific collection. The otrccol dfd command is used to delete formatted data from the Oracle Trace formatter tables for a specific collection.
Running an Oracle Trace collection produces the following collection files:
The Oracle Trace data in the collection files can be accessed in two ways:
Oracle Trace Detail Reports display statistics for all items associated with each occurrence of a server event. These reports can be quite large. You can control the report output by using command parameters. Use the following command and optional parameters to produce a Detail Report:
otrcrep [optional parameters] <collection_name>.cdf
The first step that you may want to take is to run a report called PROCESS.txt. You can produce this report first to give you a listing of specific process identifiers for which you want to run the detail report.
The command parameter used to produce a Process report is:
otrcrep -P <collection_name>.cdf
Other optional detail report parameters are:
Your Oracle Trace server collection can be formatted to Oracle tables for more flexible access by any SQL reporting tool. Oracle Trace will produce a separate table for each event collected. For example, a "parses" event table is created to store data for all parse events that occur during a server collection. Before you can format data, you must first set up the Oracle Trace formatter tables. This is done by executing the otrcfmtc.sql script on the server host machine.
Use the following command to format an Oracle Trace collection:
otrcfmt [optional parameters] <collection_name>.cdf [user/ password@database]
If the user/password@database is omitted, the user will be prompted for this information.
Oracle Trace allows data to be formatted while a collection is occurring. By default, Oracle Trace will only format the portion of the collection that has not been formatted previously. If the user wants to reformat the entire collection file, the optional parameter -f can be used.
Oracle Trace provides several SQL scripts that can be used to access the server event tables. For more information on server event tables and scripts for accessing event data and improving event table performance, refer to the Oracle Trace User's Guide