The TRACE_SESSION stored procedure can be used enable tracing for a database session.
Tracing for your database session can be enabled using the ON option and later disabled using the OFF option. The REPORT option will display commands necessary to run the Oracle TKPROF utility to format the trace file for readability.
Note: The generated trace file will be created on the database server
and the tkprof utility must be executed on that server using the command provided by the
procedure when tracing was turned on.
Parameter | Description | |
---|---|---|
TRACING | Type: | INPUT |
Datatype: | VARCHAR2(10) | |
Default Value: | HELP | |
Description | The specific command to be executed with respect to the tracing of the session. | |
Options |
HELP = Display usage details. ON = Turn on tracing. OFF = Turn off tracing. REPORT = Display commands to format the trace file into a readable format using the Oracle TKPROF utility. |
|
TRACE_LEVEL | Type | INPUT |
Datatype: | NUMBER | |
Default Value: | 12 | |
Description | The level of tracing to use for the session. | |
Options | See Oracle documentation for all options. | |
TRACEFILE_IDENTIFIER | Type: | INPUT |
Datatype: | VARCHAR2(128) | |
Default Value: | USERNAME_SID_SERIAL# | |
Description | The identifier to be used in labeling the trace file for easier identification in the trace directory. . | |
VERBOSE | Type: | INPUT |
Datatype: | VARCHAR2(128) | |
Default Value: | Yes | |
Description | Used to determine if commands being executed are displayed back to the screen or not. | |
Options |
NO = Suppress Verboseness YES = Verbose |
Exceptions
- NO_DATA_FOUND – Unable to obtain session details.
- INSUFFICIENT_PRIVS – ORA-01031. Grant ALTER SESSION to INUSER to resolve.
- OTHERS
Examples
SET SERVEROUTPUT ON; EXEC IN_DB_UTIL.TRACE_SESSION('HELP'); EXEC IN_DB_UTIL.TRACE_SESSION('ON', 12, 'INUSER_TRACE', 'YES'); EXEC IN_DB_UTIL.TRACE_SESSION(TRACING=>'ON', TRACE_LEVEL=>4); EXEC IN_DB_UTIL.TRACE_SESSION(TRACING=>'OFF'); EXEC IN_DB_UTIL.TRACE_SESSION(TRACING=>'REPORT');