--查看最耗费物理读的SQL:
select 'alter system kill session ''' || s.SID || ',' || s.SERIAL# || ''';',
v.DISK_READS,
v.BUFFER_GETS,
v.CPU_TIME,
v.EXECUTIONS,
trunc(case
when v.EXECUTIONS = 0 then
v.DISK_READS
else
v.DISK_READS / v.EXECUTIONS
end) as pers,
--v.SQL_TEXT,
to_char(substr(v.SQL_FULLTEXT, 1, 3500)) as SQL_FULLTEXT,
--s.SID,
--s.SERIAL#,
s.MACHINE,
s.MODULE,
s.STATUS,
s.EVENT
from V$SQLAREA v, v$session s
where s.SQL_ID = v.SQL_ID
order by pers desc;
--查看最耗费逻辑读的SQL:
select 'alter system kill session ''' || s.SID || ',' || s.SERIAL# || ''';',
v.DISK_READS,
v.BUFFER_GETS,
v.CPU_TIME,
v.EXECUTIONS,
trunc(case
when v.EXECUTIONS = 0 then
v.BUFFER_GETS
else
v.BUFFER_GETS / v.EXECUTIONS
end) as pers,
--v.SQL_TEXT,
to_char(substr(v.SQL_FULLTEXT, 1, 3500)) as SQL_FULLTEXT,
--s.SID,
--s.SERIAL#,
s.MACHINE,
s.STATUS,
s.MODULE,
s.EVENT
from V$SQLAREA v, v$session s
where s.SQL_ID = v.SQL_ID
order by pers desc;
--查看最耗费CPU时间的SQL:
select 'alter system kill session ''' || s.SID || ',' || s.SERIAL# || ''';',
v.DISK_READS,
v.BUFFER_GETS,
v.CPU_TIME,
v.EXECUTIONS,
trunc(case
when v.EXECUTIONS = 0 then
v.CPU_TIME
else
v.CPU_TIME / v.EXECUTIONS
end) as pers,
--v.SQL_TEXT,
to_char(substr(v.SQL_FULLTEXT, 1, 3500)) as SQL_FULLTEXT,
--s.SID,
--s.SERIAL#,
s.MACHINE,
s.STATUS,
s.MODULE,
s.EVENT
from V$SQLAREA v, v$session s
where s.SQL_ID = v.SQL_ID
order by pers desc;