码迷,mamicode.com
首页 > 数据库 > 详细

查看Oracle耗时Sql

时间:2017-03-27 15:36:55      阅读:289      评论:0      收藏:0      [点我收藏+]

标签:sql语句   语句   .sql   rank   reads   where   --   rom   desc   

--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;

查看Oracle耗时Sql

标签:sql语句   语句   .sql   rank   reads   where   --   rom   desc   

原文地址:http://www.cnblogs.com/pipi-582/p/6626836.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!