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,  
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

3.与系统视图v$session组合使用可以获得更多信息(客户端所使用的应用程序等)
复制代码 代码如下:
select *
  from v$session se,
       (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) base
 where se.AUDSID = base.sessionid;
 

标签:
Oracle,获取会话信息,函数

免责声明:本站文章均来自网站采集或用户投稿,网站不提供任何软件下载或自行开发的软件! 如有用户或公司发现本站内容信息存在侵权行为,请邮件告知! 858582#qq.com
评论“Oracle中获取会话信息的两个函数分享”
暂无“Oracle中获取会话信息的两个函数分享”评论...

RTX 5090要首发 性能要翻倍!三星展示GDDR7显存

三星在GTC上展示了专为下一代游戏GPU设计的GDDR7内存。

首次推出的GDDR7内存模块密度为16GB,每个模块容量为2GB。其速度预设为32 Gbps(PAM3),但也可以降至28 Gbps,以提高产量和初始阶段的整体性能和成本效益。

据三星表示,GDDR7内存的能效将提高20%,同时工作电压仅为1.1V,低于标准的1.2V。通过采用更新的封装材料和优化的电路设计,使得在高速运行时的发热量降低,GDDR7的热阻比GDDR6降低了70%。