Oracle10g Wait Event Data Collection Procedure
Follow is Oracle Wait Event Data Collection Simple Procedure(Database is 10g):
create or replace procedure dc as
--------event comment
--59 library cache lock
--64 buffer busy waits
--115 db file sequential read
--116 db file scattered read
--289 latch free
--161 direct path read
--163 direct path write
--214 library cache pin
--215 library cache lock
cursor c1 is
select se.SID,se.SERIAL#,se.USERNAME,se.OSUSER,se.PADDR,se.LOGON_TIME,se.PROCESS,se.SQL_HASH_VALUE,se.SADDR,se.MODULE,se.ROW_WAIT_OBJ#,se.ROW_WAIT_FILE#,se.ROW_WAIT_BLOCK#,
se.ROW_WAIT_ROW#,se.SEQ#,se.EVENT#,se.EVENT,se.P1TEXT,se.P1,se.P1RAW,se.P2TEXT,se.P2,se.P2RAW,se.P3TEXT,se.P3,se.P3RAW,se.WAIT_TIME,se.SECONDS_IN_WAIT,se.STATE
from
v$session se where se.TYPE<>'BACKGROUND' and se.EVENT# in(115,116,289,161,163,214,215,64,59);
v1 c1%rowtype;
v_sqltext varchar2(4000);
v_id int;
begin
select max(id) into v_id from dc_tab1;
insert into dc_tab1 values (v_id+1,sysdate);
if c1%isopen then
close c1;
end if;
open c1;
loop
fetch c1 into v1;
exit when c1%notfound;
select sql_text into v_sqltext from v$sqltext where hash_value=v1.sql_hash_value;
insert into dc_tab
(SID,SERIAL#,USERNAME,OSUSER,PADDR,LOGON_TIME,PROCESS,SQL_HASH_VALUE,SADDR,MODULE,ROW_WAIT_OBJ#,ROW_WAIT_FILE#,ROW_WAIT_BLOCK#,ROW_WAIT_ROW#,
SEQ#,EVENT#,EVENT,P1TEXT,P1,P1RAW,P2TEXT,P2,P2RAW,P3TEXT,P3,P3RAW,WAIT_TIME,SECONDS_IN_WAIT,STATE,SQLTEXT)
values
(v1.SID,v1.SERIAL#,v1.USERNAME,v1.OSUSER,v1.PADDR,v1.LOGON_TIME,v1.PROCESS,v1.SQL_HASH_VALUE,v1.SADDR,v1.MODULE,v1.ROW_WAIT_OBJ#,v1.ROW_WAIT_FILE#,v1.ROW_WAIT_BLOCK#,
v1.ROW_WAIT_ROW#,v1.SEQ#,v1.EVENT#,v1.EVENT,v1.P1TEXT,v1.P1,v1.P1RAW,v1.P2TEXT,v1.P2,v1.P2RAW,v1.P3TEXT,v1.P3,v1.P3RAW,v1.WAIT_TIME,v1.SECONDS_IN_WAIT,v1.STATE,
v_sqltext);
end loop;
close c1;
commit;
end;
來自 “ ITPUB部落格 ” ,連結:http://blog.itpub.net/24237320/viewspace-1793996/,如需轉載,請註明出處,否則將追究法律責任。
相關文章
- 【蓋國強】Oracle Wait Event:Data file init writeOracleAI
- 【WAIT】wait eventAI
- enqueue wait event .ENQAI
- stored procedure 收集session wait 資訊SessionAI
- the procedure:delete the data of one tabledelete
- wait for stopper event to be increasedAI
- stored procedure 收集session wait 資訊(轉)SessionAI
- oracle wait event 等待事件OracleAI事件
- wait event ---asynch descriptor resizeAI
- wait event:gc buffer busyAIGC
- Oracle Wait Event - TuningOracleAI
- OWI --用 stored procedure 收集session wait 資訊SessionAI
- jQuery event.datajQuery
- Data Guard Wait EventsAI
- Wait event:read by other sessionAISession
- 等待事件 (wait event) [final]事件AI
- Wait Event "PX Deq: Execution Msg"AI
- 遭遇DFS LOCK HANDLE wait event,AI
- Subject: "class slave wait" is the top wait event on AWR snapshotAI
- 【DATAGUARD】Data Guard Wait EventsAI
- 12.2 wait event ‘PGA memory operation’AI
- Common Oracle Wait Event Descriptions(zt)OracleAI
- wait event監測效能瓶頸AI
- log buffer space wait event等待事件AI事件
- v session_wait v session_event v system_eventSessionAI
- v$session_event , v$system_event , v$session_waitSessionAI
- zt_關於wait events asynch descriptor resize_wait eventAI
- Wait Event Enhancements in Oracle 10g(zt)AIOracle 10g
- wait event_Additional Statistics_that do not have corresponding wait eventsAI
- oracle wait event之db file sequential readOracleAI
- oracle10g data block structureOracleBloCStruct
- Wait event (二) 摘自官檔 Oracle版權所有AIOracle
- V$SESSION.STATUS='ACTIVE' AND WAIT_EVENT='Idle'SessionAI
- [Data Guard]Oracle10g Data Guard學習筆記(一)Oracle筆記
- [Data Guard]Oracle10g Data Guard學習筆記(二)Oracle筆記
- [Data Guard]Oracle10g Data Guard學習筆記(三)Oracle筆記
- 幾個重要檢視(V$SYSTEM_EVENT V$SESSION_EVENT V$SESSION_WAIT)SessionAI
- 轉eygle大師_wait event_db file init writeAI