【Vegas原创】Oracle DB 截获造成CPU占用率很高的SQL(Windows)
1,查出拖延时间很长的session
select sid, /*Session ID */
opname, /*操作内容*/
sofar/totalwork*100 /*完成百分比*/
elapsed_seconds, /*已经执行的时间*/
time_remaining /*预计剩余时间按*/
from v$session_longops
order by time_remaining desc;
opname, /*操作内容*/
sofar/totalwork*100 /*完成百分比*/
elapsed_seconds, /*已经执行的时间*/
time_remaining /*预计剩余时间按*/
from v$session_longops
order by time_remaining desc;
2,用OEM查出SID对应的系统ID
3,截获对应系统ID的session的SQL
select a.sid,a.program,a.terminal,c.sql_text
from v$session a, v$process b, v$sqltext c
where a.sql_hash_value=c.hash_value
and a.paddr=b.addr
and b.spid='3844' --PID
order by c.piece;
from v$session a, v$process b, v$sqltext c
where a.sql_hash_value=c.hash_value
and a.paddr=b.addr
and b.spid='3844' --PID
order by c.piece;
喜欢请赞赏一下啦^_^