1

当我的应用程序仅部署在服务器上时,而不是在我的本地计算机上运行完全相同的可执行文件时,我收到以下 oracle 错误:

在此处输入图像描述

堆栈跟踪指向一个带有连接的简单选择语句,我可以通过本地TOAD和问题服务器上的SQL Plus成功执行该语句。

堆栈跟踪的上半部分是:

Oracle.DataAccess.Client.OracleException ORA-01002: fetch out of sequence
  at Oracle.DataAccess.Client.OracleException.HandleErrorHelper(Int32 errCode, OracleConnection conn, IntPtr opsErrCtx, OpoSqlValCtx* pOpoSqlValCtx, Object src, String procedure, Boolean bCheck)
  at Oracle.DataAccess.Client.OracleException.HandleError(Int32 errCode, OracleConnection conn, IntPtr opsErrCtx, Object src, Boolean bCheck)
  at Oracle.DataAccess.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(DataTable[] dataTables, IDataReader dataReader, Int32 startRecord, Int32 maxRecords)
  at System.Data.Common.LoadAdapter.FillFromReader(DataTable[] dataTables, IDataReader dataReader, Int32 startRecord, Int32 maxRecords)
  at System.Data.DataTable.Load(IDataReader reader, LoadOption loadOption, FillErrorEventHandler errorHandler)
  at Reconciliation.Models.Legacy.EntityDbEnvironment.OpenEntity(String sql)
  at Reconciliation.Models.Legacy.EntityDbEnvironment.Open(String& sql, DataTable& datatable)
**at myProject.Checks.ExecuteSql()**

我只能想象这是一个 oracle 客户端问题,但我应该在哪里解决这个问题?

4

1 回答 1

1

I had that issue too. My application was working fine on a machine, and the exact same executable on another machine was getting that fetch out of sequence exception.

My query is a big one which takes a few minutes to run. It is ran by a COM+. I realised that my two environments had a slightly different Component Services configuration. The failing environment had a transaction timeout set to 60s, the other one was set to much more.

To solve this I simply had to go to Component Services, right click on My Computer, Properties, Options, and increase the Transaction timeout.

It makes sense now as the fetch out of sequence exception is happening when you try to access a closed cursor. I understand that the COM+ timeout closed the transaction, therefore the cursor, and thrown that Oracle exception.

Picture of the property to update

于 2017-07-19T10:32:41.850 回答