如何更新ORA-01000的游标限制:最大打开游标超过

yel*_*von 10 oracle11g

我从以下查询中发现每个数据库的最大游标数为300:

select max(a.value) as highest_open_cur, p.value as max_open_cur
  from v$sesstat a, v$statname b, v$parameter p
  where a.statistic# = b.statistic# 
  and b.name = 'opened cursors current'
  and p.name= 'open_cursors'
  group by p.value;
Run Code Online (Sandbox Code Playgroud)

我尝试将金额更新为1000:

  update v_$parameter
  set value = 1000
  where name = 'open_cursors';
Run Code Online (Sandbox Code Playgroud)

但我看到这个错误:

SQL Error: ORA-02030: can only select from fixed tables/views
02030. 00000 -  "can only select from fixed tables/views"
*Cause:    An attempt is being made to perform an operation other than
           a retrieval from a fixed table/view.
*Action:   You may only select rows from fixed tables/views.
Run Code Online (Sandbox Code Playgroud)

更新open_cursor值的正确方法是什么?谢谢.

Jus*_*ave 15

假设您正在使用spfile来启动数据库

alter system set open_cursors = 1000 scope=both;
Run Code Online (Sandbox Code Playgroud)

如果您使用的是pfile,则可以更改正在运行的实例的设置

alter system set open_cursors = 1000 
Run Code Online (Sandbox Code Playgroud)

然后,您还需要编辑参数文件以指定新open_cursors设置.此后不久重新启动数据库通常是一个好主意,以确保参数文件更改按预期工作(在下次重新启动数据库时发现一些参数文件发生变化而不是没有人记得是非常烦人的做得不好.

我也希望你确定每个会话实际上需要超过300个开放游标.很大一部分时间,正在调整此设置的人实际上有一个游标泄漏,他们只是试图克服错误而不是解决根本原因.