oracle ,top sql查询

前端之家收集整理的这篇文章主要介绍了oracle ,top sql查询前端之家小编觉得挺不错的,现在分享给大家,也给大家做个参考。

--1、查看耗时sql
select *
from (select v.sql_id,
v.child_number,
v.sql_text,
v.elapsed_time,
v.cpu_time,
v.disk_reads,
rank() over(order by v.elapsed_time desc) elapsed_rank
from v$sql v) a
where elapsed_rank <= 10;
-- 2.查看cpu消耗时间最多的前10条sql语句
select *
from (select v.sql_id,
rank() over(order by v.cpu_time desc) elapsed_rank
from v$sql v) a
where elapsed_rank <= 10;

--3.查看消耗磁盘读取最多的前10条sql语句 select * from (select v.sql_id,v.child_number,v.sql_text,v.elapsed_time,v.cpu_time,v.disk_reads,rank() over(order by v.disk_reads desc) elapsed_rank from v$sql v) a where elapsed_rank <= 10;

原文链接:https://www.f2er.com/oracle/208564.html

猜你在找的Oracle相关文章