Maximum open cursors exceeded when reversing
He llo,
I get the following zrror when trying to reverse a table from an Oracle Database preventing me to reverse the table:
java.sql.SQLException: ORA-01000: maximum open cursors exceeded
Thanks
Hi Jean,
I think this is related to the issue I faced a while back.
Thread: Limit/remove inactive database connections generated by ODI
My solution was to write a custom linux shell script to kill off old ODI sessions in the database. I scheduled this job to run via the crontab.
sqlplus -s / <<!
set feedback off
set trimspool on
set pages 9999
spool /tmp/kill_odi_db_sessions.tmp
select 'ALTER SYSTEM KILL SESSION '''||sid||','|| serial#||''' immediate;'
from v\$session
where username ='<ODI_USER>'
and status ='INACTIVE'
and LAST_CALL_ET > 1800
spool off
exit
sqlplus -s / <<!
@/tmp/kill_odi_db_sessions_$ORACLE_SID.tmp
exit
Hope this helps!
Matt
Similar Messages
-
Maximum open cursors exceeded when inserting to a remote db
I receive the error:
ORA-01000: maximum open cursors exceeded
ORA-02063: preceding line
from ONTARIO
(where ONTARIO is my remote db) when I am performing inserts from a pl/sql procedure to the remote db. I am performing two inserts from inside pl/sql and then issuing an explicit commit. I checked the open_cursors init param on both the local db and remote db and it was set to 300. I bumped up the remote db init param to 600. I was able to perform more inserts but still received this error.
I thought implicit cursors close themselves, especially after a commit. Do I need to do something special to close the cursors on the remote machine?
Thanks for your time...Check which process is making all the cursors on which database. If it is your procedure, try explicitly closing the cursors. I think the cursors are only implicitely closed after the transaction is ended. If you loop and open a cursor within the loop, that might be the problem.
I also had this problem with Java working over a JDBC connection some time ago on a 815 database. If I recall correctly, that was caused by the JDBC driver and fixed by replacing it with a JDBC driver of 9i.
The following script is what I used previously in a program that can draw a graph from the results. It is ugly, but does the job.
Hope this helps,
L.
select
'max cursors',
to_number(value)
from
v$parameter
where
name = 'open_cursors'
union
select
substr(lower(username),1,10)||'('||substr(to_char(ses.sid)||','
||to_char(serial#),1,9)||')',
s.value
from
v$sesstat s,
v$statname n,
v$session ses
where
s.statistic#=n.statistic#
and ses.sid=s.sid
and n.name like '%cursor%'
and n.name like '%current%'
and not (ses.sid between 1 and 6) -
Maximum open cursores exceeded
Hi folks
I'm getting Ora-1000 maximum open cursors exceeded when running a java application.
I closed all the result sets i opened.what is the problem.
Any Help is Appericiated.I have class called DB.Inside That i'm creating statement object like this
public static synchronized ResultSet runQuery(String sQuery,
Statement dbStmt) {
ResultSet resultset = null;
openDB();
dbStmt = g_dbCon.createStatement(ResultSet.TYPE_SCROLL_SENSITIVE,
ResultSet.CONCUR_READ_ONLY);
resultset = dbStmt.executeQuery(sQuery);
return resultset;
}where g_dbCon is a global connection object.
From other class i'm calling method like this
Statement dbstmt=null;
DB.runQuery(sql,dbstmt);i have no choice to close statement object every time. -
Oracle and "Maximum open cursors exceeded"
Hi,
I am using Weblogic 7.0sp2 with Oracle 9.2.0. Since we are using manual JTA
transactions and the 9.2 drivers are buggy in that respect, we are using the
9.0.1 thin drivers delivered with weblogic.
The problem I have is that after a while, we get the now classic "Maximum open
cursors exceeded" error on connections from our connection pool (used through
a
TX datasource). I have of course checked all our JDBC code and it is fine. We
do not leave any statement/connection open. In fact, I am certain that the
problem is not caused by our applicative code.
The reason I am so positive is that the numbers of open (cached) cursors is
growing, even though there is no activity on our application (I mean no
activity at all). The number of cursors is regurlarly increasing by one
every 5 minutes until it reaches the maximum allowed for a session.
I have listed the statements corresponding to the opened cursors (they
do not belong to our code, as you might have guessed):
SELECT sysdate, user from dual
select longdbcs from javasnm$ where short = :1
select longname from javasnm$ where short = :1
As you can see, there are only three different statements. You can get
the statements from the system view v$open_cursor for a given session
but it will only give one row per different statement. If you want to know
the # of opened cursors in your cursor, use v$sesstat with statistic# = 3
(opened cursor current).
I suspect something is wrong in the connection testing done by weblogic
for the pool (I have activated test on reserved connections and test table
name is "dual") that leaves a resultset/statement behind. What is weird
though is that the refresh period is still 0 (not 5 minutes as you would
expect from the cursor growth rate...).
I would not say that it is an Oracle bug (as stated in some BEA FAQ I read)
since our application JDBC code does not exhibit the same problem. The
problem appeared with recent version of WebLogic for which the session
cursor cache is enabled, I suppose for performance reasons - this
is set by isssuing "ALTER SESSION SET SESSION_CACHED_CURSORS = ...".
Talking about this, does anybody know to which value WebLogic sets this
parameter when intializing the connection (this is neither
documented/configurable)?
Up to now, I have come up with possibly two workarounds, neither of which
is satisfying:
- resetting the pool from time to time
- issuing "ALTER SESSION SET SESSION_CACHED_CURSORS = 0" when I get a
connection from the pool. I have not tested this one personally (read
in a newsgroup that someone else did successfully) but it is supposed
to reset the cursor cache that is causing the trouble.
Any help will be greatly appreciated,
Regards,
Thierry.Thierry Rouget wrote:
Hi,
I am using Weblogic 7.0sp2 with Oracle 9.2.0. Since we are using manual JTA
transactions and the 9.2 drivers are buggy in that respect, we are using the
9.0.1 thin drivers delivered with weblogic.
The problem I have is that after a while, we get the now classic "Maximum open
cursors exceeded" error on connections from our connection pool (used through
a
TX datasource). I have of course checked all our JDBC code and it is fine. We
do not leave any statement/connection open. In fact, I am certain that the
problem is not caused by our applicative code.
The reason I am so positive is that the numbers of open (cached) cursors is
growing, even though there is no activity on our application (I mean no
activity at all). The number of cursors is regurlarly increasing by one
every 5 minutes until it reaches the maximum allowed for a session.
I have listed the statements corresponding to the opened cursors (they
do not belong to our code, as you might have guessed):
SELECT sysdate, user from dual
select longdbcs from javasnm$ where short = :1
select longname from javasnm$ where short = :1
As you can see, there are only three different statements. You can get
the statements from the system view v$open_cursor for a given session
but it will only give one row per different statement. If you want to know
the # of opened cursors in your cursor, use v$sesstat with statistic# = 3
(opened cursor current).
I suspect something is wrong in the connection testing done by weblogic
for the pool (I have activated test on reserved connections and test table
name is "dual") that leaves a resultset/statement behind. What is weird
though is that the refresh period is still 0 (not 5 minutes as you would
expect from the cursor growth rate...).
I would not say that it is an Oracle bug (as stated in some BEA FAQ I read)
since our application JDBC code does not exhibit the same problem. The
problem appeared with recent version of WebLogic for which the session
cursor cache is enabled, I suppose for performance reasons - this
is set by isssuing "ALTER SESSION SET SESSION_CACHED_CURSORS = ...".
Talking about this, does anybody know to which value WebLogic sets this
parameter when intializing the connection (this is neither
documented/configurable)?
Up to now, I have come up with possibly two workarounds, neither of which
is satisfying:
- resetting the pool from time to time
- issuing "ALTER SESSION SET SESSION_CACHED_CURSORS = 0" when I get a
connection from the pool. I have not tested this one personally (read
in a newsgroup that someone else did successfully) but it is supposed
to reset the cursor cache that is causing the trouble.
Any help will be greatly appreciated,
Regards,
Thierry.Hi. We don't make those queries either. I suspect they are internal to the
oracle driver. One thing you can try is to set the size of the pool's
statement cache to zero. Oracle will retain cursors for every statement we
cache. The alternative is also to tell the DBMS to allow a given session
more cursors.
Joe -
Maximum open cursors exceeded - after update to 1.1.1.25
While browsing around a database I keep getting "Maximum open cursors exceeded". The only cure is to disconnect and reconnect. This doesn't happen in the prior version (1.0.0.15).
Dear Product Development
I posted a thread about this and a previous version but I am now getting it more and more often in the new version.
When it happens I get a JAVA log window popping up with the following information in it.
Level X
Sequence 130
Elapsed 0
Source oracle.dbdev.oviewer.table.DataEditor
Message _getTableData
Is this any help to the product development team in diagnosing the issue.
Cheers
Chris -
Maximum Open Cursors Exceeded problem in XSQL
Hi,
We are processing an XSQL page by calling XSQLRequest.process() programatically within our application. Within the XSQL page there are several queries which involve multiple nested CURSOR expressions... when the query returns enough rows we are running into the error "ORA-00604: error occurred at recursive SQL level 1 ORA-01000: maximum open cursors exceeded".
When searching this forum I have seen many (old) postings regarding this error and a bug in the XDK... seems like it was some time ago, but while we set about improving the structure of our XSQL page (or increasing the max open cursor init parameter currently at 500 or both) can anyone confirm that this bug no longer exists?
Also, any general suggestions on working around this limit rather than increasing it? We have considered splitting up our queries into smaller queries (and merging the results via XSLT) and closing cursors during the session explicitly by issuing commits within the XSQL page... but any better ideas?
Thanks,
BobI have found this max open cursors problem to be related to Statement object not being closed. This presents a problem for the use of PreparedStatements, because they are only useful if you can keep them open and resuse them. However, in doing so, each iteration through the PreparedStatement creates another open cursor in the databse rather than reusing the previous one. A work around I discovered by reading about REF CURSORS and I use in JDBC is as follows:
Assuming a previously prepared PreparedStatement pstmt and a ResultSet rset-
while (rset.next()) {
rset.close();
// This line closes the cursor in the database
// but does not require you to re-prepare the
// PreparedStatement. Don't ask me why--ask the
// Oracle API guys.
rset.getStatement().close();
// make ready for GC
rset = null; -
SQLException: maximum open cursors exceeded
hi all,
i get the following exception when executing my program.
14:36:02,111 ERROR [STDERR] java.sql.SQLException: ORA-01000: maximum open cursors exceeded
14:36:02,111 ERROR [STDERR] at oracle.jdbc.dbaccess.DBError.throwSqlException(DBError.java:134)
14:36:02,111 ERROR [STDERR] at oracle.jdbc.ttc7.TTIoer.processError(TTIoer.java:289)
14:36:02,111 ERROR [STDERR] at oracle.jdbc.ttc7.Oopen.receive(Oopen.java:120)
14:36:02,111 ERROR [STDERR] at oracle.jdbc.ttc7.TTC7Protocol.open(TTC7Protocol.java:586)
14:36:02,127 ERROR [STDERR] at oracle.jdbc.driver.OracleStatement.<init>(OracleStatement.java:385)
14:36:02,127 ERROR [STDERR] at oracle.jdbc.driver.OracleConnection.privateCreateStatement(OracleConnection.java:772)
14:36:02,127 ERROR [STDERR] at oracle.jdbc.driver.OracleConnection.createStatement(OracleConnection.java:712)
14:36:02,127 ERROR [STDERR] at org.jboss.resource.adapter.jdbc.WrappedConnection.createStatement(WrappedConnection.java:145)
14:36:02,127 ERROR [STDERR] at abcd.updateMethod(abcd.java:1605)
14:36:02,127 ERROR [STDERR] at servlet.abcdServlet.doPost(abcdServlet.java:62)
14:36:02,127 ERROR [STDERR] at javax.servlet.http.HttpServlet.service(HttpServlet.java:717)
14:36:02,127 ERROR [STDERR] at javax.servlet.http.HttpServlet.service(HttpServlet.java:810)
14:36:02,143 ERROR [STDERR] at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:252)
14:36:02,143 ERROR [STDERR] at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:173)
14:36:02,143 ERROR [STDERR] at org.jboss.web.tomcat.filters.ReplyHeaderFilter.doFilter(ReplyHeaderFilter.java:96)
14:36:02,143 ERROR [STDERR] at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:202)
14:36:02,143 ERROR [STDERR] at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:173)
14:36:02,143 ERROR [STDERR] at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:213)
14:36:02,143 ERROR [STDERR] at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:178)
14:36:02,143 ERROR [STDERR] at org.jboss.web.tomcat.security.SecurityAssociationValve.invoke(SecurityAssociationValve.java:175)
14:36:02,143 ERROR [STDERR] at org.jboss.web.tomcat.security.JaccContextValve.invoke(JaccContextValve.java:74)
14:36:02,143 ERROR [STDERR] at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:126)
14:36:02,143 ERROR [STDERR] at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:105)
14:36:02,143 ERROR [STDERR] at org.jboss.web.tomcat.tc5.jca.CachedConnectionValve.invoke(CachedConnectionValve.java:156)
14:36:02,143 ERROR [STDERR] at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:107)
14:36:02,143 ERROR [STDERR] at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:148)
14:36:02,143 ERROR [STDERR] at org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:869)
14:36:02,143 ERROR [STDERR] at org.apache.coyote.http11.Http11BaseProtocol$Http11ConnectionHandler.processConnection(Http11BaseProtocol.java:664)
14:36:02,143 ERROR [STDERR] at org.apache.tomcat.util.net.PoolTcpEndpoint.processSocket(PoolTcpEndpoint.java:527)
14:36:02,143 ERROR [STDERR] at org.apache.tomcat.util.net.MasterSlaveWorkerThread.run(MasterSlaveWorkerThread.java:112)the code is like this
while (result.next())
String sql = "update query";
Statement = null;
st = con.createStatement(); // line No. 1605
st.executeUpdate(sql);
st.close();
}anyone had such experience? please post your valuable suggestions.You have better to select your data (select connection) and store them in an arraylist for example, then close the 'select connection' and finally
loop through the arraylist and make as much update as the list size.I disagree. Huge amounts of data could be being pulled from the database (that is one of their strength) and if the data can be processed one row at a time there is no reason to load it all into memory.
=> take a look [here |http://java.sun.com/docs/books/tutorial/jdbc/TOC.html]
and [here |http://java.sun.com/docs/books/tutorial/jdbc/basics/prepared.html] for preparedstatements
Ditto to PreparedStatement
OP. Is it possible that the Statement being returned (from what looks like JBoss) has the close method overwritten and does not actually return the resource (some type of pooling)? -
Oracle - maximum open cursors exceeded
Hi! I'm constatly getting the error I pasted below, when this line is executed:
PreparedStatement stmt = connection.prepareStatement(sqlStatement);
'connection' is of course an instance of oracle.jdbc.driver.OracleConnection, and 'sqlStatement' is a normal INSERT statement.
Now, why I'm getting an error that involves cursos if the statement is an insert? One more thing, this error is happening in some enviroments so I think it could be an orcacle server problem (like installation or configuration problem), or it could be the driver, or... I dont know :)
Well, I hope anyone can give me a tipo about this... Thanks in advance.
Dario
ORA-01000: maximum open cursors exceeded
java.sql.SQLException: ORA-01000: maximum open cursors exceeded
at oracle.jdbc.dbaccess.DBError.throwSqlExceptionDBError.java:180)
at oracle.jdbc.ttc7.TTIoer.processError(TTIoer.java:208)
at oracle.jdbc.ttc7.Oopen.receive(Oopen.java:118)
at oracle.jdbc.ttc7.TTC7Protocol.open(TTC7Protocol.java:472)
at oracle.jdbc.driver.OracleStatement.<init>OracleStatement.java:499)
at oracle.jdbc.driver.OracleStatement.<init>OracleStatement.java:518)
at oracle.jdbc.driver.OraclePreparedStatement.<init>OraclePreparedStatement.java:210)
at oracle.jdbc.driver.OraclePreparedStatement.<init>OraclePreparedStatement.java:193)
at oracle.jdbc.driver.OracleConnection.privatePrepareStatementOracleConnection.java:869)
at oracle.jdbc.driver.OracleConnection.prepareStatementOracleConnection.java:704)
------------------------------------------Thanks a lot for all the answers...
After some tests a made, I found out that in the enviroment I developed the application, the value of the parameter OPEN_CURSORS is 300. I don't know yet which is the value in the test enviroment (where the errors are happening) but I'm pretty sure it is smaller, since I could force the same error in the development enviroment increasing the concurrency of the application (ie, I force the application too many create prepare statements, even much more than the real values the application should accept).
Well, I have to thank you all again...
Dario -
Maximum open cursors exceeded and cqj0 trace
From this morning on the database is reporting the maximum open cursors exceeded in the cqj0 trace. When I see the alert log the error message appear again and again. I try to solve it by setting the open_cursor parameter but the problem do not disappear. I have an oracle rac database 11.1.0.7, OS is Suse Linux Enterprise 10. Also I have configured a local capture process in my database.
Thank you.Hi,
Please perfrom the following action plan
1)sql> show parameter cursor_sharing
2) generate the AWR report for the duration of 60min when you were getting the error and paste the contents of section
sql ordered by version count
Kind Regards,
Rakesh jayappa -
Maximum open cursors exceeded from Oracle XA Connection pool
I am on WLS 6.1 sp2.
When i leave the server up overnight unaccessed and come back and see in the morning,
I see the following stacktrace on the server console.
I dont think its causing any harm, but is there anyway to prevent this from occuring?
java.sql.SQLException: ORA-01000: maximum open cursors exceeded
at oracle.jdbc.dbaccess.DBError.throwSqlException(DBError.java:168)
at oracle.jdbc.ttc7.TTIoer.processError(TTIoer.java:208)
at oracle.jdbc.ttc7.Oopen.receive(Oopen.java:118)
at oracle.jdbc.ttc7.TTC7Protocol.open(TTC7Protocol.java:466)
at oracle.jdbc.driver.OracleStatement.<init>(OracleStatement.java:413)
at oracle.jdbc.driver.OracleStatement.<init>(OracleStatement.java:432)
at oracle.jdbc.driver.OraclePreparedStatement.<init>(OraclePreparedStatement.java:182)
at oracle.jdbc.driver.OracleCallableStatement.<init>(OracleCallableStatement.java:102)
at oracle.jdbc.driver.OracleCallableStatement.<init>(OracleCallableStatement.java:86)
at oracle.jdbc.driver.OracleConnection.privatePrepareCall(OracleConnection.java:736)
at oracle.jdbc.driver.OracleConnection.prepareCall(OracleConnection.java:622)
at oracle.jdbc.xa.client.OracleXAResource.start(OracleXAResource.java:163)
at weblogic.jdbc.jta.VendorXAResource.start(VendorXAResource.java:41)
at weblogic.transaction.internal.ServerResourceInfo.start(ServerResourceInfo.java:1032)
at weblogic.transaction.internal.ServerResourceInfo.xaStart(ServerResourceInfo.java:975)
at weblogic.transaction.internal.ServerResourceInfo.enlist(ServerResourceInfo.java:234)
at weblogic.transaction.internal.ServerTransactionImpl.enlistResource(ServerTransactionImpl.java:374)
at weblogic.jdbc.common.internal.ConnectionEnv.test(ConnectionEnv.java:937)
at weblogic.common.internal.ResourceAllocator.reserve(ResourceAllocator.java:465)
at weblogic.common.internal.ResourceAllocator.reserveUnused(ResourceAllocator.java:376)
at weblogic.common.internal.ResourceAllocator.trigger(ResourceAllocator.java:1103)
at weblogic.time.common.internal.ScheduledTrigger.executeLocally(ScheduledTrigger.java:238)
at weblogic.time.common.internal.ScheduledTrigger.execute(ScheduledTrigger.java:229)
at weblogic.time.server.ScheduledTrigger.execute(ScheduledTrigger.java:65)
at weblogic.kernel.ExecuteThread.execute(ExecuteThread.java:139)
at weblogic.kernel.ExecuteThread.run(ExecuteThread.java:120)Hi. I think this is an oracle driver problem, in all likelihood.
We test a connection with:
Statement stmt = c.createStatement();
stmt.execute(sql);
Where the string sql is "select count(*) from DUAL" if you named your test table as 'DUAL'.
We obtain no result set, so the driver shouldn't be accruing cursors...
Can you upgrade to the latest oracle driver?
Can you upgrade to the latest version of 6.1?
Jeeva wrote:
I am on WLS 6.1 sp2.
When i leave the server up overnight unaccessed and come back and see in the morning,
I see the following stacktrace on the server console.
I dont think its causing any harm, but is there anyway to prevent this from occuring?
java.sql.SQLException: ORA-01000: maximum open cursors exceeded
at oracle.jdbc.dbaccess.DBError.throwSqlException(DBError.java:168)
at oracle.jdbc.ttc7.TTIoer.processError(TTIoer.java:208)
at oracle.jdbc.ttc7.Oopen.receive(Oopen.java:118)
at oracle.jdbc.ttc7.TTC7Protocol.open(TTC7Protocol.java:466)
at oracle.jdbc.driver.OracleStatement.<init>(OracleStatement.java:413)
at oracle.jdbc.driver.OracleStatement.<init>(OracleStatement.java:432)
at oracle.jdbc.driver.OraclePreparedStatement.<init>(OraclePreparedStatement.java:182)
at oracle.jdbc.driver.OracleCallableStatement.<init>(OracleCallableStatement.java:102)
at oracle.jdbc.driver.OracleCallableStatement.<init>(OracleCallableStatement.java:86)
at oracle.jdbc.driver.OracleConnection.privatePrepareCall(OracleConnection.java:736)
at oracle.jdbc.driver.OracleConnection.prepareCall(OracleConnection.java:622)
at oracle.jdbc.xa.client.OracleXAResource.start(OracleXAResource.java:163)
at weblogic.jdbc.jta.VendorXAResource.start(VendorXAResource.java:41)
at weblogic.transaction.internal.ServerResourceInfo.start(ServerResourceInfo.java:1032)
at weblogic.transaction.internal.ServerResourceInfo.xaStart(ServerResourceInfo.java:975)
at weblogic.transaction.internal.ServerResourceInfo.enlist(ServerResourceInfo.java:234)
at weblogic.transaction.internal.ServerTransactionImpl.enlistResource(ServerTransactionImpl.java:374)
at weblogic.jdbc.common.internal.ConnectionEnv.test(ConnectionEnv.java:937)
at weblogic.common.internal.ResourceAllocator.reserve(ResourceAllocator.java:465)
at weblogic.common.internal.ResourceAllocator.reserveUnused(ResourceAllocator.java:376)
at weblogic.common.internal.ResourceAllocator.trigger(ResourceAllocator.java:1103)
at weblogic.time.common.internal.ScheduledTrigger.executeLocally(ScheduledTrigger.java:238)
at weblogic.time.common.internal.ScheduledTrigger.execute(ScheduledTrigger.java:229)
at weblogic.time.server.ScheduledTrigger.execute(ScheduledTrigger.java:65)
at weblogic.kernel.ExecuteThread.execute(ExecuteThread.java:139)
at weblogic.kernel.ExecuteThread.run(ExecuteThread.java:120) -
In java/jsp got Error,ORA-01000: maximum open cursors exceeded,
Dear ALL,
We are facing a problem of in java/jsp. ORA-01000: maximum open cursors exceeded,We are using referance Cursor for returing the Record in java file.
The Code is given below.
import java.sql.*;
import javax.sql.*;
import com.india.trade.dbConnection.*;
import oracle.jdbc.driver.*;
import java.util.Vector ;
public class IntRmsActivity
private static JDBCConnection instance = null;
private static Connection con = null;
private static CallableStatement stmt_admin_getadmins = null;
private static String str_admin_getadmins = "{ call Admin_conf.RMS_ADMIN_GETALLADMINS(?,?) }";
static
try
instance = new JDBCConnection();
con = instance.getConnection();
stmt_admin_getadmins = con.prepareCall(str_admin_getadmins);
}catch(Exception se){se.printStackTrace();}
public static Vector admin_getAdmins() throws Exception
checkconnection();
String message = null;
Vector v_admins = new Vector();
ResultSet rs_admins = null;
stmt_admin_getadmins.registerOutParameter(1 , OracleTypes.CURSOR);
stmt_admin_getadmins.registerOutParameter(2 , Types.VARCHAR);
stmt_admin_getadmins.execute();
message = stmt_admin_getadmins.getString(2);
System.out.println("message " + message);
rs_admins = ((OracleCallableStatement)stmt_admin_getadmins).getCursor(1);
while (rs_admins.next())
v_admins.addElement(rs_admins.getString("adminid"));
rs_admins.close();
return v_admins;
CREATE OR REPLACE PACKAGE Admin_conf IS
TYPE REF_CRSR IS REF CURSOR; /* OUTPUT CURSOR VARIABLE TYPE */
PROCEDURE RMS_ADMIN_GETALLADMINS(RESULTS OUT REF_CRSR,
OUT_MESSAGE OUT VARCHAR2);
END Admin_conf;
CREATE OR REPLACE PACKAGE BODY Admin_conf
IS
PROCEDURE RMS_ADMIN_GETALLADMINS(RESULTS OUT REF_CRSR,
OUT_MESSAGE OUT VARCHAR2)
IS
l_ref_out_crsr REF_CRSR;
BEGIN
OPEN l_ref_out_crsr FOR
SELECT EXECUTIVE_ID adminid
FROM MASTER_EXECUTIVE_ID
ORDER BY EXECUTIVE_ID;
OUT_MESSAGE := 'ADMIN IDS FETCHED SUCCESSFULLY';
RESULTS := l_ref_out_crsr;
EXCEPTION WHEN OTHERS THEN
OUT_MESSAGE := 'ERROR ' || SUBSTR(SQLERRM, 1, 60);
END RMS_ADMIN_GETALLADMINS;
END Admin_conf;
Regards
Ajay Singh RathodAre you actually closing the connections, resultsets in all cases?
From what you've posted you call
rs_admins.close();but in that method, you propagate any exceptions that occur out to the caller method, which in turn just prints a stack trace.
So if an exception occurs before you call the rs_admin.close() the result set will never be closed as the statement won't be reached.
I'd add a speific exception handling routine to the admin_getAdmins() method and include a finally clause to close the result set in all cases. You can still onthrow the exception if you want.
cheers
-steve- -
ORA-01000: maximum open cursors exceeded (please help / JDBC guru needed)
ORA-01000: maximum open cursors exceeded
I am getting this error when trying to execute 2,500 Sql DDL statements. I am executing the statement with:
public boolean execute(String sql) ( like stmt.execute(sql); )
After each execute() I close the statement ( like stmt.close() )
I tried taking this a step further and decided to close and reopen the database connection after every 100 Sql statements processed and I still get this exception when continuing.
ORA-01000: maximum open cursors exceeded
Any help will be greatly appreciated. I need to figure how to close the cursors or how to finish processing all 2,500 statements. I do not have control over the init.ora file and can not increase the max cursors. I hope to figure out how to close the cursors so that no tweaking of the init.ora file is needed.
ChrisTDWhy dont you allocate dukes for this problem ???
am getting this error when trying to execute 2,500 Sql DDL statements. I am executing the statement with:
public boolean execute(String sql) ( like stmt.execute(sql); )
After each execute() I close the statement ( like stmt.close() )
What kind of DDL is that? are you using any cursor operations to fetch the data? What kind of query does this sql parameter contain?
Look there is only 3 solutions for this kind of problem.
1) shutdown the database and restart it.
I dont think closing connection will shutdown the database as you
told.
2) shutdown the database access init.ora and increase the
OPEN_CURSORS and then restart it.
You told that you dont have access to init.ora.
3) close every cursor that you open.(Probably you are not closing the cursor once you fetch the data). -
ORA-01000: maximum open cursors exceeded with Thin and OCI
Hi I have this ERROR :
ORA-01000: maximum open cursors exceeded
ORA-06510: PL/SQL: unhandled user-defined exception
ORA-06512: at line 1
and all the connections show this error, I run the weblogic.Admin RESET_POOL utility
and the problem are fixed !!
Why show this error ?
why with RESET_POOL utility resolve the problem ?
the Oracle Version is Oracle 8.1.7.0 32bits on Solaris 8Mitesh:
I using testConnOnReserve=true and testReleasedConnections=true specify testTableName
when the errors appear , but increse the open_cusror value to 1200, i think is
not the solution, because the DB and Stored Procedure is used by Cold Fusion ,
is the same Application, in Cold Fusion not show this error u other errors with
380 users on the application.
I check to increse the open_cusror and test the application.
thanks
Roberto
Mitesh Patel <[email protected]> wrote:
You should do couple of things here.
First of all you can increse the open_cusror value to 1200 if it is ok
with you.
Secondly, make sure you are using testConnOnReserve=true and specify
testTableNAme
in your config.xml for your connection pool defination.
Thanks,
Mitesh
Roberto Hernandez wrote:
Mitesh Patel,
WLS 6.1 sp3 on Solaris 8, in init.ora file
session_cached_cursors = 30 and Open_Cursors = 600
Any Idea to resolve the Error and not use manual RESET_POOL utility?
thanks
Mitesh Patel <[email protected]> wrote:
This is know bug from oracle.
XAResource.recover repeatedly returns the same set of in-doubt
Xids irrespective of the input flag. According to the XA spec, the
Transaction Manager should initially call XAResource.recover with
TMSTARTRSCAN and then call XAResource.recover with
TMNOFLAGS repeatedly until no Xids are returned. This Oracle
bug could lead to infinite recursion and subsequent running out
of Oracle cursors with error "ORA-01000: maximum open cursors
exceeded."
What version of weblogic are you using? What is value for max cursors
in init.ora file
in your dbserver?
Resets the named database ConnectionPool by shutting down and
reestablishing all the allocated connections. This method should
only be called when the connection pool is known to be in a bad
state, for example when the database has been restarted.
By using Reset you are cleaning all bad connections and associated
cursors
with it. That
is why it resolves ora-1000 for you.
Mitesh
Roberto Hernandez wrote:
Hi I have this ERROR :
ORA-01000: maximum open cursors exceeded
ORA-06510: PL/SQL: unhandled user-defined exception
ORA-06512: at line 1
and all the connections show this error, I run the weblogic.Admin
RESET_POOL
utility
and the problem are fixed !!
Why show this error ?
why with RESET_POOL utility resolve the problem ?
the Oracle Version is Oracle 8.1.7.0 32bits on Solaris 8 -
JDBC Error: ORA-01000: maximum open cursors exceeded
Post Author: prashant
CA Forum: Information OnDemand
I successfully created reports using CR4E on windows, deployed JSPS to Websphere running on windows and was able to view a large reports for a using JNDI connection resources to Oracle 10g.
Every time report is called, it consume 12 cursors from of the database. Open_cursors count is 300. After 24 or 25 iteration of this report, it throws ORA-01000: maximum open cursors exceeded error.
Has anyone seen this problem, and if so where can I find a hot fix/patch. Any help would very much be appreciated.The following code reproduces the problem for me. I thought this was just related to when an exception occurs, and close occurs immediately afterwards. Close finds the exception that occured, and throws it without releasing the resources.
It's a pain in the ass, that's for sure.
public void go() {
try{
long startTime = System.currentTimeMillis();
String sql = "Select number_7_0__, char_10__, varchar_5__, varchar2_10__, number_10_5__, float_126__, date_, clob_, blob_ FROM lotsofrows";
Properties connectProps = new Properties();
Driver drv = new oracle.jdbc.driver.OracleDriver();
connectProps.put("user", "borg");
connectProps.put("catalog", "test");
connectProps.put("password", "borgborg");
Connection conn = drv.connect("jdbc:oracle:thin:@142.176.134.166:1521:test", connectProps);
int cnt = 0;
while (true) {
try {
System.out.print("\nTest " + ++cnt + " ");
Statement stmt = conn.createStatement();
System.out.print("execute ");
ResultSet rs = stmt.executeQuery(sql);
System.out.print("cancel ");
stmt.cancel();
try {
System.out.print("close.");
stmt.close();
} catch (SQLException se) {
if (se.getMessage().indexOf("requested cancel") != -1) {
System.out.print("URC:Close");
try {
stmt.close();
} catch (Exception ee) {
System.out.println(ee.getMessage());
ee.printStackTrace();
} else {
throw se;
stmt = null;
}catch(Exception se) {
System.out.println(se.getMessage());
se.printStackTrace();
}catch(Exception e) {
System.out.println(e.getMessage());
e.printStackTrace();
null -
Getting error ora-01000 maximum open cursors exceeded
hello,
i am building my fist application using eclipse3.3 hibernate 3.2(hybernatesynchronizer as plugin)
i have a oracle9i like sgbd . when i trying to create my mapping file from eclipse i got this error :
ORA-01000: maximum open cursors exceeded
i try to increase the number of cursor from the oracleconfiguration file init.ora, i shutdown but the problem still
i don t know how to solve this problem really.
i need help.Yes, that it what I was asking about.Not that it matters, but I think you misunderstood. I meant "if you ask it to leak resources then it will do so." I wasn't asking what you meant.
Is there a way to make it explicitly open and close via a single call? Perhaps a configuration option either globably or by method/class?Not as a standard part of Hibernate, no. That said, it's relatively hard to leak anything other than connection objects unless you're really trying hard. There are libraries that you can use to manage the lifetime of the connection (actually the session) object. I like the Spring DAO support classes. Inevitably they cause their own problems for someone who doesn't understand what Hibernate's up to under the covers though.
Edit: Quick example
// Bog standard Hibernate
Session session = sessionFactory.openSession();
try {
return (List<Foo>)session.createQuery("from Foo").list();
} finally {
session.close(); // If omitted will leak a connection object
// Using Spring
return (List<Foo>)getHibernateTemplate().find("from Foo");Things get slightly more interesting if you're using lazy loading and actively want to keep the connection around for longer.
Maybe you are looking for
-
Ever since i installed firefox 5 beta and the new version of flash, flash crashes on every page with flash on it no matter what version of firefox i run, and flash wont let me roll back to another version. I need flash for my work which is due by the
-
Can I transfer music from my iPod touch to my mac?
The iPod has been authorized with the computer already but for some reason all of the music on my iPod isn't showing. I want to reset the music on the computer's library and then just sync what's on my iPod onto it but I don't know how. Help?
-
Problems with a Game - Should I update to OSX Mountain Lion?
Howdy, To cut a long story short and get straight to the point I've been having problems with the Sims 3 for god knows how long and its starting to drive me mad. What I'm now wondering is whether updating to OSX Mountain Lion would help at all. The r
-
Satellite Pro A300-1DZ does not find HDD after BIOS update
Hi everyone, I have recently purchased a secondhand Satellite Pro A300 1DZ. Put a fresh copy of Windows xp home on it. I then went on to install all the drivers needed from Toshiba's own site and at the end of this I thought it may be a good idea to
-
DNS lookups to VPN hijacked by WRVS4400N (fw v1.1.13)?
I have a WRVS4400N on the latest firmware offered by Cisco. After a whole run of problems with previous firmware, this one seems to be almost perfect except for this odd issue I've been encountering now (that I hadn't encountered on previous firmwar