|Oracle8i Supplied Packages Reference
Oracle8i PL/SQL provides an API for tracing the execution of PL/SQL programs on the server. You can use the Trace API, implemented on the server as the
DBMS_TRACE package, to trace PL/SQL functions, procedures, and exceptions.
DBMS_TRACE provides subprograms to start and stop PL/SQL tracing in a session. The trace data gets collected as the program executes, and it is written out to the Oracle Server trace file.
A typical session involves:
This package must be created under
You cannot use PL/SQL tracing with the multi-threaded server (MTS).
trace_all_calls constant INTEGER := 1; trace_enabled_calls constant INTEGER := 2; trace_all_exceptions constant INTEGER := 4; trace_enabled_exceptions constant INTEGER := 8; /* * The version of the trace package. These constants will change as the * package evolves. Use the PLSQL_TRACE_VERSION procedure (described below) * to get the current version of the package. */ trace_major_version constant BINARY_INTEGER := 1; trace_minor_version constant BINARY_INTEGER := 0;
Profiling large applications may produce a huge volume of data. You can control the volume of data collected by enabling specific program units for trace data collection.
You can enable a program unit by compiling it debug. This can be done in one of two ways:
alter session set plsql_debug=true; create or replace ... /* create the library units - debug information will be generated */
/* recompile specific library unit with debug option */ alter [PROCEDURE | FUNCTION | PACKAGE BODY] <libunit-name> compile debug;
Two levels of call tracing are available:
Enabling cannot be detected for remote procedure calls (RPCs); hence, RPCs are only traced with level 1.
Two levels of exception tracing are available:
If tracing is requested only for enabled program units, and if the current program unit is not enabled, then no trace data is written.
If the current program unit is enabled, then call tracing writes out the program unit type, name, and stack depth.
If the current program unit is not enabled, then call tracing writes out the program unit type, line number, and the stack depth.
Exception tracing writes out the line number. Raising the exception shows information on whether the exception is user-defined or pre-defined and the exception number, in the case of pre-defined exceptions.
Starts tracing in the current session.
Stops trace data dumping in session.
Gets the version number of the trace package.
This procedure enables PL/SQL trace data collection.
See "Collecting Trace Data" for more information.
This procedure disables trace data collection.
This procedure gets the version number of the trace package. It returns the major and minor version number of the
Major version number of
Minor version number of