ITPub博客

首页 > 数据库 > Oracle > Oracle 中的userenv()

Oracle 中的userenv()

原创 Oracle 作者:j04212 时间:2014-02-14 16:06:11 0 删除 编辑

 

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


3)ENTRYID 返回会话人口标志

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

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


4)INSTANCE 返回当前INSTANCE的标志

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

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


5)LANGUAGE 返回当前环境变量

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

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


6)LANG 返回当前环境的语言的缩写

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

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


7)TERMINAL 返回用户的终端或机器的标志

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

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


8)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;

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

上一篇: Oracle sqlloader
下一篇: Oracle 多路复用
请登录后发表评论 登录
全部评论

注册时间:2012-10-23

  • 博文量
    94
  • 访问量
    249136