oracle 回话环境变量 userenv ,oracle connetion context 会话环境 连接的会话环境
userenv( ' ISDBA ' ),
userenv( ' SESSIONID ' ),
userenv( ' ENTRYID ' ),
userenv( ' LANG ' ),
userenv( ' INSTANCE ' ),
userenv( ' terminal ' )
FROM DUAL
select userenv('LANGUAGE'),
userenv('ISDBA'),
userenv('SESSIONID'),
userenv('ENTRYID'),
userenv('LANG'),
userenv('INSTANCE'),
userenv('terminal')
FROM DUAL
USERENV('LANGUAGE') USERENV('ISDBA') USERENV('SESSIONID') USERENV('ENTRYID') USERENV('LANG') USERENV('INSTANCE') USERENV('TERMINAL')
---------------------------------------------------- ---------------- -------------------- ------------------ ---------------------------------------------------- ------------------- -------------------
SIMPLIFIED CHINESE_CHINA.ZHS16GBK FALSE 8745 0 ZHS 1 13906B3C2A
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
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
TERMINAL LANGUAGE SESSIONID INSTANCE ENTRYID ISDBA NLS_TERRITORY NLS_CURRENCY NLS_CALENDAR NLS_DATE_FORMAT NLS_DATE_LANGUAGE NLS_SORT CURRENT_USER CURRENT_USERID SESSION_USER SESSION_USERID PROXY_USER PROXY_USERID DB_DOMAIN DB_NAME HOST OS_USER EXTERNAL_NAME IP_ADDRESS NETWORK_PROTOCOL
-------------------------------------------------------------------------------- -------------------------------------------------------------------------------- -------------------------------------------------------------------------------- -------------------------------------------------------------------------------- -------------------------------------------------------------------------------- -------------------------------------------------------------------------------- -------------------------------------------------------------------------------- -------------------------------------------------------------------------------- -------------------------------------------------------------------------------- -------------------------------------------------------------------------------- -------------------------------------------------------------------------------- -------------------------------------------------------------------------------- -------------------------------------------------------------------------------- -------------------------------------------------------------------------------- -------------------------------------------------------------------------------- -------------------------------------------------------------------------------- -------------------------------------------------------------------------------- -------------------------------------------------------------------------------- -------------------------------------------------------------------------------- -------------------------------------------------------------------------------- -------------------------------------------------------------------------------- -------------------------------------------------------------------------------- -------------------------------------------------------------------------------- -------------------------------------------------------------------------------- --------------------------------------------------------
GDDG-13906B3C2A SIMPLIFIED CHINESE_CHINA.ZHS16GBK 8745 1 FALSE CHINA ¥ GREGORIAN DD-MON-RR SIMPLIFIED CHINESE BINARY IDMP 61 IDMP 61 idmp -13906B3C2A GDDG-13906B3C2A\g g -13906B3C2A\gddg 127.0.0.1 tcp
USERENV('LANGUAGE')
----------------------------------------------------
SIMPLIFIED CHINESE_CHINA.ZHS16GBK
SQL>
SQL> select * from nls_instance_parameters
2 ;
PARAMETER VALUE
------------------------------------------------------------ --------------------------------------------------------------------------------
NLS_LANGUAGE AMERICAN
NLS_TERRITORY AMERICA
NLS_SORT
NLS_DATE_LANGUAGE
NLS_DATE_FORMAT
NLS_CURRENCY
NLS_NUMERIC_CHARACTERS
NLS_ISO_CURRENCY
NLS_CALENDAR
NLS_TIME_FORMAT
NLS_TIMESTAMP_FORMAT
NLS_TIME_TZ_FORMAT
NLS_TIMESTAMP_TZ_FORMAT
NLS_DUAL_CURRENCY
NLS_COMP
NLS_LENGTH_SEMANTICS BYTE
NLS_NCHAR_CONV_EXCP FALSE
17 rows selected
SQL>
很久以前我就用过这个sql
参考
http://blog.tianya.cn/blogger/post_show.asp?BlogID=743282&PostID=8419121
|
作者:hzjwcx 提交日期:2007-2-1 14:19:00 |