我们已经成功使用Oracle ManagedDataAccess 4.122.1.0很长一段时间了。升级到Oracle ManagedDataAccess 4.122.18.3后,一些SQL查询运行良好,但一些SQL查询开始不断导致ORA-12537错误:
Oracle.ManagedDataAccess.Client.OracleException (0x80004005): ORA-12537: Network Session: End of file ---> OracleInternal.Network.NetworkException (0x000030F9): ORA-12537: Network Session: End of file
at OracleInternal.Network.ReaderStream.Read(OraBuf OB)
at OracleInternal.TTC.OraBufReader.GetDataFromNetwork()
at OracleInternal.TTC.OraBufReader.Read(Boolean bIgnoreData)
at OracleInternal.TTC.TTCExecuteSql.ReceiveExecuteResponse(Accessor[]& defineAccessors, Accessor[] bindAccessors, Boolean bHasReturningParams, SQLMetaData& sqlMetaData, SqlStatementType statementType, Int64 noOfRowsFetchedLastTime, Int32 noOfRowsToFetch, Int32& noOfRowsFetched, Int64& queryId, Int32 longFetchSize, Int64 initialLOBFetchSize, Int64[] scnFromExecution, Boolean bAllInputBinds, Int32 arrayBindCount, DataUnmarshaller& dataUnmarshaller, MarshalBindParameterValueHelper& marshalBindParamsHelper, Int64[]& rowsAffectedByArrayBind, Boolean bDefineDone, Boolean& bMoreThanOneRowAffectedByDmlWithRetClause, List`1& implicitRSList, Boolean bLOBArrayFetchRequired)
at Oracle.ManagedDataAccess.Client.OracleException.HandleError(OracleTraceLevel level, OracleTraceTag tag, OracleTraceClassName className, OracleTraceFuncName funcName, Exception ex, OracleLogicalTransaction oracleLogicalTransaction)
at OracleInternal.TTC.TTCExecuteSql.ReceiveExecuteResponse(Accessor[]& defineAccessors, Accessor[] bindAccessors, Boolean bHasReturningParams, SQLMetaData& sqlMetaData, SqlStatementType statementType, Int64 noOfRowsFetchedLastTime, Int32 noOfRowsToFetch, Int32& noOfRowsFetched, Int64& queryId, Int32 longFetchSize, Int64 initialLOBFetchSize, Int64[] scnFromExecution, Boolean bAllInputBinds, Int32 arrayBindCount, DataUnmarshaller& dataUnmarshaller, MarshalBindParameterValueHelper& marshalBindParamsHelper, Int64[]& rowsAffectedByArrayBind, Boolean bDefineDone, Boolean& bMoreThanOneRowAffectedByDmlWithRetClause, List`1& implicitRSList, Boolean bLOBArrayFetchRequired)
at OracleInternal.ServiceObjects.OracleDataReaderImpl.FetchMoreRows(Int32 noOfRowsToFetch, Boolean fillReader, Boolean returnPSTypes)
at Oracle.ManagedDataAccess.Client.OracleDataReader.Read()
at NHibernate.Loader.Loader.DoQuery(ISessionImplementor session, QueryParameters queryParameters, Boolean returnProxies, IResultTransformer forcedResultTransformer)
at NHibernate.Loader.Loader.DoQueryAndInitializeNonLazyCollections(ISessionImplementor session, QueryParameters queryParameters, Boolean returnProxies, IResultTransformer forcedResultTransformer)
at NHibernate.Loader.Loader.DoList(ISessionImplementor session, QueryParameters queryParameters, IResultTransformer forcedResultTransformer)
此类查询的示例如下(由NHibernate生成(:
select
ID1_87_0_,
...
from
(
select
NODEENTITY0_.ID as ID1_87_0_,
...
from
NODES NODEENTITY0_
left outer join DIVISIONS DIVISIONEN1_
on NODEENTITY0_.IDDIV = DIVISIONEN1_.ID
left outer join CONTRACTS CONTRACTEN2_
on NODEENTITY0_.IDCONTRACT = CONTRACTEN2_.ID
left outer join ABONENTS ABONENTENT3_
on CONTRACTEN2_.IDABONENT = ABONENTENT3_.ID
left outer join WATERWAYS WATERWAYEN4_
on CONTRACTEN2_.IDWATERWAY = WATERWAYEN4_.ID
left outer join WARRANTY WARRANTYEN5_
on NODEENTITY0_.IDWARRANTYLAST = WARRANTYEN5_.ID
and NODEENTITY0_.IDDIV = WARRANTYEN5_.IDDIVISION
left outer join SERVICECENTER SERVICECEN6_
on WARRANTYEN5_.ID_SERVICECENTER = SERVICECEN6_.ID
left outer join PUS PUENTITY7_
on NODEENTITY0_.IDPULAST = PUENTITY7_.ID
left outer join TPPUS TPPUENTITY8_
on PUENTITY7_.IDTPPU = TPPUENTITY8_.ID
order by
NODEENTITY0_.ID asc
)
where
ROWNUM <= :P0;
使用Oracle ManagedDataAccess 4.122.1.0执行完全相同的SQL查询,没有出现任何错误。
我们对Oracle ManagedDataAccess 4.122.18.3做错了什么
技术细节:
- 未安装ODAC
- .Net Framework版本为4.7
- NHibernate版本为5.1.2
- Oracle数据库为10.2
我修复了从nuget for Oracle Database 10g引用Oracle.DataAccess时的问题。
Check System Requirements for ODP.NET Managed Driver,Release 18
Oracle Data Provider for.NET,Managed Driver需要以下内容:
与ODP.NET相同的Windows操作系统支持,非托管驱动程序。
ODP.NET,托管驱动程序是用AnyCPU构建的。它运行在32位或64位(x64(Windows上,以及32位或64bit(x64(上.NET框架。
Microsoft.NET Framework 4.5.2、4.6.x或4.7.x
访问Oracle Database 11g Release 2或更高版本
如您所见,ODP.NET托管驱动程序18版不再支持Oracle Database 10.2。升级您的数据库(10.2版本大约有15年的历史(
对于ODP.NET托管驱动程序,Release 12.2系统要求中写道:
- 访问Oracle Database 10g Release 2或更高版本