I have a very simple code using ADO.NET which throws ORA-08177 exception. I am not sure what\'s wrong with this. I am trying this on a windows vista machine which has oracle
You are using a serializable transaction which waits for some other transaction locking the same table to ROLLBACK
.
If this other transaction does not rollback but commits instead, you will get this error.
The scenario seems to be as following:
Alice
opens her browser session which calls DELETE FROM TABLE1 WHERE Version = 'v1'
Bob
opens his session which calls DELETE FROM TABLE1 WHERE Version = 'v1'
after Alice
did it but before she commited.Bob
's transaction waits since Alice
locked the rows with Version = 'v1'
Alice
commits her transaction
Bob
's transaction fails with Cannot serialize access
To work around this, set TRANSACTION ISOLATION LEVEL
to READ COMMITTED
:
transaction = connection.BeginTransaction(IsolationLevel.ReadCommitted)
In this case, Bob
's query will be reissued after Alice
commits her changes, as if Bob
's transaction were started after Alice
's one was committed.
Update
Could you please post a trace of your connection?
To do this, issue this command right after connecting:
(New OracleCommand("ALTER SESSION SET SQL_TRACE=TRUE", connection, transaction)).ExecuteNonQuery();
, then look in $ORACLE_HOME\admin\udump
for a fresh *.trc
file