ORA-03146 error when writing LOB to database
Platform notice: Server and Data Center only. This article only applies to Atlassian products on the Server and Data Center platforms.
Support for Server* products ended on February 15th 2024. If you are running a Server product, you can visit the Atlassian Server end of support announcement to review your migration options.
*Except Fisheye and Crucible
Summary
Bitbucket logs show Oracle database errors ORA-03146. This happens during some Bitbucket actions when LOB are written to the DB. This could be a Bitbucket or a Bitbucket App action.
Environment
Bitbucket with Oracle DB.
Diagnosis
Intermittently log example will be written.
2021-08-05 02:00:00,000 ERROR [https-jsse-nio-8443-exec-13] dlaser *6AWPZZx176x11152085x4 10.1.1.1 "POST /rest/... HTTP/1.1" c.a.p.r.c.e.j.ThrowableExceptionMapper Uncaught exception thrown by REST service: JDBC exception on Hibernate data access: SQLException for SQL [update plugin_setting set key_value=? where id=?]; SQL state [63000]; error code [3146]; could not execute batch; nested exception is org.hibernate.exception.GenericJDBCException: could not execute batch
org.springframework.orm.hibernate5.HibernateJdbcException: JDBC exception on Hibernate data access: SQLException for SQL [update plugin_setting set key_value=? where id=?]; SQL state [63000]; error code [3146]; could not execute batch; nested exception is org.hibernate.exception.GenericJDBCException: could not execute batch
at org.springframework.orm.hibernate5.SessionFactoryUtils.convertHibernateAccessException(SessionFactoryUtils.java:252)
Caused by: oracle.jdbc.OracleDatabaseException: ORA-03146: invalid buffer length for TTC field
...
Caused by: java.sql.BatchUpdateException: ORA-03146: invalid buffer length for TTC field
at oracle.jdbc.driver.OraclePreparedStatement.executeLargeBatch(OraclePreparedStatement.java:10032)
at oracle.jdbc.driver.T4CPreparedStatement.executeLargeBatch(T4CPreparedStatement.java:1364)
at oracle.jdbc.driver.OraclePreparedStatement.executeBatch(OraclePreparedStatement.java:9839)
at oracle.jdbc.driver.OracleStatementWrapper.executeBatch(OracleStatementWrapper.java:234)
at com.zaxxer.hikari.pool.ProxyStatement.executeBatch(ProxyStatement.java:128)
at com.zaxxer.hikari.pool.HikariProxyPreparedStatement.executeBatch(HikariProxyPreparedStatement.java)
at org.hibernate.engine.jdbc.batch.internal.BatchingBatch.performExecution(BatchingBatch.java:119)
... 79 common frames omitted
Next exception: java.sql.SQLException: ORA-03146: invalid buffer length for TTC field
at oracle.jdbc.driver.T4CTTIoer11.processError(T4CTTIoer11.java:494)
at oracle.jdbc.driver.T4CTTIoer11.processError(T4CTTIoer11.java:446)
...
at java.lang.Thread.run(Thread.java:748)
Caused by: oracle.jdbc.OracleDatabaseException: ORA-03146: invalid buffer length for TTC field
at oracle.jdbc.driver.T4CTTIoer11.processError(T4CTTIoer11.java:498)
... 383 common frames omitted
Solution
This is an Oracle 19c Database issue particularly if you have upgraded the DB from Oracle 12. Please upgrade the Oracle Database to patch level 30955880 or better: Oracle KB article.