1.查看消耗资源最多的 SQL:
select hash_value, executions, buffer_gets, disk_reads, parse_calls
from v$sqlarea
where buffer_gets > 10000000 or disk_reads > 1000000
order by buffer_gets + 100 * disk_reads desc ;
2. 查看某条 SQL 语句的资源消耗:
select hash_value, buffer_gets, disk_reads, executions, parse_calls
from v$sqlarea
where hash_value = 27762888 and address = hextoraw('cbndcdo6j');
3.查找前10条性能差的sql语句
select * from
(select parsing_user_id,executions,sorts,command_type,disk_reads,sql_text from v$sqlarea order by disk_reads desc )
where rownum<10 ;
说明:
EXECUTIONS表示同一条SQL语句一共执行了多少次,SORTS表示排序的次数,DISK_READS表示物理读的数量。