Oracle中獲取會(huì)話信息的兩個(gè)函數(shù)分享
來(lái)源:易賢網(wǎng) 閱讀:936 次 日期:2014-12-30 15:54:49
溫馨提示:易賢網(wǎng)小編為您整理了“Oracle中獲取會(huì)話信息的兩個(gè)函數(shù)分享”,方便廣大網(wǎng)友查閱!

1、 USERENV(OPTION)

返回當(dāng)前的會(huì)話信息.

OPTION='ISDBA'若當(dāng)前是DBA角色,則為TRUE,否則FALSE.

OPTION='LANGUAGE'返回?cái)?shù)據(jù)庫(kù)的字符集.

OPTION='SESSIONID'為當(dāng)前會(huì)話標(biāo)識(shí)符.

OPTION='ENTRYID'返回可審計(jì)的會(huì)話標(biāo)識(shí)符.

OPTION='LANG'返回會(huì)話語(yǔ)言名稱的ISO簡(jiǎn)記.

OPTION='INSTANCE'返回當(dāng)前的實(shí)例.

OPTION='terminal'返回當(dāng)前計(jì)算機(jī)名

SELECT USERENV('LANGUAGE') FROM DUAL;

2、sys_context

復(fù)制代碼 代碼如下:

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.與系統(tǒng)視圖v$session組合使用可以獲得更多信息(客戶端所使用的應(yīng)用程序等)

復(fù)制代碼 代碼如下:

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;

更多信息請(qǐng)查看IT技術(shù)專欄

更多信息請(qǐng)查看數(shù)據(jù)庫(kù)
易賢網(wǎng)手機(jī)網(wǎng)站地址:Oracle中獲取會(huì)話信息的兩個(gè)函數(shù)分享
由于各方面情況的不斷調(diào)整與變化,易賢網(wǎng)提供的所有考試信息和咨詢回復(fù)僅供參考,敬請(qǐng)考生以權(quán)威部門公布的正式信息和咨詢?yōu)闇?zhǔn)!

2025國(guó)考·省考課程試聽(tīng)報(bào)名

  • 報(bào)班類型
  • 姓名
  • 手機(jī)號(hào)
  • 驗(yàn)證碼
關(guān)于我們 | 聯(lián)系我們 | 人才招聘 | 網(wǎng)站聲明 | 網(wǎng)站幫助 | 非正式的簡(jiǎn)要咨詢 | 簡(jiǎn)要咨詢須知 | 加入群交流 | 手機(jī)站點(diǎn) | 投訴建議
工業(yè)和信息化部備案號(hào):滇ICP備2023014141號(hào)-1 云南省教育廳備案號(hào):云教ICP備0901021 滇公網(wǎng)安備53010202001879號(hào) 人力資源服務(wù)許可證:(云)人服證字(2023)第0102001523號(hào)
云南網(wǎng)警備案專用圖標(biāo)
聯(lián)系電話:0871-65099533/13759567129 獲取招聘考試信息及咨詢關(guān)注公眾號(hào):hfpxwx
咨詢QQ:526150442(9:00—18:00)版權(quán)所有:易賢網(wǎng)
云南網(wǎng)警報(bào)警專用圖標(biāo)