查看数据库中的连接,会话中SQL等信息
查看数据库连接主机名,程序名,用户名等情况
select b.MACHINE, b.PROGRAM, b.USERNAME, count() from v process a, vprocessa,vsession b where a.ADDR = b.PADDR and b.USERNAME is not null group by b.MACHINE, b.PROGRAM, b.USERNAME order by count() desc
col FILE_ID forma 999
col TABLESPACE_NAME format a20
col FILE_NAME format a100
set linesize 150
select owner,sum(bytes)/1024/1024 Mbytes from dba_segments where owner='SSS';
select a.sid,
a.serial#,
a.paddr,
a.machine,
nvl(a.sql_id, a.prev_sql_id) sql_id,
b.sql_text,
b.sql_fulltext,
b.executions,
b.first_load_time,
b.last_load_time,
b.last_active_time,
b.disk_reads,
b.direct_writes,
b.buffer_gets
from v$session a, v$sql b
where a.username = sys_context('USERENV', 'CURRENT_USER')
and a.status = 'ACTIVE'
and nvl(a.sql_id, a.prev_sql_id) = b.sql_id;
--查正在执行的SQL
SELECT b.sid oracleID,b.username Oracle,b.serial#,spid,paddr,sql_text ,b.machine FROM v$process a, v$session b, v$sqlarea c WHERE a.addr = b.paddr AND b.sql_hash_value = c.hash_value;