代价最高的SQL
select OPTIMIZER_COST,EXECUTIONS,sql_text from v$sqlarea
where OPTIMIZER_COST>
(select max(OPTIMIZER_COST)/5 from v$sqlarea);

IO最高的SQL
select round(DISK_READS/EXECUTIONS) ,DISK_READS,EXECUTIONS,sql_text
from v$sqlarea 
where round(DISK_READS/EXECUTIONS)>
(select max(round((DISK_READS/EXECUTIONS)/5)) from v$sqlarea
where EXECUTIONS>0)
and EXECUTIONS>0 and DISK_READS>100
order by 1;


处理行最高的SQL
select round(ROWS_PROCESSED/EXECUTIONS) ,ROWS_PROCESSED,EXECUTIONS,sql_text
from v$sqlarea 
where round(ROWS_PROCESSED/EXECUTIONS)>
(select max(round((ROWS_PROCESSED/EXECUTIONS)/5)) from v$sqlarea
where EXECUTIONS>0)
and EXECUTIONS>0 and ROWS_PROCESSED>1000
order by 1;

Oracle 数据库找到单次消耗资源多的语句(DB)-LMLPHP

04-18 08:24