我对以上内容感到困惑,每当我在新的Oracle安装中执行包中的存储过程时,它会间歇性地出现。
从WCF调用sproc,它返回以下异常:
<ExceptionDetail xmlns="http://schemas.datacontract.org/2004/07/System.ServiceModel" xmlns:i="http://www.w3.org/2001/XMLSchema-instance">
<HelpLink i:nil="true"/>
<InnerException>
<HelpLink i:nil="true"/>
<InnerException i:nil="true"/>
<Message>ORA-12537: Network Session: End of file</Message>
<StackTrace><![CDATA[at OracleInternal.Network.ReaderStream.Read(OraBuf OB)
at OracleInternal.TTC.OraBufReader.GetDataFromNetwork()
at OracleInternal.TTC.OraBufReader.Read(Boolean bIgnoreData)
at OracleInternal.TTC.MarshallingEngine.UnmarshalUB1(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)]]></StackTrace>
<Type>OracleInternal.Network.NetworkException</Type>
</InnerException>
<Message>ORA-12537: Network Session: End of file</Message>
<StackTrace><![CDATA[at Oracle.ManagedDataAccess.Client.OracleException.HandleError(OracleTraceLevel level, OracleTraceTag tag, 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 System.Data.Common.DataAdapter.FillLoadDataRow(SchemaMapping mapping)
at System.Data.Common.DataAdapter.FillFromReader(DataSet dataset, DataTable datatable, String srcTable, DataReaderContainer dataReader, Int32 startRecord, Int32 maxRecords, DataColumn parentChapterColumn, Object parentChapterValue)
at System.Data.Common.DataAdapter.Fill(DataSet dataSet, String srcTable, IDataReader dataReader, Int32 startRecord, Int32 maxRecords)
at Oracle.ManagedDataAccess.Client.OracleDataAdapter.Fill(DataSet dataSet, String srcTable, IDataReader dataReader, Int32 startRecord, Int32 maxRecords)
at Oracle.ManagedDataAccess.Client.OracleDataAdapter.Fill(DataSet dataSet, Int32 startRecord, Int32 maxRecords, String srcTable, IDbCommand command, CommandBehavior behavior)
at System.Data.Common.DbDataAdapter.Fill(DataSet dataSet)
at ***REDACTED***
at ***REDACTED***
at ***REDACTED***
at SyncInvokeQtyAdjustments_Get(Object , Object[] , Object[] )
at System.ServiceModel.Dispatcher.SyncMethodInvoker.Invoke(Object instance, Object[] inputs, Object[]& outputs)
at System.ServiceModel.Dispatcher.DispatchOperationRuntime.InvokeBegin(MessageRpc& rpc)
at System.ServiceModel.Dispatcher.ImmutableDispatchRuntime.ProcessMessage5(MessageRpc& rpc)
at System.ServiceModel.Dispatcher.ImmutableDispatchRuntime.ProcessMessage41(MessageRpc& rpc)
at System.ServiceModel.Dispatcher.ImmutableDispatchRuntime.ProcessMessage4(MessageRpc& rpc)
at System.ServiceModel.Dispatcher.ImmutableDispatchRuntime.ProcessMessage31(MessageRpc& rpc)
at System.ServiceModel.Dispatcher.ImmutableDispatchRuntime.ProcessMessage3(MessageRpc& rpc)
at System.ServiceModel.Dispatcher.ImmutableDispatchRuntime.ProcessMessage2(MessageRpc& rpc)
at System.ServiceModel.Dispatcher.ImmutableDispatchRuntime.ProcessMessage11(MessageRpc& rpc)
at System.ServiceModel.Dispatcher.ImmutableDispatchRuntime.ProcessMessage1(MessageRpc& rpc)
at System.ServiceModel.Dispatcher.MessageRpc.Process(Boolean isOperationContextSet)]]></StackTrace>
<Type>Oracle.ManagedDataAccess.Client.OracleException</Type>
</ExceptionDetail>
它似乎也不是一种模式 - 有时它工作正常,有时它不会。
这是我尝试过的东西:
确保在通用代码中处理对象。这是目前使用的测试代码:
using System.Data;
using System.Data.Common;
using Oracle.ManagedDataAccess.Client;
/// <summary>
/// Extensions for xxxxx.
/// </summary>
/// <seealso cref="System.Data.Entity.DbContext" />
public partial class xxxxEntities
{
public virtual DataSet ExecuteStoredProcedureAsDataSet(string storedProcName, int commandTimeoutSeconds, object[] parameters)
{
var sqlCommand = this.Database.Connection.CreateCommand();
var resultSet = new DataSet();
sqlCommand.CommandType = CommandType.StoredProcedure;
sqlCommand.CommandTimeout = commandTimeoutSeconds;
sqlCommand.CommandText = storedProcName;
sqlCommand.Parameters.AddRange(parameters);
var referenceCursor = new OracleParameter("P_DATAOUT", OracleDbType.RefCursor)
{
Direction = ParameterDirection.Output
};
sqlCommand.Parameters.Add(referenceCursor);
using (var adapter = CreateDataAdapter(this.Database.Connection))
{
adapter.SelectCommand = sqlCommand;
adapter.Fill(resultSet);
}
referenceCursor.Dispose();
sqlCommand.Dispose();
return resultSet;
}
/// <summary>
/// Creates the data adapter.
/// </summary>
/// <param name="connection">The connection.</param>
/// <returns>DbDataAdapter.</returns>
DbDataAdapter CreateDataAdapter(DbConnection connection)
{
return DbProviderFactories.GetFactory(connection).CreateDataAdapter();
}
}
将存储过程中的查询减少到“已修复”状态。值 - 确保在sproc中没有任何内容导致问题。我确实发现了下面描述的一些有趣的问题。
所以,我不知所措。我打开了ODP跟踪 - 并注意到在处理池时似乎遇到了问题。第一次,我得到了这个:
2016-07-26 11:43:55.268765 TID:6 (PRI) (SVC) (ENT) OracleConnectionImpl.EvaluateDbMajorMinorPatchsetVersion()
2016-07-26 11:43:55.268765 TID:6 (PRI) (SVC) (EXT) OracleConnectionImpl.EvaluateDbMajorMinorPatchsetVersion()
2016-07-26 11:43:55.268765 TID:6 (PRI) (SVC) (EXT) OracleConnectionImpl.Connect() (oper=open) (aff=n/a) (inst=WMSQA) (affmatch=n/a) (sessid=2540:42190) (F;F;F;WMSQA;N) (pmid=29382239)
2016-07-26 11:43:55.268765 TID:6 (PRI) (ENT) (CP) PoolManager`3.PutNewPR() (aff=n/a) (inst=WMSQA) (affmatch=n/a) (sessid=2540:42190) (F;F;F;WMSQA;N) (pmid=29382239)
2016-07-26 11:43:55.268765 TID:6 (PRI) (ENT) (CP) OraclePool.PutNewPR()
2016-07-26 11:43:55.268765 TID:6 (PRI) (ENT) (CP) Pool`3.PutNewPR()
2016-07-26 11:43:55.268765 TID:6 (PRI) (CP) Pool`3.PutNewPR() (oper=cp:put:reg1) (aff=n/a) (inst=WMSQA) (affmatch=n/a) (sessid=2540:42190) (F;F;T;WMSQA;N) (pmid=29382239)
2016-07-26 11:43:55.268765 TID:6 (PRI) (EXT) (CP) Pool`3.PutNewPR()
2016-07-26 11:43:55.268765 TID:6 (PRI) (EXT) (CP) OraclePool.PutNewPR()
2016-07-26 11:43:55.268765 TID:6 (PRI) (EXT) (CP) PoolManager`3.PutNewPR() (aff=n/a) (inst=WMSQA) (affmatch=n/a) (sessid=2540:42190) (F;F;T;WMSQA;N) (pmid=29382239)
2016-07-26 11:43:55.269765 TID:6 (PRI) (EXT) (CP) PoolManager`3.CreateNewPR() (aff=n/a) (inst=WMSQA) (affmatch=n/a) (sessid=2540:42190) (F;F;T;WMSQA;N) (pmid=29382239)
2016-07-26 11:43:55.269765 TID:6 (PRI) (CP) PoolManager`3.PopulatePool() PopulatePoolThreadFunc(created=2; max=25; total=3)
2016-07-26 11:43:55.269765 TID:6 (PRI) (EXT) (CP) PoolManager`3.PopulatePool()
2016-07-26 11:43:55.880826 TID:15 (PRI) (ENT) TTCExecuteSql.ReceiveExecuteResponse()
2016-07-26 11:43:55.881826 TID:15 (PRI) (ENT) OracleException.ctor()
2016-07-26 11:43:55.885826 TID:15 (PRI) (ENT) OracleError.ctor()
2016-07-26 11:43:55.886826 TID:15 (PRI) (EXT) OracleError.ctor()
2016-07-26 11:43:55.886826 TID:15 (PRI) (EXT) OracleException.ctor()
2016-07-26 11:43:55.890827 TID:15 (PRI) (TTC) (ERR) TTCExecuteSql.ReceiveExecuteResponse() (txnid=n/a) 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.MarshallingEngine.UnmarshalUB1(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)
将跟踪扩展到127,我刚刚得到了这个:
2016-07-26 14:22:11.459348 TID:1 (PRI) (SVC) (ENT) OracleDataReaderImpl.FetchMoreRows()
2016-07-26 14:22:11.459348 TID:1 (PRI) (SVC) (ENT) OracleConnectionImpl.AddAllPiggyBackRequests()
2016-07-26 14:22:11.459348 TID:1 (PRI) (TTC) (ENT) TTCClose.Write()
2016-07-26 14:22:11.460348 TID:1 (PRI) (TTC) (ENT) TTCFunction.WriteFunctionHeader()
2016-07-26 14:22:11.460348 TID:1 (PRI) (TTC) (ENT) TTCMessage.WriteTTCCode()
2016-07-26 14:22:11.460348 TID:1 (PRI) (TTC) (EXT) TTCMessage.WriteTTCCode()
2016-07-26 14:22:11.460348 TID:1 (PRI) (TTC) (EXT) TTCFunction.WriteFunctionHeader()
2016-07-26 14:22:11.460348 TID:1 (PRI) (TTC) (EXT) TTCClose.Write()
2016-07-26 14:22:11.460348 TID:1 (PRI) (SVC) (EXT) OracleConnectionImpl.AddAllPiggyBackRequests()
2016-07-26 14:22:11.460348 TID:1 (PRI) (TTC) (ENT) TTCExecuteSql.SendExecuteRequest()
2016-07-26 14:22:11.460348 TID:1 (PRI) (TTC) (ENT) TTCExecuteSql.GetExecuteOptions()
2016-07-26 14:22:11.460348 TID:1 (PRI) (TTC) (EXT) TTCExecuteSql.GetExecuteOptions()
2016-07-26 14:22:11.460348 TID:1 (PRI) (TTC) (ENT) TTCExecuteSql.WriteOall8Message()
2016-07-26 14:22:11.460348 TID:1 (PRI) (TTC) (ENT) TTCFunction.WriteFunctionHeader()
2016-07-26 14:22:11.460348 TID:1 (PRI) (TTC) (ENT) TTCMessage.WriteTTCCode()
2016-07-26 14:22:11.460348 TID:1 (PRI) (TTC) (EXT) TTCMessage.WriteTTCCode()
2016-07-26 14:22:11.460348 TID:1 (PRI) (TTC) (EXT) TTCFunction.WriteFunctionHeader()
2016-07-26 14:22:11.460348 TID:1 (PRI) (TTC) (ENT) TTCExecuteSql.WritePisdef()
2016-07-26 14:22:11.460348 TID:1 (PRI) (TTC) (EXT) TTCExecuteSql.WritePisdef()
2016-07-26 14:22:11.460348 TID:1 (PRI) (TTC) (ENT) TTCExecuteSql.WritePisdefData()
2016-07-26 14:22:11.461348 TID:1 (PRI) (TTC) (EXT) TTCExecuteSql.WritePisdefData()
2016-07-26 14:22:11.461348 TID:1 (NET) (SND) 00 4C 00 00 06 00 00 00 |.L......|
2016-07-26 14:22:11.461348 TID:1 (NET) (SND) 00 00 |.. |
2016-07-26 14:22:11.461348 TID:1 (NET) (SND) 11 69 00 01 01 01 01 02 |.i......|
2016-07-26 14:22:11.461348 TID:1 (NET) (SND) 03 5E 00 02 80 40 01 03 |.^...@..|
2016-07-26 14:22:11.461348 TID:1 (NET) (SND) 00 00 01 01 0D 00 00 00 |........|
2016-07-26 14:22:11.461348 TID:1 (NET) (SND) 00 01 01 00 00 00 00 00 |........|
2016-07-26 14:22:11.461348 TID:1 (NET) (SND) 00 00 00 00 00 00 01 00 |........|
2016-07-26 14:22:11.461348 TID:1 (NET) (SND) 00 00 00 00 00 00 00 00 |........|
2016-07-26 14:22:11.461348 TID:1 (NET) (SND) 02 01 36 00 00 00 03 A7 |..6.....|
2016-07-26 14:22:11.461348 TID:1 (NET) (SND) EB C6 00 01 01 00 00 00 |........|
2016-07-26 14:22:11.461348 TID:1 (NET) (SND) 00 00 |.. |
2016-07-26 14:22:11.461348 TID:1 (PRI) (TTC) (EXT) TTCExecuteSql.WriteOall8Message()
2016-07-26 14:22:11.461348 TID:1 (PRI) (TTC) (EXT) TTCExecuteSql.SendExecuteRequest()
2016-07-26 14:22:11.461348 TID:1 (PRI) (TTC) (ENT) TTCExecuteSql.ReceiveExecuteResponse()
2016-07-26 14:22:11.461348 TID:1 (PRI) (BUF) (COBP.GET) (poolid:2) (key:8192) (bufid:8) (count:5) (OraBufReader.GetDataFromNetwork)
2016-07-26 14:22:12.161348 TID:1 (PRI) (ENT) TTCExecuteSql.ReceiveExecuteResponse()
2016-07-26 14:22:12.162348 TID:1 (PRI) (ENT) OracleException.ctor()
2016-07-26 14:22:12.162348 TID:1 (PRI) (ENT) OracleError.ctor()
2016-07-26 14:22:12.162348 TID:1 (PRI) (EXT) OracleError.ctor()
2016-07-26 14:22:12.162348 TID:1 (PRI) (EXT) OracleException.ctor()
2016-07-26 14:22:12.163348 TID:1 (PRI) (TTC) (ERR) TTCExecuteSql.ReceiveExecuteResponse() (txnid=n/a) 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.MarshallingEngine.UnmarshalUB1(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)
2016-07-26 14:22:12.163348 TID:1 (PRI) (EXT) TTCExecuteSql.ReceiveExecuteResponse()
2016-07-26 14:22:12.163348 TID:1 (PRI) (TTC) (EXT) TTCExecuteSql.ReceiveExecuteResponse()
2016-07-26 14:22:12.163348 TID:1 (PRI) (ENT) OracleDataReaderImpl.FetchMoreRows()
2016-07-26 14:22:12.163348 TID:1 (PRI) (SVC) (ERR) OracleDataReaderImpl.FetchMoreRows() (txnid=n/a) Oracle.ManagedDataAccess.Client.OracleException (0x80004005): ORA-12537: Network Session: End of file ---> OracleInternal.Network.NetworkException (0x000030F9): ORA-12537: Network Session: End of file
我通过注释掉select语句和where子句来调整sproc中的查询,并逐步将它们重新引入以查看它是否是问题的查询(在Oracle Developer中运行它的工作原理)不过很好)。我已将其缩小到此声明 - 如果我重新引入它,我会再次收到文件结束异常:
WHERE
-- Only handle records that contain a numeric value in the ref field.
ISNUMERIC(PTT.REF_FIELD_2) = 1
这是ISNUMERIC函数在包中的样子;
FUNCTION ISNUMERIC (p_string IN VARCHAR2) RETURN INT
IS
v_new_num NUMBER;
BEGIN
IF p_string IS NULL
THEN
RETURN 0;
END IF;
v_new_num := TO_NUMBER(p_string);
RETURN 1;
EXCEPTION
WHEN VALUE_ERROR THEN
RETURN 0;
END ISNUMERIC;
起初我认为可能是由于异常数量而导致阻止进一步执行的异常数量。但是我将功能简化为只返回&#39; 1&#39;它每次都不起作用。
查询结果通过ref游标传回,例如
PROCEDURE DEVSP_API_GETxxxx(
P_STARTDATE IN DATE
, P_ENDDATE IN DATE
, P_xxx IN P_xxx_TYPE
, <snip>
, P_DATAOUT OUT sys_refcursor
) AS
BEGIN
OPEN P_DATAOUT FOR
SELECT
'asdsa' as "x",
'sadasdsad' as "z",
0 as "Qty",
<snip>
最后,我从select语句和where子句中删除了所有函数调用 - 并立即停止发生错误 - 我用函数运行的相同逻辑替换它们 - 只是在SELECT和WHERE语句中内联。 / p>
那是怎么回事?在包含函数调用的包中运行sprocs时,ODP.net是否有限制?似乎有点奇怪。
解决方法是不使用函数,但我不想这样做,因为一些select语句中有条件表达式,它们在基于联合的查询中重复相同的逻辑。
非常感谢任何帮助或指示!
聚苯乙烯。为了透明,我上周在Oracle论坛上发布了这个,但没有回复。
更新:2016年8月3日
最后设法访问服务器以尝试一些跟踪。以下是过程结束时跟踪日志中出现的内容:
*** 2016-08-03 10:14:39.111
*** SESSION ID:(2526.53330) 2016-08-03 10:14:39.111
*** CLIENT ID:() 2016-08-03 10:14:39.111
*** SERVICE NAME:(XXXXX) 2016-08-03 10:14:39.111
*** MODULE NAME:(iisexpress.exe) 2016-08-03 10:14:39.111
*** CLIENT DRIVER:(ODPM.NET) 2016-08-03 10:14:39.111
*** ACTION NAME:() 2016-08-03 10:14:39.111
Exception [type: SIGSEGV, Address not mapped to object] [ADDR:0x0] [PC:0x3CEBE1D, pmucfst()+13] [flags: 0x0, count: 1]
Incident 109041 created, dump file /u01/app/oracle/diag/rdbms/xxxx/XXXX/incident/incdir_109041/XXXXX_ora_13149_i109041.trc
ORA-07445: exception encountered: core dump [pmucfst()+13] [SIGSEGV] [ADDR:0x0] [PC:0x3CEBE1D] [Address not mapped to object] []
ssexhd: crashing the process...
Shadow_Core_Dump = PARTIAL
我还可以在同一个文件夹中看到核心转储。我已经尝试在那里点击存储桶跟踪文件,看看是否有任何明显的东西 - 但说实话,当你不知道自己是什么时,很难找到什么东西?#39 ;正在寻找!
我可以看到以前使用函数时运行sprocs的核心转储的大量转储 - 所以它至少是合理的一致。
答案 0 :(得分:1)
我遇到了同样的问题。 Oracle Support回复:
看起来你正在攻击Bug 18191823 - Hang / ORA-600 [19708]等。引用陈旧的REFCURSOR绑定(Doc ID 18191823.8)
解决方法
确保绑定的PL / SQL变量的持续时间至少与绑定到的ref游标的持续时间一样长。
此修复程序首先包含在2016年7月的修补程序中。