투케이2K

197. (Oracle/오라클) SYS_CONTEXT 사용해 USERENV 현재 세션 환경 정보 출력 실시 본문

OracleDB

197. (Oracle/오라클) SYS_CONTEXT 사용해 USERENV 현재 세션 환경 정보 출력 실시

투케이2K 2023. 2. 5. 22:05

[개발 환경 설정]

개발 툴 : Toad

개발 언어 : Oracle

 

[소스 코드]

/*
------------------------------------
[요약 설명]
------------------------------------
1. SYS_CONTEXT 함수는 세션 정보를 얻어오는 함수 입니다
------------------------------------
2. SYS_CONTEXT 함수는 네임스페이에 관계되는 파라미터 값을 반환해줍니다
------------------------------------
3. USERENV : 현재 세션의 환경 정보를 확인합니다
------------------------------------
*/ 


SELECT SYS_CONTEXT ('USERENV', 'ACTION') ACTION,

      SYS_CONTEXT ('USERENV', 'AUDITED_CURSORID') AUDITED_CURSORID,

      SYS_CONTEXT ('USERENV', 'AUTHENTICATED_IDENTITY') AUTHENTICATED_IDENTITY,

      SYS_CONTEXT ('USERENV', 'AUTHENTICATION_DATA') AUTHENTICATION_DATA,

      SYS_CONTEXT ('USERENV', 'AUTHENTICATION_METHOD') AUTHENTICATION_METHOD,

      SYS_CONTEXT ('USERENV', 'BG_JOB_ID') BG_JOB_ID,

      SYS_CONTEXT ('USERENV', 'CLIENT_IDENTIFIER') CLIENT_IDENTIFIER,

      SYS_CONTEXT ('USERENV', 'CLIENT_INFO') CLIENT_INFO,

      SYS_CONTEXT ('USERENV', 'CURRENT_BIND') CURRENT_BIND,

      SYS_CONTEXT ('USERENV', 'CURRENT_SCHEMA') CURRENT_SCHEMA,

      SYS_CONTEXT ('USERENV', 'CURRENT_SCHEMAID') CURRENT_SCHEMAID,

      SYS_CONTEXT ('USERENV', 'CURRENT_SQL') CURRENT_SQL,

      SYS_CONTEXT ('USERENV', 'CURRENT_SQLn') CURRENT_SQLn,

      SYS_CONTEXT ('USERENV', 'CURRENT_SQL_LENGTH') CURRENT_SQL_LENGTH,

      SYS_CONTEXT ('USERENV', 'DB_DOMAIN') DB_DOMAIN,

      SYS_CONTEXT ('USERENV', 'DB_NAME') DB_NAME,

      SYS_CONTEXT ('USERENV', 'DB_UNIQUE_NAME') DB_UNIQUE_NAME,

      SYS_CONTEXT ('USERENV', 'ENTRYID') ENTRYID,

      SYS_CONTEXT ('USERENV', 'ENTERPRISE_IDENTITY') ENTERPRISE_IDENTITY,

      SYS_CONTEXT ('USERENV', 'FG_JOB_ID') FG_JOB_ID,

      SYS_CONTEXT ('USERENV', 'GLOBAL_CONTEXT_MEMORY') GLOBAL_CONTEXT_MEMORY,

      SYS_CONTEXT ('USERENV', 'GLOBAL_UID') GLOBAL_UID,

      SYS_CONTEXT ('USERENV', 'HOST') HOST,

      SYS_CONTEXT ('USERENV', 'IDENTIFICATION_TYPE') IDENTIFICATION_TYPE,

      SYS_CONTEXT ('USERENV', 'INSTANCE') INSTANCE,

      SYS_CONTEXT ('USERENV', 'INSTANCE_NAME') INSTANCE_NAME,

      SYS_CONTEXT ('USERENV', 'IP_ADDRESS') IP_ADDRESS,

      SYS_CONTEXT ('USERENV', 'ISDBA') ISDBA,

      SYS_CONTEXT ('USERENV', 'LANG') LANG,

      SYS_CONTEXT ('USERENV', 'LANGUAGE') LANG,

      SYS_CONTEXT ('USERENV', 'MODULE') MODULE,

      SYS_CONTEXT ('USERENV', 'NETWORK_PROTOCOL') NETWORK_PROTOCOL,

      SYS_CONTEXT ('USERENV', 'NLS_CALENDAR') NLS_CALENDAR,

      SYS_CONTEXT ('USERENV', 'NLS_CURRENCY') NLS_CURRENCY,

      SYS_CONTEXT ('USERENV', 'NLS_DATE_FORMAT') NLS_DATE_FORMAT,

      SYS_CONTEXT ('USERENV', 'NLS_DATE_LANGUAGE') NLS_DATE_LANGUAGE,

      SYS_CONTEXT ('USERENV', 'NLS_SORT') NLS_SORT,

      SYS_CONTEXT ('USERENV', 'NLS_TERRITORY') NLS_TERRITORY,

      SYS_CONTEXT ('USERENV', 'OS_USER') OS_USER,

      SYS_CONTEXT ('USERENV', 'POLICY_INVOKER') POLICY_INVOKER,

      SYS_CONTEXT ('USERENV', 'PROXY_ENTERPRISE_IDENTITY') PROXY_ENTERPRISE_IDENTITY,
      
      SYS_CONTEXT ('USERENV', 'PROXY_USER') PROXY_USER,

      SYS_CONTEXT ('USERENV', 'PROXY_USERID') PROXY_USERID,

      SYS_CONTEXT ('USERENV', 'SERVER_HOST') SERVER_HOST,

      SYS_CONTEXT ('USERENV', 'SERVICE_NAME') SERVICE_NAME,

      SYS_CONTEXT ('USERENV', 'SESSION_USER') SESSION_USER,

      SYS_CONTEXT ('USERENV', 'SESSION_USERID') SESSION_USERID,

      SYS_CONTEXT ('USERENV', 'SESSIONID') SESSIONID,

      SYS_CONTEXT ('USERENV', 'SID') SID,

      SYS_CONTEXT ('USERENV', 'STATEMENTID') STATEMENTID,

      SYS_CONTEXT ('USERENV', 'TERMINAL') TERMINAL

    FROM DUAL;

 

반응형
Comments