在没有做调整的情况下,在绝大多数的系统中,访问量占前25 位的语句的内存读操作将占用整个系
统所有的内存读操作的75%。下面的代码展示了对这些语句的评测,并解释了如何找到这25 个最占用内存
的语句。
查询获得25 个最占用内存的语句
set serverout on size 1000000
declare
top25 number;
text1 varchar2(4000);
x number;
len1 number;
cursor c1 is
select buffer_gets, substr(sql_text,1,4000)
from v$sqlarea
order by buffer_gets desc;
begin
dbms_output.put_line('Gets'||' '||'Text');
dbms_output.put_line('----------'||' '||'----------------------');
339
open c1;
for i in 1..25 loop
fetch c1 into top25, text1;
dbms_output.put_line(rpad(to_char(top25),9)||' '||substr(text1,1,66));
len1:=length(text1);
x:=66;
while len1 > x-1 loop
dbms_output.put_line('" '||substr(text1,x,66));
x:=x+66;
end loop;
end loop;
end;
/
来自 “ ITPUB博客 ” ,链接:https://blog.itpub.net/25198367/viewspace-707724/
,如需转载,请注明出处,否则将追究法律责任。