关于“ORA-01000:maximum open cursors exceeded”的解决方案
问题分析:
-
1.游标open后,出错了又没有close。
-
2.可能是表结构的问题。
解决方法:
- 1.查看数据库当前的游标数配置:
show parameter open_cursors;
- 2.查看游标使用情况:
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;
此处的user_name=’user’中,user代表占用数据库资源的数据库用户名。
- 3.查看游标执行的sql情况:
select o.sid q.sql_text
from v$open_cursor o, v$sql q
where q.hash_value=o.hash_value and o.sid = 123;
此处的o.sid = 123是步骤2中的结果集
- 4.根据游标占用情况分析访问数据库的程序在资源释放上是否正常,如果程序释放资源没有问题,则加大游标数。
alter system set open_cursors=2000 scope=both;