Oracle中查看游标和缓存

1、Oracle查看当前打开的游标数目

  1. SQL> select count(*) from v$open_cursor;  
  2. COUNT(*)  
  3. 17494  

2、修改Oracle最大游标数

  1. SQL> alter system set open_cursors=1000 scope=both

系统已更改。

  1. SQL> show parameter open_cursors;  
  2. NAME TYPE VALUE  
  3. open_cursors integer 1000   
 

系统运行了一段时间报错:java.sql.SQLException: ORA-01000: 超出打开游标的最大数

查看数据库当前的游标数配置slqplus:show parameter open_cursors;

查看游标使用情况:

select o.sid, osuser, machine, count(*) num_curs
from v$open_cursor o, v$session s
where user_name = 'user ' and o.sid=s.sid
group by o.sid, osuser, machine
order by  num_curs desc;

查看游标执行的sql情况:

select q.sql_text
from v$open_cursor o, v$sql q
where q.hashvalue=o.hash_value and o.sid = 123;

如果程序释放资源没有问题,则加大游标数。

 

select block_size, size_for_estimate, size_factor, estd_physical_read_factor, estd_physical_reads from v$db_cache_advice;


解 释一下v$db_cache_advice的作用,Oracle利用这个视图对当前数据库db_cache_size大小提出一建议,提出了20个 db_cache_size大小及相关的物理读的估计值,估计的db_cache_size大小的范围从当前的10%到200%,以10%为一个增加单 位。 
下面解释几个列的含义 
size_for_estimate:估计的cache size大小 
size_factor:   估计的cache size大小与当前大小的比值 
estd_physical_reads:在估计的cache size大小情况下,会产生的物理读数量 
estd_physical_read_factor:估计的物理读数量与当前物理读数量的比值。

猜你喜欢

转载自awen7916.iteye.com/blog/2230547