4
我有以下程序:的TransactionScope和錯誤:ORA-02049
For j = 1 To NumItems
dbValueLookup.Load(j)
Using scope As New TransactionScope()
For i = firstIndex To lastIndex
'dbValueLookup is basically just a Dictionary of items already in the DB
If dbValueLookup.ContainsKey(i) Then
'updateData is a subroutine that updates this row with new data
updateData(j,i)
rowsUpdated = rowsUpdated + 1
dbValueLookup.Remove(i)
Else
'updateData is a subroutine that adds a new row to DB
addData(j,i)
rowsAdded = rowsAdded + 1
End If
Next
If dbValueLookup.Count = 0 Then
'This commits the transaction - records will be updated when End Using is reached
scope.Complete()
If rowsAdded + rowsUpdated > 0 Then
ShowMessage("Records Updated: " + rowsUpdated.ToString() + " Records Added: " + rowsAdded.ToString())
End If
Else
'We are left with data from the database that was not updated. This is a problem, so we don't "Complete" the scope.
'This will result in a rollback.
ShowWarningMessage("Incomplete Data for " + i.ToString())
End If
End Using
Next
運行這對陣雙方我們的生產和零星測試的Oracle 11g數據庫(或者,如果是有規律的,我還沒有找到它)生成的Oracle錯誤: ORA-02049:超時:分佈式事務正在等待鎖定
由於這是針對測試數據庫運行的唯一進程,所以不應存在不同用戶競爭鎖定的問題。
任何想法可能會導致此錯誤?
在此先感謝。