A globally accessible context called IN_CONTEXT is created as part of the IN_DB_UTIL framework. The IN_DB_UTIL package is used to interface with and manipulate the various attributes associated with the IN_CONTEXT application context.
CREATE OR REPLACE CONTEXT IN_CONTEXT USING INUSER.IN_DB_UTIL ACCESSED GLOBALLY;
The IN_DB_UTIL package currently supports three different client identifiers depending on the scope of the procedures utilizing the IN_DB_UTIL framework. The three client identifiers are IN_DB_UTIL, SYNC, and UPGRADE. The IN_DB_UTIL framework will set the IN_CONTEXT namespace identifier, that is specified during framework initialization, to properly scope the session attributes when setting up a session. This includes extending the call stack for the appropriate identifier as well as setting the various context attributes for the identifier within the IN_CONTEXT namespace.
The list of supported attributes is defined in the IN_CONTEXT_ATTR record type. The IN_CONTEXT application context attributes are visible using the IN_CONTEXT_PRINT procedure or the IN_CONTEXT_GET function or by querying the database directly using the SYS_CONTEXT function while specifying the IN_CONTEXT namespace along with any of the supported attributes.
Example
EXEC DBMS_SESSION.SET_IDENTIFIER(V_IDENTIFIER); SELECT SYS_CONTEXT('IN_CONTEXT', 'STATUS') AS STATUS FROM DUAL;
Example Output
SQL> EXEC DBMS_SESSION.SET_IDENTIFIER('IN_DB_UTIL'); PL/SQL procedure successfully completed. SQL> SELECT SYS_CONTEXT('IN_CONTEXT', 'STATUS') AS STATUS FROM DUAL; STATUS ------ IDLE
A session that is using the IN_DB_UTIL package, will have the IN_CONTEXT namespace identifier that it is currently using, associated with it. This will be visible in the CLIENT_IDENTIFIER column of the V$SESSION view or when querying the CLIENT_IDENTIFIER attribute from SYS_CONTEXT for the USERENV namespace.
Examples
SELECT CLIENT_IDENTIFIER FROM V$SESSION WHERE SID = SYS_CONTEXT('USERENV', 'SID'); SELECT SYS_CONTEXT('USERENV','CLIENT_IDENTIFIER') AS CLIENT_IDENTIFIER FROM DUAL;
Example Output
SQL> SELECT CLIENT_IDENTIFIER FROM V$SESSION WHERE SID = SYS_CONTEXT('USERENV', 'SID'); CLIENT_IDENTIFIER ----------------- IN_DB_UTIL SQL> SELECT SYS_CONTEXT('USERENV','CLIENT_IDENTIFIER') AS CLIENT_IDENTIFIER FROM DUAL; CLIENT_IDENTIFIER ----------------- IN_DB_UTIL