关于ORA-01000: maximum open cursors exceeded 在Websphere里

网上有很多,这边备忘一下。

ORA-01000
这个参数决定一个SESSION的最大打开CURSOR的个数.
可能是异常中断而没有CLOSE,或程序写嘚有问题,或者确实有这么多的CUSOR同时在应用.
 
首先查DB的参数,
       select value
     from v$parameter
     where name = 'open_cursors'
    建议大应用至少1000 .
 
然后,查
           select o.sid, osuser, machine, count(*) num_curs
     from v$open_cursor o, v$session s
     where user_name = 'username' and o.sid=s.sid
     group by o.sid, osuser, machine
     order by num_curs desc;
 
里面肯定有接近 'open_cursors' 的 session , 得到SID.
最后,查看是这些'open_cursors' 都是哪些SQL.
           select q.sql_text
     from v$open_cursor o, v$sql q
     where q.hash_value=o.hash_value and o.sid = XXXXX;
 
现在应该可以定位到那个页面或MODULE导致这个的问题.

Websphere里有个参数Statement cache size ,也是用来缓存的。
看是否大与Oracle的设置。
  • In WebSphere Application Server V5, navigate to the data source in the Admin Console. The Statement cache size appears on the main data source configuration panel.
  • In WebSphere Application Server V6, navigate to the data source in the Admin Console. Under Additional Properties, select WebSphere Application Server data source properties. The first property listed on the resulting screen is the Statement cache size.
另一个也可以设置 cursor_sharing = force , 不过这个要看具体环境了。

程序问题,比如:
Java代码在执行conn.createStatement()和conn.prepareStatement()的时候,实际上都是相当与在数据库中 打开了一个cursor。尤其是,如果你的createStatement和prepareStatement是在一个循环里面的话,就会非常容易出现这 个问题。因为游标一直在不停的打开,而且没有关闭。
 
还看到ITPUB上一例是存储空间的问题, 关键还是找到是哪些SQL OPEN 了CURSOR,然后对症下药。
 
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值