РТЫ 01000: максимум открывает курсоры exceededwhen использование Spring SimpleJDBCCall

Вы хотите проверить SelectionStart свойство TextBox.

8
задан Brendan Heywood 18 September 2009 в 07:01
поделиться

5 ответов

After much testing we have fixed this problem. It is a combination of how we were using the spring framework and the oracle client and the oracle DB. We were creating new SimpleJDBCCalls which were using the oracle JDBC client's metadata calls which were returned as cursors which were not being closed and cleaned up. I consider this a bug in the Spring JDBC framework in how it calls metadata but then does not close the cursor. Spring should copy the meta data out of the cursor and close it properly. I haven't bothered opening an jira issue with spring because if you use best practice the bug isn't exhibited.

Tweaking OPEN_CURSORS or any of the other parameters is the wrong way to fix this problem and just delays it from appearing.

We worked around it/fixed it by moving the SimpleJDBCCall into a singleton DAO so there is only one cursor open for each oracle proc that we call. These cursors are open for the lifetime of the app - which I consider a bug. As long as OPEN_CURSORS is larger than the number of SimpleJDBCCall objects then there won't be hassles.

8
ответ дан 5 December 2019 в 20:17
поделиться

Могу обещать вам, что это не Весна. Я работал над приложением Spring 1.x, которое было запущено в 2005 году и с тех пор не пропускало никаких утечек. (WebLogic 9., JDK 5). Вы не закрываете свои ресурсы должным образом.

Вы используете пул подключений? На каком сервере приложений вы развертываете? Какая версия Spring? Оракул? Джава? Подробности, пожалуйста.

1
ответ дан 5 December 2019 в 20:17
поделиться

The solution is not in Spring, but in Oracle: you need to set the OPEN_CURSORS initialization parameter to some value higher than the default 50.

Oracle -- at least as-of 8i, perhaps it's changed -- would reparse JDBC PreparedStatement objects unless you left them open. This was expensive, and most people end up maintaining a fixed pool of open statements that are resubmitted.

(taking a quick look at the 10i docs, they explicitly note that the OCI driver will cache PreparedStatements, so I'm assuming that the native driver still recreates them each time)

-4
ответ дан 5 December 2019 в 20:17
поделиться

Just be careful setting OPEN_CURSORS to higher and higher values as there are overheads and it could just be band-aiding over an actual problem/error in your code.

I don't have experience with the Spring side of this but worked on an app where we had many issues with ORA-01000 errors and constantly adjusting OPEN_CURSORS just made the problem go away for a little while ...

2
ответ дан 5 December 2019 в 20:17
поделиться

Oracle OPEN_CURSORS is the key alright. We have a small 24x7 app running against Oracle XE with only a few apparently open cursors. We had intermittent max open cursors errors until we set the OPEN_CURSORS initialization value to > 300

-2
ответ дан 5 December 2019 в 20:17
поделиться
Другие вопросы по тегам:

Похожие вопросы: