Oracle 中的Userenv() [转]

1.USEREVN()


返回当前用户环境的信息,opt可以是:
ENTRYID,SESSIONID,TERMINAL,ISDBA,LABLE,LANGUAGE,CLIENT_INFO,LANG,VSIZE

1.ISDBA 查看当前用户是否是DBA如果是则返回true
SQL> select userenv('isdba') from dual;

USEREN
------
FALSE


2.SESSION 返回会话标志


SQL> select userenv('sessionid') from dual;

USERENV('SESSIONID')
--------------------
152


4.ENTRYID 返回会话人口标志


SQL> select userenv('entryid') from dual;

USERENV('ENTRYID')
------------------
0


5.INSTANCE 返回当前INSTANCE的标志
SQL> select userenv('instance') from dual;

USERENV('INSTANCE')
-------------------
1


6.LANGUAGE 返回当前环境变量
SQL> select userenv('language') from dual;

USERENV('LANGUAGE')
----------------------------------------------------
SIMPLIFIED CHINESE_CHINA.ZHS16GBK

7.LANG 返回当前环境的语言的缩写
SQL> select userenv('lang') from dual;

USERENV('LANG')
----------------------------------------------------
ZHS


8.TERMINAL 返回用户的终端或机器的标志
SQL> select userenv('terminal') from dual;

USERENV('TERMINA
----------------
GAO


9.VSIZE(X) 返回X的大小(字节)数
SQL> select vsize(user),user from dual;

VSIZE(USER) USER
----------- ------------------------------
6 SYSTEM

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;

 

source:http://www.cnblogs.com/wanglibo/articles/2121098.html

来自 “ ITPUB博客 ” ,链接:http://blog.itpub.net/7583803/viewspace-714697/,如需转载,请注明出处,否则将追究法律责任。

转载于:http://blog.itpub.net/7583803/viewspace-714697/

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值