Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
6 changed files
with
146 additions
and
5 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,29 @@ | ||
prompt; | ||
prompt &_C_RED *** v$session_event by sid &_C_RESET; | ||
prompt * Usage @events/sess_event SID | ||
prompt; | ||
col wait_class for a30; | ||
col event for a64; | ||
col TIME_WAITED_MICRO for 999G999G999999; | ||
col sum_class noprint; | ||
break on sid on wait_class skip page; | ||
select | ||
se.sid | ||
,se.wait_class | ||
,se.event | ||
,se.TOTAL_WAITS | ||
,se.TOTAL_TIMEOUTS | ||
,se.TIME_WAITED | ||
,se.TIME_WAITED_MICRO | ||
,se.AVERAGE_WAIT | ||
,se.MAX_WAIT | ||
,sum(TIME_WAITED_MICRO) over(partition by wait_class) sum_class | ||
from v$session_event se | ||
where sid=&1 | ||
order by WAIT_CLASS_ID, TIME_WAITED_MICRO | ||
/ | ||
col wait_class clear; | ||
col event clear; | ||
col TIME_WAITED_MICRO clear; | ||
col sum_class clear; | ||
clear break |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,86 @@ | ||
prompt &_C_RED *** Snapper for event histograms &_C_RESET; | ||
prompt * Usage: @events/snap_histograms event_mask [period] | ||
|
||
var cur refcursor; | ||
|
||
declare | ||
l_event_mask varchar2(128):=q'[&1]'; | ||
l_period int:=case &2+0 when 0 then 1 else &2+0 end; | ||
x_start xmltype; | ||
x_end xmltype; | ||
|
||
cursor c_ev_histgrm(v_input varchar2) is | ||
select | ||
XMLELEMENT("ROWSET", | ||
xmlagg( | ||
xmlelement( | ||
"ROW" | ||
,xmlelement(EVENT_ID , e.event# ) | ||
,xmlelement(EVENT , e.event ) | ||
,xmlelement(WAIT_TIME_MILLI , e.wait_time_milli ) | ||
,xmlelement(WAIT_COUNT , e.wait_count ) | ||
,xmlelement(LAST_UPDATE_TIME, e.last_update_time) | ||
) | ||
) | ||
) x | ||
from v$event_histogram e | ||
where e.EVENT like v_input||'%' | ||
; | ||
|
||
function f_get_histgrm( p_param in varchar2 ) | ||
return xmltype | ||
is | ||
res xmltype; | ||
begin | ||
open c_ev_histgrm(p_param); | ||
fetch c_ev_histgrm into res; | ||
close c_ev_histgrm; | ||
return res; | ||
end; | ||
|
||
begin | ||
x_start:=f_get_histgrm(l_event_mask); | ||
dbms_lock.sleep(l_period); | ||
x_end :=f_get_histgrm(l_event_mask); | ||
open :cur for | ||
with | ||
v1 as (select/*+ no_xml_query_rewrite */ * | ||
from xmltable( | ||
'/ROWSET/ROW' | ||
passing x_start | ||
columns | ||
EVENT_ID number path 'EVENT_ID' | ||
,EVENT varchar2(64) path 'EVENT' | ||
,WAIT_TIME_MILLI number path 'WAIT_TIME_MILLI' | ||
,WAIT_COUNT number path 'WAIT_COUNT' | ||
,LAST_UPDATE_TIME varchar2(30) path 'LAST_UPDATE_TIME' | ||
) | ||
) | ||
,v2 as (select/*+ no_xml_query_rewrite */ * | ||
from xmltable( | ||
'/ROWSET/ROW' | ||
passing x_end | ||
columns | ||
EVENT_ID number path 'EVENT_ID' | ||
,EVENT varchar2(64) path 'EVENT' | ||
,WAIT_TIME_MILLI number path 'WAIT_TIME_MILLI' | ||
,WAIT_COUNT number path 'WAIT_COUNT' | ||
,LAST_UPDATE_TIME varchar2(30) path 'LAST_UPDATE_TIME' | ||
) | ||
) | ||
select | ||
nvl(v2.EVENT_ID , v1.EVENT_ID ) EVENT_ID | ||
,nvl(v2.EVENT , v1.EVENT ) EVENT | ||
,nvl(v2.WAIT_TIME_MILLI , v1.WAIT_TIME_MILLI) WAIT_TIME_MILLI | ||
,nvl(v2.WAIT_COUNT,0)-nvl(v1.WAIT_COUNT,0) WAIT_COUNT | ||
,nvl(v2.LAST_UPDATE_TIME, v1.LAST_UPDATE_TIME) LAST_UPDATE_TIME | ||
from v1 | ||
full join v2 on (v1.event_id=v2.event_id and v1.event=v2.event and v1.wait_time_milli=v2.wait_time_milli) | ||
order by 1,2,3; | ||
end; | ||
/ | ||
col event for a64; | ||
col last_update_time for a35; | ||
print cur; | ||
col event clear; | ||
col last_update_time clear; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
col name format a40 | ||
col value format a12 | ||
col deflt format a12 | ||
col type format a12 | ||
col description format a60 | ||
|
||
select | ||
a.ksppinm name | ||
,b.ksppstvl value | ||
,b.ksppstdf deflt | ||
,decode | ||
(a.ksppity | ||
,1,'boolean' | ||
,2,'string' | ||
,3,'number' | ||
,4,'file' | ||
,a.ksppity) type | ||
,a.ksppdesc description | ||
from | ||
sys.x$ksppi a | ||
,sys.x$ksppcv b | ||
where | ||
a.indx = b.indx | ||
and b.ksppstvl like '%&1%' escape '\' | ||
order by name | ||
/ |