Oracle SYS_CONTEXT(namespace, parameter) values can be used manage Oracle database, PL/SQL code and overall database setup. The code shown below displays typical SYS_CONTEXT values.

Display Values - SYS_CONTEXT(namespace, parameter)
-- Some parameters may not be setup depending
-- on database edition
DECLARE
 PROCEDURE sys_ctxt(i_p_name    IN VARCHAR2, 
                    i_parameter IN VARCHAR2) AS
 BEGIN
  DBMS_OUTPUT.PUT_LINE(RPAD(UPPER(i_p_name),20,' ')||
    ' -> '||SYS_CONTEXT('USERENV',i_parameter));
 END sys_ctxt;
BEGIN
 sys_ctxt('Database',          'DB_NAME');
 sys_ctxt('Db Unique name',    'DB_UNIQUE_NAME');
 sys_ctxt('Db Domain',         'DB_DOMAIN');
 sys_ctxt('global UID',        'GLOBAL_UID');
 sys_ctxt('SGA No',            'GLOBAL_CONTEXT_MEMORY');

 sys_ctxt('server host',       'SERVER_HOST');
 sys_ctxt('Enterprise ID',     'ENTERPRISE_IDENTITY');
 sys_ctxt('Instance count',    'INSTANCE');
 sys_ctxt('Instance Name',     'INSTANCE_NAME');
 sys_ctxt('Network protocol',  'NETWORK_PROTOCOL');
 sys_ctxt('IP Address',        'IP_ADDRESS');
 sys_ctxt('NLS territory',     'NLS_TERRITORY');
 sys_ctxt('Language',          'LANGUAGE');
 sys_ctxt('Language Short',    'LANG');
 sys_ctxt('NLS calendar',      'NLS_CALENDAR');
 sys_ctxt('NLS date format',   'NLS_DATE_FORMAT');
 sys_ctxt('NLS date language', 'NLS_DATE_LANGUAGE');
 sys_ctxt('NLS currency',      'NLS_CURRENCY');
 sys_ctxt('NLS sort',          'NLS_SORT');

 sys_ctxt('policy invoker',    'POLICY_INVOKER');
 sys_ctxt('Authentication',    'AUTHENTICATION_DATA');
 sys_ctxt('Method',            'AUTHENTICATION_METHOD');
 sys_ctxt('Identity',          'AUTHENTICATED_IDENTITY');
 sys_ctxt('Identification',    'IDENTIFICATION_TYPE');

 sys_ctxt('Session user',      'SESSION_USER');
 sys_ctxt('Session user ID',   'SESSION_USERID');
 sys_ctxt('Client host name',  'HOST');
 sys_ctxt('Client ID',         'CLIENT_IDENTIFIER');
 sys_ctxt('Client Info',       'CLIENT_INFO');
 sys_ctxt('Client Username',   'OS_USER');
 sys_ctxt('Application name',  'MODULE');
 sys_ctxt('Position In App',   'ACTION');
 sys_ctxt('DBA',               'ISDBA');
 sys_ctxt('Client terminal',   'TERMINAL');

 sys_ctxt('current schema',     'CURRENT_SCHEMA');
 sys_ctxt('current schema ID',  'CURRENT_SCHEMAID');
 sys_ctxt('Session ID',         'SESSIONID');
 sys_ctxt('SID',                'SID');
 sys_ctxt('current sql',        'CURRENT_SQL');

 sys_ctxt('Background Job ID',  'BG_JOB_ID');
 sys_ctxt('Foreground Job ID',  'FG_JOB_ID');
 /*  sys_ctxt('Proxy user', 'PROXY_USER');
 sys_ctxt('Proxy user ID',   'PROXY_USERID');
 sys_ctxt('Proxy global UID','PROXY_GLOBAL_UID');
 sys_ctxt('Proxy Enterprise ID',
     'PROXY_ENTERPRISE_IDENTITY');     */
END;
/
  
SYS_CONTEXT(namespace, parameter) values
Note: Some data scrambled for privacy.
Sys_Context Values as a - Query

Oracle registered trademark of Oracle Corporation.

Last Revised on: March 05, 2012

  1309