有时想查会话的一些状态,或者实例的整体情况,ash的视图比较方便
实例近期等待事件(入门级)
-
-
col event for a40
-
select
-
h.event,
-
sum(h.wait_time h.time_waited) "total wait time"
-
from
-
v$active_session_history h
-
where
-
h.sample_time between sysdate - 1/24 and sysdate
-
and wait_class <> 'idle'
-
group by event
-
having sum(h.wait_time h.time_waited)>100
-
order by 2 desc;
-
会话的历史等待信息
-
-
set lines 120 trimspool on
-
col event head "waited for" format a30
-
col total_waits head "total|waits" format 999,999
-
col tw_ms head "waited|for (ms)" format 999,999.99
-
col aw_ms head "average|wait (ms)" format 999,999.99
-
col mw_ms head "max|wait (ms)" format 999,999.99
-
select event, total_waits, time_waited*10 tw_ms,
-
average_wait*10 aw_ms, max_wait*10 mw_ms
-
from v$session_event
-
where sid = &session_id;
-
会话所有的统计信息
-
-
col name for a55
-
select name, value
-
from v$sesstat s, v$statname n
-
where sid = &1
-
and n.statistic# = s.statistic#
-
and value>0
-
order by value desc;
-
99
sql对应的绑定变量
-
set pause on
-
set pause 'press return to continue'
-
set pagesize 60
-
set linesize 300
-
column sql_text format a120
-
column sql_id format a13
-
column bind_name format a10
-
column bind_value format a26
-
select
-
sql_id,
-
t.sql_text sql_text,
-
b.name bind_name,
-
b.value_string bind_value
-
from
-
v$sql t
-
join
-
v$sql_bind_capture b using (sql_id)
-
where
-
b.value_string is not null
-
and
-
sql_id='&sqlid';
未完。。。
阅读(1001) | 评论(0) | 转发(0) |