1、 userenv(option)
返回當前的會話資訊.
option='isdba'若當前是dba角色,則為true,否則false.
option='language'返回資料庫的字符集.
option='sessionid'為當前會話識別符號.
option='entryid'返回可審計的會話識別符號.
option='lang'返回會話語言名稱的iso簡記.
option='instance'返回當前的例項.
option='terminal'返回當前計算機名
select userenv('language') from dual;
2、sys_conteogmxgoqdaxt
複製** **如下:
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('us程式設計客棧erenv','proxy_user') proxy_user,
sys_context('userenv','proxy_userid') proxy_userid,
sys_context('userenv','db_domain') db_domain,
sys'userenv','db_name') db_nam
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.與系統檢視v$session組合使用可以獲得更多資訊(客戶端所使用的應用程式等)
複製** **如下:
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_contexogmxgoqdat('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;
本文標題: oracle中獲取會話資訊的兩個函式分享
本文位址:
Oracle中獲取使用者表資訊詳情
1.獲取當前使用者的使用者名稱 select username from user users 2.獲取某個使用者下的所有表名稱 select table name from all tables where owner 使用者名稱 注意大小寫3.獲取當前使用者下某張表的詳細資訊 select t....
獲取Oracle隱含引數資訊
oracle資料庫的初始化引數。主要 於兩個oracle內部資料字典表 x ksppcv和x ksppi通常我們查詢的v parameter檢視或使用show parameter命令都是就 於這兩個系統表的。但通過這兩種方式不能查詢隱含引數.x ksppcv用以記錄當前的設定的值,及是否使用了預設值...
獲取Oracle隱含引數資訊
oracle資料庫的初始化引數,主要 於兩個oracle內部資料字典表 x ksppcv和x ksppi通常我們查詢的v parameter檢視或使用show parameter命令都是就 於這兩個系統表的,但通過這兩種方式不能查詢隱含引數.x ksppcv用以記錄當前的設定的值,及是否使用了預設值...