Oracle ManagedDataAccess 4.122.18.3针对某些SQL查询获取了ORA-12537

时间:2018-11-22 06:23:32

标签: oracle driver managed

我们很长时间以来一直成功使用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完全相同地执行SQ​​L查询。

我们使用Oracle ManagedDataAccess 4.122.18.3有什么问题?

技术细节:

  • 未安装ODAC
  • .Net Framework版本是4.7
  • NHibernate版本是5.1.2
  • Oracle数据库是10.2

2 个答案:

答案 0 :(得分:0)

检查System Requirements中的ODP.NET托管驱动程序,版本18

  

用于.NET的Oracle数据提供程序,托管驱动程序需要以下内容:

     
      
  • 与ODP.NET(非托管驱动程序)具有相同的Windows操作系统支持。

  •   
  • ODP.NET,托管驱动程序是使用AnyCPU构建的。它可以在32位或64位(x64)Windows上以及32位或64位(x64)上运行   .NET Framework。

  •   
  • Microsoft .NET Framework 4.5.2、4.6.x或4.7.x。

  •   
  • 对Oracle Database 11g第2版或更高版本的访问权限

  •   

如您所见,ODP.NET托管驱动程序第18版不再支持Oracle Database 10.2。升级数据库(版本10.2已有15年的历史了)

对于ODP.NET托管驱动程序,版本12.2 System Requirements说:

  
      
  • 访问Oracle数据库10g第2版或更高版本
  •   

答案 1 :(得分:0)

当我从nuget引用Oracle数据库10g时解决了我的问题。