There are three parameters that affect handling cursors at the application level: RELEASE_CURSOR, HOLD_CURSOR, MAXOPENCURSORS. You should set these parameters at the precompiler level.
HOLD_CURSOR by default is NO. This means that after Oracle executes a SQL statement the links to the cursor cache, memory, and parse locks are released and marked for reuse. For more details refer to Programmer's Guide to Precompilers.
RELEASE_CURSOR by default is NO. This means that after Oracle executes a SQL statement, the links to the cursor cache is maintained and not released. For more information, refer to Programmer's Guide to Precompilers.
The maximum number of open cursors per user session is set by the Oracle initialization parameter OPEN_CURSORS.
MAXOPENCURSORS specifies the initial size of the cursor cache. If a new cursor is needed and there are no free cache entries, Oracle tries to reuse an entry. Its success depends on the values of HOLD_CURSOR and RELEASE_CURSOR and, for explicit cursors, on the status of the cursor itself.
If the value of MAXOPENCURSORS is less than the number of cache entries actually needed, Oracle uses the first cache entry marked as reusable. For example, suppose the cache entry E(1) for an INSERT statement is marked as reusable, and the number of cache entries already equals MAXOPENCURSORS. If the program executes a new statement, cache entry E(1) and its private SQL area might be reassigned to the new statement. To re-execute the INSERT statement, Oracle would have to reparse it and reassign another cache entry.
Oracle allocates an additional cache entry if it cannot find one to reuse. For example, if MAXOPENCURSORS=8 and all eight entries are active, a ninth is created. If necessary, Oracle keeps allocating additional cache entries until it runs out of memory or reaches the limit set by OPEN_CURSORS. This dynamic allocation adds to processing overhead.
Thus, specifying a low value for MAXOPENCURSORS saves memory but causes potentially expensive dynamic allocations and deallocations of new cache entries. Specifying a high value for MAXOPENCURSORS assures speedy execution but uses more memory.
To resolve the ORA-01000 error, you should set HOLD_CURSOR=NO and
RELEASE_CURSOR=YES. This way, after the cursors are used, Oracle will free up the memory for other cursors.
Consequences of setting these parameters HOLD_CURSOR=NO and RELEASE_CURSOR=YES:
This will cause Oracle to release the links and locks for each cursor after the SQL statement is executed. This means that the next time Oracle needs to issue the same SQL statement, Oracle will have to reparse the statement, and rebuild the execution plan. This will cause some performance overhead.
MAXOPENCURSORS by default is 10. This number indicates the concurrent number of open cursors that the precompiler tries to keep cached. It specifies the initial size of the cursor cache. The limit of this parameter is determined by what you set OPEN_CURSORS to. Here is the formula:
MAXOPENCURSORS + 6 <= OPEN_CURSORS
6 is the overhead cursors Oracle needs.
相关推荐
在oracle里面运行一下,解决Exception java.sql.SQLException ORA-00600 内部错误代码
java.sql.SQLException: 不支持的字符集 (在类路径中添加 orai18n.jar): ZHS16GBK ……
- `java.sql.SQLException: ORA-00900: invalid SQL statement`: 执行的SQL语句有语法错误。检查SQL命令并修正语法错误。 5. **表或对象不存在** - `java.sql.SQLException: ORA-00942: table or view does not ...
在Java编程中,`java.sql.SQLException: 结果集已耗尽` 是一个常见的错误提示,通常出现在处理数据库查询结果集时。这个异常表明程序试图访问已经没有数据的结果集中下一行,即所有行已经被遍历完,尝试访问超出范围...
标题中的“Caused by: java.sql.SQLException: JZ0SJ: 没有在此数据库中发现元数据存取器信息。 请按 jConnect 文档中所述安装”是一个典型的错误信息,表明在尝试使用Java数据库连接(JDBC)驱动程序访问数据库时...
ORA-01001: INVALID_CURSOR ORA-01001 是一个常见的错误信息,通常发生在无效指针操作时。这种错误通常是由于开发者在编写 PL/SQL 语句时,忘记了某个指针的状态,导致 Oracle 无法执行指针操作。解决这个错误的...
4. **数据库开发与管理**:ora-dba工具集还包含了数据库对象的创建、修改和删除功能,以及SQL查询和PL/SQL代码的编写与调试工具。这些功能使得数据库开发人员可以在同一平台上完成大部分工作。 5. **性能优化**:...
Q: I am working with ... I am using updateBinaryStream method of resultset to update the BLOB field but it is failing after giving following exception java.sql.SQLException: Internal Error: Unable to
在Oracle数据库系统中,"ORA-00060: 等待资源时检测到死锁" 是一个常见的错误提示,它表明两个或多个事务在执行过程中陷入了无法继续进行的状态,因为彼此都在等待对方释放资源。这种情况通常发生在并发操作中,比如...
在Oracle数据库管理中,"ORA-28001 the password has expired" 是一个常见的错误,它表明数据库用户的密码已经超过了预设的有效期限,导致用户无法正常登录。这个错误主要出现在Oracle 11G及更高版本中,因为这些...
Caused by: java.sql.SQLException: java.lang.ClassNotFoundException: org.apache.hive.jdbc.HiveDriver at com.trs.gateway.commons.hive.HiveFeature.getConnection(HiveFeature.java:57) at ...
它由Sun Microsystems开发并被纳入Java SE(标准版)的一部分,允许开发者在Java应用程序中执行SQL语句,实现数据的增删改查。JDBC驱动是连接Java应用程序和数据库之间的桥梁,不同的数据库需要对应的JDBC驱动。 1....
java.sql.SQLException: null, message from server: “Host ‘223.72.41.7’ is not allowed to connect to this MySQL server” 客户端访问时报错: 解决方法: 1,登陆服务器 mysql> use mysql; //用mysql ...
### ORA-01157 错误详解与解决方案 #### 错误代码与含义 ORA-01157 错误是 Oracle 数据库中一个常见的错误代码,其全称是:“ORA-01157: 无法识别/文件 - DBWR 文件”。这个错误通常发生在数据库启动过程中,当...
它实现了Java Database Connectivity (JDBC) API,使得开发者可以使用Java语言来操作Oracle数据库,执行SQL语句,进行数据查询、插入、更新和删除等操作。Oracle JDBC驱动分为不同版本,包括 Thin、OCI、JDBC-ODBC ...
主要给大家介绍了关于MySQL存储表情时报错:java.sql.SQLException: Incorrect string value: 'xF0x9Fx92xA9x0Dx0A...'的解决方法,文中通过示例代码介绍的非常详细,需要的朋友可以参考借鉴,下面来一起看看吧。
在JDBC中,CLOB对象被表示为`java.sql.Clob`接口的实例,提供了读取和修改CLOB字段的方法。 要读取CLOB字段并转换为String,你需要遵循以下步骤: 1. **建立连接**:使用`DriverManager.getConnection()`方法建立...
针对“ORA-24345”错误的解决方案可能涉及到检查SQL语句,确保所有字段的数据类型和长度都与数据库表结构相匹配,或者调整缓冲区大小以适应数据。对于文件管理功能的问题,可能需要修复或优化上传机制,确保只有安全...
本文主要介绍了关于MySQL存储表情报错:java.sql.SQLException: Incorrect string value: ‘\xF0\x9F\x92\xA9\x0D\x0A…’的相关解决方法,分享出供大家参考学习,下面话不多说了,来一起看看详细的介绍: ...