Oracle USERENVºÍsys_context
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('U
Ïà¹ØÎĵµ£º
×î½üÒ»¶Îʱ¼äһֱûд²©¿Í£¬²»ÊÇÀÁ£¬ÊÇѧÁËÌ«¶à¶«Î÷¡£ÒÔºóÂýÂý²¹ÉÏ¡£ 1. odbcÖÐÌí¼ÓoracleÊý¾ÝÔ´ odbcÖÐÌí¼ÓoracleÊý¾ÝÔ´Ê×ÒªÌõ¼þ£º°²×°oracle client¡£°²×°ÍêÖ®ºóÌí¼Ó£¬µ«ÊÇ»¹±ØÐëÔÚ°²×°Ä¿Â¼ÏÂͨ³£ÊÇC:\oracle\ora90\network\ADMIN\tnsnames.oraÖÐÌí¼ÓÒ»¸öÁ¬½Ó£¬Èçϸñʽ£º DXS =
(DESCRIPTION =
......
Ç°¼¸ÌìÃæÊÔµÄʱºòÃæÊÔ¹Ù²ÅÎʹýÎÒORACLEµÄÌåϵ½á¹¹£¬ÈÃÎÒÔÚÒ»ÕÅ°×Ö½ÉÏ»³öÀ´¡£»ØÍ·ÏëÏ뵱ʱ´ðµÃ»¹²»´í£¬´ó²¿·ÖÄÚÈݶ¼ÃèÊö³öÀ´ÁË£¬ºÇºÇ£¬¸Õ²ÅÔÚÍøÉÏ¿´µ½Ò»Æª½²½âORACLEÌåϵ½á¹¹µÄÎÄÕ£¬¾õµÃ²»´í£¬×ª¹ýÀ´´æ×Å£¬½«À´¿ÉÄÜ»áÓõ½¡£
=================================================================================
ÔÚ±¾ÎÄÀ ......
Ò»¡£ÓÐÊý¾ÝÎļþ¡¢¿ØÖÆÎļþºÍÈÕÖ¾ÎļþµÄ±¸·Ý1.·þÎñÆ÷ÖØ×°Á˲Ù×÷ϵͳ£¬oracleÒ²ÖØ×°ÁË¡£Èç¹ûÖØ×°µÄoracleºÍÒÔÇ°Ë𻵵ÄÊý¾Ý¿âÊÇһģһÑùµÄ½á¹¹£¬ÄÇô´ËʱµÄ»Ö¸´ÊDZȽϼòµ¥µÄ¡£
1£©É¾³ýµôн¨Êý¾Ý¿âµÄËùÓÐÊý¾ÝÎļþ¡¢¿ØÖÆÎļþºÍÈÕÖ¾Îļþ¡£CopyÔÊý¾Ý¿âµÄÊý¾ÝÎļþ¡¢¿ØÖÆÎļþºÍÈÕÖ¾Îļþµ½¶ÔӦĿ¼Ï¡£
  ......
author:skate
time:2009/10/23
ÕâÁ½ÌìÒ»ÅóÓÑÎÊÈçºÎ¸ü¸ÄÊý¾Ý¿âÃû£¬ÓÚÊÇ×ö¸ö²âÊÔ£¬¼òµ¥¼Ç¼Ï£¬ÒÔ±ã˵Ã÷ÎÊÌâ
ÈçºÎÐÞ¸ÄÊý¾Ý¿âÃû£¨db_name)¼°ÊµÀýÃû(Instance_name or Service_name)
NidÊÇOracle´Ó9iR2¿ªÊ¼ÌṩµÄ¹¤¾ß£¬¿ÉÒÔÓÃÀ´¸ü¸ÄÊý¾Ý¿âÃû³Æ£¬¶øÎÞÐèͨ¹ý֮ǰÖؽ¨¿ØÖÆÎļþµÈ·±Ëö·½Ê½¡£
nidÊÇ×Ô´øµÄ¹¤¾ß£¬ÔÚoracle_home/b ......