查看Oracle耗时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,
v.child\_number,
v.sql\_text,
v.elapsed\_time,
v.cpu\_time,
v.disk\_reads,
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;