If your ODP.NET app encounters an ORA-50201 exception and your organization uses a large Kerberos realm hierarchy, your session data unit (SDU) packet size may be too small. This could be Oracle database bug 38900449. Increasing the SDU size could resolve this issue.
In Oracle Database 19c, the default is 8192 bytes (8 KB). Increase this to 16,384 (16 KB) or higher. Keep in mind that there is an ODP.NET SDU setting as well. In 26ai, its default value is 65536 (64 KB). Keep the client side setting equal to or higher than the database SDU setting.
To definitively identify this issue, the error will output the following stack trace:
ORA-50201: Oracle Communication: Failed to connect to server or failed to parse connect string
---> OracleInternal.Network.NetworkException (0x00003157)
at OracleInternal.Network.Ano.KerberosHandshake(AuthenticationService AS, String KRB5Conf, String KRB5CCName, SqlNetOraConfig SNOConfig)
at OracleInternal.Network.Ano.StartNegotiation()
at OracleInternal.Network.OracleCommunication.SendConnectPacketAndProcessResponse(AddressResolution addrRes, Boolean bAsync)
at OracleInternal.Network.OracleCommunication.ConnectViaCO(ConnectionOption connOption, AddressResolution addrRes, Boolean bAsync)
at OracleInternal.Network.OracleCommunication.DoConnect(String tnsDescriptor, Boolean bAsync)
at OracleInternal.Network.OracleCommunication.Connect(String tnsDescriptor, Boolean doNAHandshake, String IName, ConnectionOption CO, Boolean bAsync)
at OracleInternal.ServiceObjects.OracleConnectionImpl.Connect(ConnectionString cs, Boolean bOpenEndUserSession, OracleConnection connRefForCriteria, String instanceName, Boolean bAsync)
In the stack trace, an ORA-12631 error inner exception manifests as a network error code, 0x00003157. This is indicative of Bug 38900449.
This error code may not always appear in the stack trace. You can alternatively confirm the same bug by enabling ODP.NET tracing at level 7 for managed ODP.NET and ODP.NET Core. In the trace, you would see the following output right before the ORA-50201 exception:
<DATE> 17:23:45.913828 TID:4 (NET) (REC) (CID1) Packet.receive()
data length = 31
<DATE> 17:23:45.913940 TID:4 (NET) (REC) (CID1) 00 00 00 1F 06 20 00 00 |..... ..|
<DATE> 17:23:45.913963 TID:4 (NET) (REC) (CID1) 00 00 DE AD BE EF 00 15 |........|
<DATE> 17:23:45.913984 TID:4 (NET) (REC) (CID1) 00 00 00 00 00 01 01 00 |........|
<DATE> 17:23:45.914004 TID:4 (NET) (REC) (CID1) 01 00 00 00 00 31 57 |.....1W |
Note the last line containing the same error code info, 01 00 00 00 00 31 57.