首页 > 代码库 > 查找bad sql的方法:

查找bad sql的方法:

 1  --查找bad sql的方法:  2  3   select * from (select buffer_gets, sql_text  4  5   from v$sqlarea  6  7   where buffer_gets >500000  8  9   order by buffer_gets desc) where rownum<=30; 10 11  -- 执行次数多的SQL 12 13   select sql_text,executions from 14 15   (select sql_text,executions from v$sqlarea order by executions desc) 16 17   where rownum<81; 18 19  -- 读硬盘多的SQL 20 21   select sql_text,disk_reads from 22 23   (select sql_text,disk_reads from v$sqlarea order by disk_reads desc) 24 25   where rownum<21; 26 27  -- 排序多的SQL 28 29   select sql_text,sorts from 30 31   (select sql_text,sorts from v$sqlarea order by sorts desc) 32 33   where rownum<21; 

同事写的,先放着