简体   繁体   English

Jasper报告导致SELECT语句出现CURSOR问题

[英]Jasper reports causing CURSOR issues with SELECT statements

We are using Jasper reports with java for one of our reporting application and use 'SELECT' queries to fetch data and generate reports using Jasper reporting templates. 我们将Jasper报表与Java一起用于我们的报表应用程序之一,并使用“ SELECT”查询来获取数据并使用Jasper报表模板生成报表。 They are a bunch of old queries, some are not tuned, their performance depends on the parameters they take. 它们是一堆旧查询,有些没有调优,其性能取决于所采用的参数。 Ex-date ranges, categories, etc. 过期日期范围,类别等

Lately, we have been experiencing weird cursor issues, the count of cursors the app is holding is going high, up to 900 at times, this is causing some serious space issues. 最近,我们遇到了奇怪的游标问题,该应用程序持有的游标数量一直很高,有时多达900个,这导致了一些严重的空间问题。 We are manually closing them to temporarily overcome this issue. 我们正在手动关闭它们以暂时解决此问题。 However, the issue is coming back again and again and has been a serious concern. 但是,问题又一次又一次地引起了人们的严重关注。

My understanding of the 'SELECT' statements is that they will implicitly use the CURSOR methodology, but make sure that once the operations are complete, they are closed. 我对“ SELECT”语句的理解是,它们将隐式使用CURSOR方法,但是请确保一旦操作完成就将其关闭。 And we don't have much control from the application side. 而且我们在应用程序方面没有太多控制权。

Debugging / Troubleshooting the issue: 对问题进行调试/故障排除:

  • Database used - Oracle, Jasper - jasperreports-3.7.0, ODBC driver - ojdbc14 使用的数据库-Oracle,Jasper-jasperreports-3.7.0,ODBC驱动程序-ojdbc14
  • We ran the query though DBA and see no issues, again it's just a regular SELECT query and we are not explicitly creating any cursor. 我们通过DBA运行查询,没有发现任何问题,同样,它只是常规的SELECT查询,我们没有显式创建任何游标。

  • Changed the DB calls to a read-only state, didn't work. 将数据库调用更改为只读状态,不起作用。

  • Looks like Jasper server uses regular JDBC prepared statements - ODBC driver - ojdbc14. 看起来Jasper服务器使用常规的JDBC预准备语句-ODBC驱动程序-ojdbc14。

  • No pagination used. 不使用分页。

Question : 问题

We are out of leads on this issue, if someone can help us with this it would be great. 我们在这个问题上没有领先优势,如果有人可以帮助我们,那就太好了。

Edit 编辑

SID =4385 has the following sql with count of open cursor SID = 4385具有以下带有打开游标计数的sql

SQL_ID COUNT(*) SQL_ID COUNT(*)


  • djuwsn5numsqv 2 djuwsn5numsqv 2
  • fw5920rbrun82 131 0wk7fbztn67zh 1 fw5920rbrun82 131 0wk7fbztn67zh 1
  • c29qmb59gggtv 1 c29qmb59gggtv 1
  • 6y1ajq8xaw294 1 6y1ajq8xaw294 1
  • 9q3btvwzg96k6 487 ------->>> 9q3btvwzg96k6 487 ------- >>>
  • 3zzkryq60kua1 1 3zzkryq60kua1 1
  • anp287ycdrnp6 1 anp287ycdrnp6 1
  • 58tzy7dhpwnq4 1 58tzy7dhpwnq4 1
  • cfgz3kzhx53jy 1 cfgz3kzhx53jy 1
  • 0bxwy62tx9n2w 1 0bxwy62tx9n2w 1
  • cygg3t2hc6mr2 12 cygg3t2hc6mr2 12
  • 29s08m4n6xuwt 1 29s08m4n6xuwt 1

sql_id = 9q3btvwzg96k6 keeps opening the new cursors. sql_id = 9q3btvwzg96k6继续打开新的游标。

The local static cursors are closed for you. 本地静态游标已为您关闭。

you can see the max open cursors parameter as below: 您可以看到如下所示的max open cursors参数:

show parameter open_cursor

NAME                                 TYPE        VALUE
------------------------------------ ----------- ------------------------------
open_cursors                         integer     300

Cursors opened within the inner block have obviously not been implicitly closed. 内部块内打开的游标显然没有隐式关闭。 Had they been closed, I would not have exceeded the maximum number of open cursors. 如果它们已关闭,则不会超过打开的游标的最大数量。

If cursor is already opened then Do Not close it , just use it. 如果光标已经打开,则不要关闭它,只需使用它即可。

In any case the quickest fix would be to 无论如何,最快的解决方法是

alter system set open_cursors = 1000 scope=both;

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM