如何在Oracle中查找当前打开的游标
用于查找 Oracle 实例中当前打开的游标数量的查询是什么?
另外,该数据的准确性/更新频率是多少?
我使用的是Oracle 10gR2
What is the query to find the number of current open cursors in an Oracle Instance?
Also, what is the accuracy/update frequency of this data?
I am using Oracle 10gR2
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(8)
按会话打开的游标总数:
来源:http://www.orafaq.com/node/758
据我所知,对 v$ 视图的查询基于直接指向 SGA 相关部分的伪表(“x$”表),因此您无法获得比这更准确的信息; 然而,这也意味着它是时间点的(即脏读)。
Total cursors open, by session:
Source: http://www.orafaq.com/node/758
As far as I know queries on v$ views are based on pseudo-tables ("x$" tables) that point directly to the relevant portions of the SGA, so you can't get more accurate than that; however this also means that it is point-in-time (i.e. dirty read).
似乎对我有用。
appears to work for me.
以下是如何查找已解析的打开游标。 您需要以有权访问 v$open_cursor 和 v$session 的用户身份登录。
如果为您提供了部分 SQL 文本,因此它对于识别存在泄漏的应用程序很有用。 如果游标尚未被解析,则它不会出现在此处。 请注意,Oralce 有时会比您保持打开状态的时间更长。
Here's how to find open cursors that have been parsed. You need to be logged in as a user with access to v$open_cursor and v$session.
If gives you part of the SQL text so it can be useful for identifying leaky applications. If a cursor has not been parsed, then it does not appear here. Note that Oralce will sometimes keep things open longer than you do.
1)你的id应该有sys dba访问权限
2)
1)your id should have sys dba access
2)
Oracle 有一个针对此问题的页面,其中包含 SQL 和故障排除建议。
“解决打开光标问题”
http://docs.oracle.com/cd/E40329_01 /admin.1112/e27149/cursor.htm#OMADM5352
Oracle has a page for this issue with SQL and trouble shooting suggestions.
"Troubleshooting Open Cursor Issues"
http://docs.oracle.com/cd/E40329_01/admin.1112/e27149/cursor.htm#OMADM5352
我将使用这个快速 SQL 来比较当前的最高使用量与允许的最大值。 这将使您能够立即查看是否有任何进程对游标的使用率达到了危险的程度。
从上面的 SQL 中可以清楚地看出,OPEN_CURSORS 值是一个 Oracle 参数,可以在运行时找到,如下所示。
您可能需要具有 sysdba 或同等权限才能查询上表。
I would use this quick SQL to compare the highest current use compared to the max allowed. This will allow you to immediately see if any process has a dangerously high use of cursors.
As is probably clear from the above SQL, the OPEN_CURSORS value is an Oracle parameter and can be found at runtime like this.
You may need to be sysdba or equivalent to query the above tables.
我用这样的东西:
I use something like this:
这可以工作:
This could work: