USERENV()获取Oracle环境信息

一般通过USERENV()函数获取

SELECT USERENV('ISDBA'),
       USERENV('LANGUAGE'),
       USERENV('ENTRYID'),
       USERENV('LANG'),
       USERENV('INSTANCE')
  FROM DUAL

 

也可以通过以下函数获取

SELECT SYS_CONTEXT('USERENV', 'TERMINAL') TERMINAL,
       SYS_CONTEXT('USERENV', 'LANGUAGE') LANGUAGE,
       SYS_CONTEXT('USERENV', 'SESSIONID') SESSIONID,
       SYS_CONTEXT('USERENV', 'INSTANCE') INSTANCE,
       SYS_CONTEXT('USERENV', 'ENTRYID') ENTRYID,
       SYS_CONTEXT('USERENV', 'ISDBA') ISDBA,
       SYS_CONTEXT('USERENV', 'NLS_TERRITORY') NLS_TERRITORY,
       SYS_CONTEXT('USERENV', 'NLS_CURRENCY') NLS_CURRENCY,
       SYS_CONTEXT('USERENV', 'NLS_CALENDAR') NLS_CALENDAR,
       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', 'CURRENT_USER') CURRENT_USER,
       SYS_CONTEXT('USERENV', 'CURRENT_USERID') CURRENT_USERID,
       SYS_CONTEXT('USERENV', 'SESSION_USER') SESSION_USER,
       SYS_CONTEXT('USERENV', 'SESSION_USERID') SESSION_USERID,
       SYS_CONTEXT('USERENV', 'PROXY_USER') PROXY_USER,
       SYS_CONTEXT('USERENV', 'PROXY_USERID') PROXY_USERID,
       SYS_CONTEXT('USERENV', 'DB_DOMAIN') DB_DOMAIN,
       SYS_CONTEXT('USERENV', 'DB_NAME') DB_NAME,
       SYS_CONTEXT('USERENV', 'HOST') HOST,
       SYS_CONTEXT('USERENV', 'OS_USER') OS_USER,
       SYS_CONTEXT('USERENV', 'EXTERNAL_NAME') EXTERNAL_NAME,
       SYS_CONTEXT('USERENV', 'IP_ADDRESS') IP_ADDRESS,
       SYS_CONTEXT('USERENV', 'NETWORK_PROTOCOL') NETWORK_PROTOCOL,
       SYS_CONTEXT('USERENV', 'BG_JOB_ID') BG_JOB_ID,
       SYS_CONTEXT('USERENV', 'FG_JOB_ID') FG_JOB_ID,
       SYS_CONTEXT('USERENV', 'AUTHENTICATION_TYPE') AUTHENTICATION_TYPE,
       SYS_CONTEXT('USERENV', 'AUTHENTICATION_DATA') AUTHENTICATION_DATA
  FROM DUAL

你可能感兴趣的:(userenv函数)