打不死的心态活到老。
获取oracle前10条最耗资源的sql语句
上一篇 /
下一篇 2008-11-13 16:50:40
/ 个人分类:数据库
--set serveroutput on size 1000000;
51Testing软件测试网BS1WU%X5b-|Vdeclare
,W7Z y6@f8j _0 execution number;
51Testing软件测试网rKc,F/l(T top25 number;
51Testing软件测试网X{Q$fy6B%] rMu text1 varchar2(4000);
b7]
Jgf[&c6uC0 x number;
@bD&\x'L$o0 len1 number;
$w-t%i|7G'MX$b0 cursor c1 is
Ts:r uj}0q x0 select executions, disk_reads, substr(sql_text, 1, 4000)
51Testing软件测试网ZV M[Q0Q from v$sqlarea
$QEPV[7f0 order by disk_reads desc;
51Testing软件测试网XCE#H?S9Sbegin
51Testing软件测试网.y/k~0N9Y8qV!`)Ar dbms_output.put_line('Exec' || ' ' || 'Reads' || ' ' || 'Text');
4S|7F |1l+x0{0 dbms_output.put_line('-----' || ' ' || '--------' || ' ' ||
51Testing软件测试网OB0d0Z8Ux,^_+{3K7K '-------------');
51Testing软件测试网z%g2N+q`4Mj-z3` open c1;
51Testing软件测试网qV6R,|(M%|%R for i in 1 .. 10 loop
'uc8^ }Y1r||0 fetch c1
51Testing软件测试网&AJCLR@~ into execution, top25, text1;
]u6a:_:o0|G6v0 dbms_output.put_line(rpad(to_char(execution), 5) || ' ' ||
b*L7tBW*BP6t0 rpad(to_char(top25), 8) || ' ' ||
51Testing软件测试网$d@f2@rq substr(text1, 1, 66));
)m2cEo7v.s0 len1 := length(text1);
51Testing软件测试网~/{ `6D5m\ml
I x := 66;
51Testing软件测试网/gt+O9p;R while len1 > x - 1 loop
d(|t8ra![R}.G0 dbms_output.put_line('- ' || substr(text1, x, 66));
51Testing软件测试网V:{A4XE5ot?~ x := x + 66;
|0}*v5f!Z
}f.j Ak*p0 end loop;
51Testing软件测试网9W:s4L s2[\s end loop;
zr&c9~yj3n'l1JK[2T%B
w0end;
Z:sdi%Ta.W2n0/
相关阅读:
- SQL中的N (chenjie021, 2008-11-07)
- SQL中的聚集索引和非聚集索引的区别 (chenjie021, 2008-11-07)
- SQL提高速度注意事项 (chenjie021, 2008-11-10)
- SQL 中having (chenjie021, 2008-11-10)
- 三种调优查询的主要的方法 (chenjie021, 2008-11-10)
- INDEXPROPERTY 索引的度查询 (chenjie021, 2008-11-11)
- 清除数据库缓存的语句 (chenjie021, 2008-11-11)
- 建索引要考虑的问题 (chenjie021, 2008-11-11)
- 优化总结 (chenjie021, 2008-11-12)
- Oracle DBA优化数据库性能心得体会 (caption, 2008-11-13)
收藏
举报
TAG:
数据库