1、 USERENV(OPTION)
返回当前的会话信息. OPTION='ISDBA'若当前是DBA角色,则为TRUE,否则FALSE.
OPTION='LANGUAGE'返回数据库的字符集.
OPTION='SESSIONID'为当前会话标识符.
OPTION='ENTRYID'返回可审计的会话标识符.
OPTION='LANG'返回会话语言名称的ISO简记.
OPTION='INSTANCE'返回当前的实例.
OPTION='terminal'返回当前计算机名
SELECT USERENV('LANGUAGE') FROM DUAL;
2、sys_context
代码如下:
select SYS_CONTEXT('USERENV','TERMINAL') terminal,
SYS_CONTEXT('USERENV','LANGUAGE') language,'SESSIONID') sessionid,'INSTANCE') instance,'ENTRYID') entryid,'ISDBA') isdba,'NLS_TERRITORY') nls_territory,'NLS_CURRENCY') nls_currency,'NLS_CALENDAR') nls_calendar,'NLS_DATE_FORMAT') nls_date_format,'NLS_DATE_LANGUAGE') nls_date_language,'NLS_SORT') nls_sort,'CURRENT_USER') current_user,'CURRENT_USERID') current_userid,'SESSION_USER') session_user,'SESSION_USERID') session_userid,'PROXY_USER') proxy_user,'PROXY_USERID') proxy_userid,'DB_DOMAIN') db_domain,'DB_NAME') db_name,'HOST') host,'OS_USER') os_user,'EXTERNAL_NAME') external_name,'IP_ADDRESS') ip_address,'NETWORK_PROTOCOL') network_protocol,'BG_JOB_ID') bg_job_id,'FG_JOB_ID') fg_job_id,'AUTHENTICATION_TYPE') authentication_type,'AUTHENTICATION_DATA') authentication_data
from dual