“ORA-03146: invalid buffer length for TTC field” after upgrade from Oracle 12 to 19c

oracleupgrade

We are experiencing problems with updating a table record BLOB column. We get the "ORA-03146: invalid buffer length for TTC field" error. We basically are saving e.g. PDF attachments to the DB. The problem occurred after the upgrade from Oracle 12.0.1.2 to 19c (19.3.0.0), now the error is occurring on a larger scale. We have a .Net application, connecting to Oracle through ODP.NET (Oracle.DataAccess) and using NHibernate. We have done an upgrade from Oracle 12.1.0.2 to Oracle 19.3.0.0 using DBUA and the DB server is on Windows 2012 platform.

The error occurs after executing the command: {OpsSqlPrepare2(): SQL: UPDATE SIRIUS.Attachment SET Request = :p0, LOANREQUEST = :p1, ARCHIVE = :p2, FILENAME = :p3, FILESIZE = :p4, BINARYCONTENT = :p5, ATTACHMENTTABLE = :p6, ATTACHMENTTYPE = :p7, NOTE = :p8, MIMETYPE = :p9, CUSTOMID = :p10, ISEXTERNAL = :p11, ISSEND = :p12, DocumentNameDial = :p13, DOCUMENTENUMTYPE = :p14, AttachmentTypeDial = :p15 WHERE ID = :p16}

BINARYCONTENT is a BLOB column.

The error is different from the two environments we have:

Oracle DB 19c/Oracle client 19c – ORA-03146: invalid buffer length for TTC field

Oracle DB 19c/Oracle client 12 – ORA-03138: Connection terminated due to security policy violation

Best Answer

JDBC application fails with ORA-03146: Invalid Buffer Length For TTC Field After Database Upgrade to 19c (Doc ID 2729562.1)

Updating a 12c database to 19.6 can result in this issue. In this particular case, the database was upgraded from 12.1.0.2.

The ORA-3137 [3146] is a protocol exception which means that the database has not consumed all the data from the user buffer for the long bind.

This issue is addressed in Bug:30955880 - ORA-3137 [3146] [4] / ORA-3137 [3146] [94] UPDATING LOB WITH LARGE BIND which was closed as duplicate of unpublished Bug 31625618 - DML OVER A LOB COLUMN USING LONG BIND FAILS WITH AN ORA-3137 [3146] ERROR WHEN THE BIND SIZE IS > 256K BYTES.

Then:

Bug 31625618 - DML Over a LOB Column Using Long Bind Fails with ORA-3137 [3146] [4] / ORA-3137 [3146] [94] When the Bind Size is > 256k Bytes (Doc ID 31625618.8)

Clients (JDBC/OCI) performing DML's on a LOB column intermittently fail with the below errors, when the bind length is > 256k bytes: ORA-03137: malformed TTC packet from client rejected: [3146] [4] ORA-03137: malformed TTC packet from client rejected: [3146] [94]
ORA-03146: invalid buffer length for TTC field

I quoted this part to highlight that this issue was not specific to JDBC.

Fix for Bug 31625618 exists as a oneoff patch for 19c versions below 19.10.

The bug is fixed in database version 19.10, which will be released next week.

Currently you are on 19.3. Apply the necessary patches.