1. 首页
  2. IT资讯

owI 事件的收集

1。首先建立表

create table wait1 as
SELECT a.SID, a.seq#, a.event, a.p1text, a.p1, a.p1raw, a.p2text, a.p2,
a.p2raw, a.p3text, a.p3, a.p3raw, a.wait_time, a.seconds_in_wait,
a.state, b.serial#, b.username, b.osuser, b.paddr, b.logon_time,
b.process, b.sql_hash_value, b.saddr, b.module, b.row_wait_obj#,
b.row_wait_file#, b.row_wait_block#, b.row_wait_row#
FROM v$session_wait a, v$session b
WHERE a.SID = b.SID
AND b.username IS NOT NULL
AND b.TYPE <> ‘BACKGROUND’
AND a.event IN
(‘db file sequential read’,
‘db file scattered read’,
‘latch free’,
‘direct path read’,
‘direct path write’,
‘enqueue’,
‘library cache pin’,
‘library cache load lock’,
‘buffer busy waits’,
‘free buffer waits’
);

2。建立这个脚本,适当修改收集间隔以及次数,这种缺点就是可能会遗漏,不过大部分应该的问题应该收集到,可能对性能有影响,特别是已经很慢的时候。

begin
dbms_lock.sleep(1);
for i in 1 .. 30000
loop
INSERT INTO wait1
SELECT a.SID, a.seq#, a.event, a.p1text, a.p1, a.p1raw, a.p2text, a.p2, a.p2raw, a.p3text, a.p3,
a.p3raw, a.wait_time, a.seconds_in_wait, a.state, b.serial#, b.username, b.osuser, b.paddr,
b.logon_time, b.process, b.sql_hash_value, b.saddr, b.module, b.row_wait_obj#, b.row_wait_file#,
b.row_wait_block#, b.row_wait_row#
FROM v$session_wait a, v$session b
WHERE a.SID = b.SID
AND b.username IS NOT NULL
AND b.TYPE <> ‘BACKGROUND’
AND a.event
IN
(‘db file sequential read’,
‘db file scattered read’,
‘latch free’,
‘direct path read’,
‘direct path write’,
‘enqueue’,
‘library cache pin’,
‘library cache load lock’,
‘buffer busy waits’,
‘free buffer waits’
);
commit ;
dbms_lock.sleep(3);
end loop;
end;
/

来自 “ ITPUB博客 ” ,链接:http://blog.itpub.net/267265/viewspace-82823/,如需转载,请注明出处,否则将追究法律责任。

主题测试文章,只做测试使用。发布者:深沉的少年,转转请注明出处:http://www.cxybcw.com/182922.html

联系我们

13687733322

在线咨询:点击这里给我发消息

邮件:1877088071@qq.com

工作时间:周一至周五,9:30-18:30,节假日休息

QR code