I am running a batch application that processes huge data files and puts the data into an Oracle 11g database. I am using Java 1.6.20, ojdbc6, and ucp11.2. Intermittently, I get ORA-01010 invalid operation SQLExceptions. When I looked up the meaning of this error and the actions to take for it:
ORA-01010: invalid OCI operation
Cause:
One of the following: 1) You attempted an invalid OCI operation. 2) You are using an Oracle client application linked with version 7.1 (or higher) libraries, the environment variable ORA_ENCRYPT_LOGIN is set to TRUE, and you attempted to connect to a version 7.0 (or lower) Oracle Server. 3) You are connected to a version 7.1 (or higher) Oracle Server, the initialization parameter DBLINK_ENCRYPT_LOGIN is set to TRUE, and you attempted to use a database link pointing to a version 7.0 (or lower) Oracle Server. 4) You are connected to a version 9.0.2(or higher) Oracle Server and you attempted to use a database link pointing to a version 9.0.1(or lower) Oracle Server for distributed autonomous transaction.
Action:
For the above causes: 1) Do not use the invalid OCI operation. 2) If you do not wish to use encrypted connect passwords in your distributed database, set ORA_ENCRYPT_LOGIN to FALSE. If you wish to use encrypted connect passwords, you must upgrade all Oracle Servers to version 7.1 (or higher). 3) If you do not wish to use encrypted database links in your distributed database, set DBLINK_ENCRYPT_LOGIN to FALSE. If you wish to use encrypted database links, you must upgrade all Oracle Servers to version 7.1 (or higher). 4) Do not attempt distributed autonomous transaction on version 9.0.1(or lower) Oracle Server.
This makes no sense to me because I am using the more recent JDBC drivers and a pretty current version of Oracle. If the issue was the login why would it work about 90-95% and not the other 5-10%? I have ensured that all of the Oracle Servers are 11g. I also put up the ORA-01010 info so that anyone who tries to answer this can avoid doing it, thinking they found the answer. Unless you can interpret this seemingly cryptic message that does not appear to have much to do with my issue, don't bother.
Update based on comments below:
Here is the exact error:
Exception in thread "main" org.springframework.jdbc.UncategorizedSQLException: PreparedStatementCallback; uncategorized SQLException for SQL [select sum(FREQ) from CONTRIBUTOR_DETL where EXTRACT(MONTH FROM DOS) BETWEEN 6 and 8 and CONTRIBUTOR_HDR_ID = ? and ERROR_FOUND = 'N']; SQL state [72000]; error code [1010]; ORA-01010: invalid OCI operation
; nested exception is java.sql.SQLException: ORA-01010: invalid OCI operation
at org.springframework.jdbc.support.AbstractFallbackSQLExceptionTranslator.translate(AbstractFallbackSQLExceptionTranslator.java:83)
at org.springframework.jdbc.support.AbstractFallbackSQLExceptionTranslator.translate(AbstractFallbackSQLExceptionTranslator.java:80)
at org.springframework.jdbc.support.AbstractFallbackSQLExceptionTranslator.translate(AbstractFallbackSQLExceptionTranslator.java:80)
at org.springframework.jdbc.core.JdbcTemplate.execute(JdbcTemplate.java:602)
at org.springframework.jdbc.core.JdbcTemplate.query(JdbcTemplate.java:636)
at org.springframework.jdbc.core.JdbcTemplate.query(JdbcTemplate.java:665)
at org.springframework.jdbc.core.JdbcTemplate.query(JdbcTemplate.java:673)
at org.springframework.jdbc.core.JdbcTemplate.queryForObject(JdbcTemplate.java:728)
at org.springframework.jdbc.core.JdbcTemplate.queryForObject(JdbcTemplate.java:744)
at org.springframework.jdbc.core.JdbcTemplate.queryForInt(JdbcTemplate.java:775)
at org.ddpa.dsc.dao.impl.DscSummaryDaoImpl.getAcceptedOccurrencesBySummerQuarter(DscSummaryDaoImpl.java:176)
at org.ddpa.dsc.reports.DscSummaryReport.getSummaryReport(DscSummaryReport.java:132)
at org.ddpa.dsc.pre.DscPreprocessor.preprocessFile(DscPreprocessor.java:195)
at org.ddpa.dsc.Main.main(Main.java:33)
Caused by: java.sql.SQLException: ORA-01010: invalid OCI operation
at oracle.jdbc.driver.SQLStateMapping.newSQLException(SQLStateMapping.java:70)
at oracle.jdbc.driver.DatabaseError.newSQLException(DatabaseError.java:133)
at oracle.jdbc.driver.DatabaseError.throwSqlException(DatabaseError.java:206)
at oracle.jdbc.driver.T4CTTIoer.processError(T4CTTIoer.java:455)
at oracle.jdbc.driver.T4CTTIoer.processError(T4CTTIoer.java:413)
at oracle.jdbc.driver.T4C8Oall.receive(T4C8Oall.java:1034)
at oracle.jdbc.driver.T4CPreparedStatement.doOall8(T4CPreparedStatement.java:194)
at oracle.jdbc.driver.T4CPreparedStatement.executeForDescribe(T4CPreparedStatement.java:791)
at oracle.jdbc.driver.T4CPreparedStatement.executeMaybeDescribe(T4CPreparedStatement.java:866)
at oracle.jdbc.driver.OracleStatement.doExecuteWithTimeout(OracleStatement.java:1186)
at oracle.jdbc.driver.OraclePreparedStatement.executeInternal(OraclePreparedStatement.java:3387)
at oracle.jdbc.driver.OraclePreparedStatement.executeQuery(OraclePreparedStatement.java:3431)
at oracle.jdbc.driver.OraclePreparedStatementWrapper.executeQuery(OraclePreparedStatementWrapper.java:1491)
at sun.reflect.GeneratedMethodAccessor15.invoke(Unknown Source)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
at java.lang.reflect.Method.invoke(Method.java:597)
at oracle.ucp.jdbc.proxy.PreparedStatementProxyFactory.invoke(PreparedStatementProxyFactory.java:110)
at $Proxy3.executeQuery(Unknown Source)
at org.springframework.jdbc.core.JdbcTemplate$1.doInPreparedStatement(JdbcTemplate.java:643)
at org.springframework.jdbc.core.JdbcTemplate.execute(JdbcTemplate.java:586)
I used to see this error when I try to access/write some clob column. I believe it's a bug of oracle itself and it won't happen all the time. After we upgraded to 12, this problem was gone.
But at least you should be able to catch the exception and identify which sql statement cause the problem.