-- 세션 정보 조회
----------------------------------------------------
SELECT USERENV('CLIENT_INFO') AS CLIENT_INFO -- Returns user session information stored using the DBMS_APPLICATION_INFO package
, USERENV('ENTRYID') AS ENTRYID -- Available auditing entry identifier
, USERENV('INSTANCE') AS INSTANCE -- The identifier number of the current instance
, USERENV('ISDBA') AS ISDBA -- Returns TRUE if the user has DBA privileges. Otherwise, it will return FALSE.
, USERENV('LANG') AS LANG -- The ISO abbreviation for the language
, USERENV('LANGUAGE') AS LANGUAGE -- The language, territory, and character of the session. In the following format: language_territory.characterset
, USERENV('SESSIONID') AS SESSIONID -- The identifier of the auditing session
, USERENV('TERMINAL') AS TERMINAL -- THE OS IDENTIFIER OF THE CURRENT SESSION
, USERENV('SID') AS SID -- SID
FROM DUAL;
--
----------------------------------------------------
SELECT 'ACTION' KEY, SYS_CONTEXT('USERENV', 'ACTION') VALUE FROM DUAL UNION ALL
SELECT 'AUDITED_CURSORID' KEY, SYS_CONTEXT('USERENV', 'AUDITED_CURSORID') VALUE FROM DUAL UNION ALL
SELECT 'AUTHENTICATED_IDENTITY' KEY, SYS_CONTEXT('USERENV', 'AUTHENTICATED_IDENTITY') VALUE FROM DUAL UNION ALL
SELECT 'AUTHENTICATION_DATA' KEY, SYS_CONTEXT('USERENV', 'AUTHENTICATION_DATA') VALUE FROM DUAL UNION ALL
SELECT 'AUTHENTICATION_METHOD' KEY, SYS_CONTEXT('USERENV', 'AUTHENTICATION_METHOD') VALUE FROM DUAL UNION ALL
SELECT 'AUTHENTICATION_TYPE' KEY, SYS_CONTEXT('USERENV', 'AUTHENTICATION_TYPE') VALUE FROM DUAL UNION ALL
SELECT 'BG_JOB_ID' KEY, SYS_CONTEXT('USERENV', 'BG_JOB_ID') VALUE FROM DUAL UNION ALL
SELECT 'CLIENT_IDENTIFIER' KEY, SYS_CONTEXT('USERENV', 'CLIENT_IDENTIFIER') VALUE FROM DUAL UNION ALL
SELECT 'CLIENT_INFO' KEY, SYS_CONTEXT('USERENV', 'CLIENT_INFO') VALUE FROM DUAL UNION ALL
SELECT 'CURRENT_BIND' KEY, SYS_CONTEXT('USERENV', 'CURRENT_BIND') VALUE FROM DUAL UNION ALL
SELECT 'CURRENT_SCHEMA' KEY, SYS_CONTEXT('USERENV', 'CURRENT_SCHEMA') VALUE FROM DUAL UNION ALL
SELECT 'CURRENT_SCHEMAID' KEY, SYS_CONTEXT('USERENV', 'CURRENT_SCHEMAID') VALUE FROM DUAL UNION ALL
SELECT 'CURRENT_SQL' KEY, SYS_CONTEXT('USERENV', 'CURRENT_SQL') VALUE FROM DUAL UNION ALL
SELECT 'CURRENT_SQL_LENGTH' KEY, SYS_CONTEXT('USERENV', 'CURRENT_SQL_LENGTH') VALUE FROM DUAL UNION ALL
SELECT 'CURRENT_USER' KEY, SYS_CONTEXT('USERENV', 'CURRENT_USER') VALUE FROM DUAL UNION ALL
SELECT 'CURRENT_USERID' KEY, SYS_CONTEXT('USERENV', 'CURRENT_USERID') VALUE FROM DUAL UNION ALL
SELECT 'DB_DOMAIN' KEY, SYS_CONTEXT('USERENV', 'DB_DOMAIN') VALUE FROM DUAL UNION ALL
SELECT 'DB_NAME' KEY, SYS_CONTEXT('USERENV', 'DB_NAME') VALUE FROM DUAL UNION ALL
SELECT 'DB_UNIQUE_NAME' KEY, SYS_CONTEXT('USERENV', 'DB_UNIQUE_NAME') VALUE FROM DUAL UNION ALL
SELECT 'ENTRYID' KEY, SYS_CONTEXT('USERENV', 'ENTRYID') VALUE FROM DUAL UNION ALL
SELECT 'ENTERPRISE_IDENTITY' KEY, SYS_CONTEXT('USERENV', 'ENTERPRISE_IDENTITY') VALUE FROM DUAL UNION ALL
SELECT 'EXTERNAL_NAME' KEY, SYS_CONTEXT('USERENV', 'EXTERNAL_NAME') VALUE FROM DUAL UNION ALL
SELECT 'FG_JOB_ID' KEY, SYS_CONTEXT('USERENV', 'FG_JOB_ID') VALUE FROM DUAL UNION ALL
SELECT 'GLOBAL_CONTEXT_MEMORY' KEY, SYS_CONTEXT('USERENV', 'GLOBAL_CONTEXT_MEMORY') VALUE FROM DUAL UNION ALL
SELECT 'GLOBAL_UID' KEY, SYS_CONTEXT('USERENV', 'GLOBAL_UID') VALUE FROM DUAL UNION ALL
SELECT 'HOST' KEY, SYS_CONTEXT('USERENV', 'HOST') VALUE FROM DUAL UNION ALL
SELECT 'IDENTIFICATION_TYPE' KEY, SYS_CONTEXT('USERENV', 'IDENTIFICATION_TYPE') VALUE FROM DUAL UNION ALL
SELECT 'INSTANCE' KEY, SYS_CONTEXT('USERENV', 'INSTANCE') VALUE FROM DUAL UNION ALL
SELECT 'INSTANCE_NAME' KEY, SYS_CONTEXT('USERENV', 'INSTANCE_NAME') VALUE FROM DUAL UNION ALL
SELECT 'IP_ADDRESS' KEY, SYS_CONTEXT('USERENV', 'IP_ADDRESS') VALUE FROM DUAL UNION ALL
SELECT 'ISDBA' KEY, SYS_CONTEXT('USERENV', 'ISDBA') VALUE FROM DUAL UNION ALL
SELECT 'LANG' KEY, SYS_CONTEXT('USERENV', 'LANG') VALUE FROM DUAL UNION ALL
SELECT 'LANGUAGE' KEY, SYS_CONTEXT('USERENV', 'LANGUAGE') VALUE FROM DUAL UNION ALL
SELECT 'MODULE' KEY, SYS_CONTEXT('USERENV', 'MODULE') VALUE FROM DUAL UNION ALL
SELECT 'NETWORK_PROTOCOL' KEY, SYS_CONTEXT('USERENV', 'NETWORK_PROTOCOL') VALUE FROM DUAL UNION ALL
SELECT 'NLS_CALENDAR' KEY, SYS_CONTEXT('USERENV', 'NLS_CALENDAR') VALUE FROM DUAL UNION ALL
SELECT 'NLS_CURRENCY' KEY, SYS_CONTEXT('USERENV', 'NLS_CURRENCY') VALUE FROM DUAL UNION ALL
SELECT 'NLS_DATE_FORMAT' KEY, SYS_CONTEXT('USERENV', 'NLS_DATE_FORMAT') VALUE FROM DUAL UNION ALL
SELECT 'NLS_DATE_LANGUAGE' KEY, SYS_CONTEXT('USERENV', 'NLS_DATE_LANGUAGE') VALUE FROM DUAL UNION ALL
SELECT 'NLS_SORT' KEY, SYS_CONTEXT('USERENV', 'NLS_SORT') VALUE FROM DUAL UNION ALL
SELECT 'NLS_TERRITORY' KEY, SYS_CONTEXT('USERENV', 'NLS_TERRITORY') VALUE FROM DUAL UNION ALL
SELECT 'OS_USER' KEY, SYS_CONTEXT('USERENV', 'OS_USER') VALUE FROM DUAL UNION ALL
SELECT 'POLICY_INVOKER' KEY, SYS_CONTEXT('USERENV', 'POLICY_INVOKER') VALUE FROM DUAL UNION ALL
SELECT 'PROXY_ENTERPRISE_IDENTITY' KEY, SYS_CONTEXT('USERENV', 'PROXY_ENTERPRISE_IDENTITY') VALUE FROM DUAL UNION ALL
SELECT 'PROXY_USER' KEY, SYS_CONTEXT('USERENV', 'PROXY_USER') VALUE FROM DUAL UNION ALL
SELECT 'PROXY_USERID' KEY, SYS_CONTEXT('USERENV', 'PROXY_USERID') VALUE FROM DUAL UNION ALL
SELECT 'SERVER_HOST' KEY, SYS_CONTEXT('USERENV', 'SERVER_HOST') VALUE FROM DUAL UNION ALL
SELECT 'SERVICE_NAME' KEY, SYS_CONTEXT('USERENV', 'SERVICE_NAME') VALUE FROM DUAL UNION ALL
SELECT 'SESSION_USER' KEY, SYS_CONTEXT('USERENV', 'SESSION_USER') VALUE FROM DUAL UNION ALL
SELECT 'SESSION_USERID' KEY, SYS_CONTEXT('USERENV', 'SESSION_USERID') VALUE FROM DUAL UNION ALL
SELECT 'SESSIONID' KEY, SYS_CONTEXT('USERENV', 'SESSIONID') VALUE FROM DUAL UNION ALL
SELECT 'SID' KEY, SYS_CONTEXT('USERENV', 'SID') VALUE FROM DUAL UNION ALL
SELECT 'STATEMENTID' KEY, SYS_CONTEXT('USERENV', 'STATEMENTID') VALUE FROM DUAL UNION ALL
SELECT 'TERMINAL' KEY, SYS_CONTEXT('USERENV', 'TERMINAL') VALUE FROM DUAL;