Chapter 40. DBMS_SYSTEM

Table of Contents

40.1. Overview
40.2. Procedure
40.2.1. SET_SQL_TRACE_IN_SESSION

This chapter briefly introduces the DBMS_SYSTEM package, and describes how to use the procedures and functions of the package.

40.1. Overview

DBMS_SYSTEM provides a procedure used to control the system under special circumstances. Only the SYS user can use this package.

40.2. Procedure

This section describes the procedure provided by the DBMS_SYSTEM package.

40.2.1. SET_SQL_TRACE_IN_SESSION

Starts or stops creating a SQL trace log for a specified session. The identifier and the serial number of the session can be found in the V$SESSION view.

The SQL trace log is created in the $TB_HOME/instance/$TB_SID/log/sqltrace directory.

Details about the SET_SQL_TRACE_IN_SESSION procedure are as follows:

  • Prototype

    DBMS_SYSTEM.SET_SQL_TRACE_IN_SESSION 
    (
        sid                 IN      NUMBER,
        serial#             IN      NUMBER,
        sql_trace           IN      BOOLEAN
    );
  • Parameter

    ParameterDescription
    sidSession ID.
    serial#Session serial number.
    sql_traceOption to create a SQL trace log.
  • Example

    begin
        for c in (select sid, serial# from v$session where username = 'TIBERO') loop
            DBMS_SYSTEM.SET_SQL_TRACE_IN_SESSION(c.sid, c.serial#, true);
        end loop;
    end;
    /