Chapter 4. DBMS_APPLICATION_INFO

Table of Contents

4.1. Overview
4.2. Procedures
4.2.1. READ_CLIENT_INFO
4.2.2. READ_MODULE
4.2.3. SET_ACTION
4.2.4. SET_CLIENT_INFO
4.2.5. SET_MODULE
4.2.6. SET_SESSION_LONGOPS

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

4.1. Overview

DBMS_APPLICATION_INFO modifies values in the V$SESSION and SYS._VT_SESSION_LONGOPS views.

4.2. Procedures

This section describes the procedures provided by the DBMS_DBMS_APPLICATION_INFO package, in alphabetical order.

4.2.1. READ_CLIENT_INFO

Reads the client_info value of the current session.

Details about the READ_CLIENT_INFO procedure are as follows:

  • Prototype

    DBMS_APPLICATION_INFO.READ_CLIENT_INFO
    (
        client_info         OUT         VARCHAR2
    );
  • Parameter

    ParameterDescription
    client_infoThe value of client info read from the session.
  • Example

    DECLARE
       client_info VARCHAR2(64);
    BEGIN
       DBMS_APPLICATION_INFO.READ_CLIENT_INFO(client_info);
       DBMS_OUTPUT.PUT_LINE(client_info);
    END;
    /

4.2.2. READ_MODULE

Reads information about modules and actions of the current session.

Details about the READ_MODULE procedure are as follows:

  • Prototype

    DBMS_APPLICATION_INFO.READ_MODULE
    (
        module_name         OUT         VARCHAR2, 
        action_name         OUT         VARCHAR2
    )
  • Parameter

    ParameterDescription
    module_nameThe value of the module of the current session.
    action_nameThe value of the action of the current session.
  • Example

    DECLARE
        module_name VARCHAR(64);                                                       
        action_name VARCHAR(64);                                                      
    BEGIN
        DBMS_APPLICATION_INFO.READ_MODULE(module_name, action_name);
        DBMS_OUTPUT.PUT_LINE(module_name);
        DBMS_OUTPUT.PUT_LINE(action_name);                                                    
    END;
    /

4.2.3. SET_ACTION

Specifies the action name of the current session.

Details about the SET_ACTION procedure are as follows:

  • Prototype

    DBMS_APPLICATION_INFO.SET_ACTION
              ( action_name IN VARCHAR2 )
  • Parameter

    ParameterDescription
    action_nameThe action name to be stored in the session. Names longer than 64 bytes are truncated.
  • Example

    CREATE TABLE NEW_DATA_TBL(DATA NUMBER)
    /
    
    BEGIN 
        DBMS_APPLICATION_INFO.SET_ACTION('데이터 추가');
        INSERT INTO NEW_DATA_TBL VALUES(1);
        INSERT INTO NEW_DATA_TBL VALUES(2);
        COMMIT;
        DBMS_APPLICATION_INFO.SET_ACTION(NULL);
    END;
    /

4.2.4. SET_CLIENT_INFO

Specifies client information for the current session.

Details about the SET_CLIENT_INFO procedure are as follows:

  • Prototype

    DBMS_APPLICATION_INFO.SET_CLIENT_INFO
              ( client_info IN VARCHAR2 );
  • Parameter

    ParameterDescription
    client_infoThe value of client_info to be stored in the current session. Information longer than 64 bytes is truncated.
  • Example

    BEGIN 
        DBMS_APPLICATION_INFO.SET_CLIENT_INFO('my_client_info');
    END; 
    /
    
    SELECT sid, client_info FROM V$SESSION WHERE client_info = 'my_client_info';

4.2.5. SET_MODULE

Specifies the module name for the current session.

Details about the SET_MODULE procedure are as follows:

  • Prototype

    DBMS_APPLICATION_INFO.SET_MODULE
    (
        module_name         IN          VARCHAR2, 
        action_name         IN          VARCHAR2
    );
  • Parameter

    ParameterDescription
    module_nameThe module name to be stored in the session. Names longer than 64 bytes are truncated.
    action_nameThe action name to be stored in the session. Names longer than 64 bytes are truncated.
  • Example

    CREATE TABLE NEW_DATA_TBL(DATA NUMBER)
    /
    
    BEGIN 
        DBMS_APPLICATION_INFO.SET_MODULE('Adding data', 'Inserting new data');
        INSERT INTO NEW_DATA_TBL VALUES(1);
        INSERT INTO NEW_DATA_TBL VALUES(2);
        COMMIT;
        DBMS_APPLICATION_INFO.SET_MODULE(NULL, NULL);
    END;
    /

4.2.6. SET_SESSION_LONGOPS

Modifies a value in the SYS._VT_SESSION_LONGOPS view.

Details about the SET_SESSION_LONGOPS procedure are as follows:

  • Prototype

    DBMS_APPLICATION_INFO.SET_SESSION_LONGOPS
    (
         id                  IN OUT      PLS_INTEGER,
         op_name             IN          VARCHAR     DEFAULT NULL,
         sofar               IN          NUMBER      DEFAULT 0,
         totalwork           IN          NUMBER      DEFAULT 0,
         target_desc         IN          VARCHAR2    DEFAULT 'unknown target',
         units               IN          VARCHAR2    DEFAULT NULL
    );
  • Parameter

    ParameterDescription
    id

    The ID of longops to be used.

    If -1 is specified, a new ID is allocated.

    op_name

    The opname column value to be stored in SYS._VT_SESSION_LONGOPS.

    Information that exceeds 128 bytes is ignored.

    sofarThe sofar column value to be stored in SYS._VT_SESSION_LONGOPS.
    totalworkThe totalwork column value to be stored in SYS._VT_SESSION_LONGOPS.
    target_desc

    The target_desc column value to be stored in SYS._VT_SESSION_LONGOPS.

    Information that exceeds 128 bytes is ignored.

    units

    The units column value to be stored in SYS._VT_SESSION_LONGOPS.

    Information that exceeds 128 bytes is ignored.

  • Example

    DECLARE
        idx PLS_INTERGER := -1;
    
    BEGIN 
    DBMS_APPLICATION_INFO.SET_SESSION_LONGOPS(idx);
    END;
    / 
    SELECT * FROM SYS._VT_SESSION_LONGOPS;