Oracle 23.26LockingLab-verified · 2026-11-30

ORA-08177: can't serialize access for this transaction

A SERIALIZABLE transaction tried to update a row that another session changed and committed after the transaction began.

Oracle AI Database 26ai Free 23.26.3.0.0
ORA-08177: can't serialize access for this transaction

Jump to a cause

  1. 01The row was changed and committed after the transaction read it
  2. 02The update waited for another session's lock, which then committed

Lab-verifiedReproduced and fixed on Oracle AI Database 26ai Free 23.26.3.0.0 · 2026-11-30 · container image gvenzl/oracle-free:23-slim

With SET TRANSACTION ISOLATION LEVEL SERIALIZABLE, a transaction sees the data as of its start. If it then updates a row that another session has changed and committed in the meantime, Oracle refuses with ORA-08177 instead of overwriting that change.

The failed statement does nothing; the transaction must be rolled back and run again. Both cases below were reproduced with two real sessions on Oracle AI Database 26ai Free.

01The row was changed and committed after the transaction read it

Session A starts a serializable transaction and reads balance 1000. Session B sets the balance to 900 and commits. When A updates the same row, it gets ORA-08177 because its snapshot (1000) is out of date.

Setup
Setuprun as lab_a
CREATE TABLE accounts (account_id NUMBER PRIMARY KEY, balance NUMBER);
INSERT INTO accounts VALUES (1, 1000);
COMMIT;
OUTPUT
Table created.


1 row created.


Commit complete.
Reproduce2 sessions open at the same time (A, B), run in this order
Session Arun as lab_a
SET TRANSACTION ISOLATION LEVEL SERIALIZABLE;
SELECT balance FROM accounts WHERE account_id = 1;
OUTPUT
Transaction set.


   BALANCE
----------
      1000

1 row selected.
Session Brun as lab_a
UPDATE accounts SET balance = 900 WHERE account_id = 1;
COMMIT;
OUTPUT
1 row updated.


Commit complete.
Session Arun as lab_a
UPDATE accounts SET balance = balance + 50 WHERE account_id = 1;
OUTPUT
UPDATE accounts SET balance = balance + 50 WHERE account_id = 1
       *
ERROR at line 1:
ORA-08177: can't serialize access for this transaction
Help: https://docs.oracle.com/error-help/db/ora-08177/
Session Arun as lab_a
ROLLBACK;
OUTPUT
Rollback complete.

Catch ORA-08177, ROLLBACK, and run the whole transaction again. The new transaction reads 900, adds 50 and commits; the final balance is 950, so B's change is kept.

After the fix3 sessions open at the same time (A, B, S), run in this order
Session Arun as lab_a
SET TRANSACTION ISOLATION LEVEL SERIALIZABLE;
SELECT balance FROM accounts WHERE account_id = 1;
OUTPUT
Transaction set.


   BALANCE
----------
       900

1 row selected.
Session Brun as lab_a
UPDATE accounts SET balance = 900 WHERE account_id = 1;
COMMIT;
OUTPUT
1 row updated.


Commit complete.
Session A · Fixrun as lab_a
ROLLBACK;
SET TRANSACTION ISOLATION LEVEL SERIALIZABLE;
SELECT balance FROM accounts WHERE account_id = 1;
UPDATE accounts SET balance = balance + 50 WHERE account_id = 1;
COMMIT;
OUTPUT
Rollback complete.


Transaction set.


   BALANCE
----------
       900

1 row selected.


1 row updated.


Commit complete.
Session S · Checkrun as lab_a
SELECT account_id, balance FROM accounts;
OUTPUT
ACCOUNT_ID    BALANCE
---------- ----------
         1        950

1 row selected.

02The update waited for another session's lock, which then committed

Session A is serializable. Session B updates the row without committing, so A's UPDATE waits. As soon as B commits, A's UPDATE fails with ORA-08177 — the wait ends in an error, not in success.

Setup
Setuprun as lab_a
CREATE TABLE accounts (account_id NUMBER PRIMARY KEY, balance NUMBER);
INSERT INTO accounts VALUES (1, 1000);
COMMIT;
OUTPUT
Table created.


1 row created.


Commit complete.
Reproduce2 sessions open at the same time (A, B), run in this order
Session Arun as lab_a
SET TRANSACTION ISOLATION LEVEL SERIALIZABLE;
OUTPUT
Transaction set.
Session Brun as lab_a
UPDATE accounts SET balance = 900 WHERE account_id = 1;
OUTPUT
1 row updated.
Session Arun as lab_a⏳ Waiting for the lock…
UPDATE accounts SET balance = balance + 50 WHERE account_id = 1;
Session Brun as lab_a
COMMIT;
OUTPUT
Commit complete.
Session A: the waiting statement finishesrun as lab_a
OUTPUT
UPDATE accounts SET balance = balance + 50 WHERE account_id = 1
       *
ERROR at line 1:
ORA-08177: can't serialize access for this transaction
Help: https://docs.oracle.com/error-help/db/ora-08177/
Session Arun as lab_a
ROLLBACK;
OUTPUT
Rollback complete.

If the transaction does not need serializable reads, use the default READ COMMITTED. Then A's UPDATE waits for B, continues after B's commit (1 row updated.), and the balance becomes 950.

After the fix3 sessions open at the same time (A, B, S), run in this order
Session A · Fixrun as lab_a
SET TRANSACTION ISOLATION LEVEL READ COMMITTED;
OUTPUT
Transaction set.
Session Brun as lab_a
UPDATE accounts SET balance = 900 WHERE account_id = 1;
OUTPUT
1 row updated.
Session Arun as lab_a⏳ Waiting for the lock…
UPDATE accounts SET balance = balance + 50 WHERE account_id = 1;
Session Brun as lab_a
COMMIT;
OUTPUT
Commit complete.
Session A: the waiting statement finishesrun as lab_a
OUTPUT
1 row updated.
Session Arun as lab_a
COMMIT;
OUTPUT
Commit complete.
Session S · Checkrun as lab_a
SELECT account_id, balance FROM accounts;
OUTPUT
ACCOUNT_ID    BALANCE
---------- ----------
         1        950

1 row selected.

FAQ

What does ORA-08177 can't serialize access for this transaction mean?

Your SERIALIZABLE transaction tried to change a row that another transaction changed and committed after yours started. Oracle stops it so the other change is not lost.

How do I fix ORA-08177?

Roll back and retry the transaction, or use READ COMMITTED if serializable isolation is not required. Both are shown above with real session output.

Why do I get ORA-08177 after waiting on a lock?

In serializable mode, when the session holding the lock commits a change to that row, the waiting UPDATE fails with ORA-08177. In the test it waited, then failed right after the other session's COMMIT.

Is ORA-08177 the same as a deadlock (ORA-00060)?

No. ORA-00060 is two sessions waiting on each other. ORA-08177 is a serializable transaction that would overwrite a newer committed change.

How we verify

Each scenario starts from fresh database users. A script runs the setup, confirms the exact error code, applies the fix and runs the statement again. The output shown is what the database printed, saved by the script.

lab_a and lab_b are ordinary users created for the test; system is the DBA account. Oracle AI Database 26ai Free Release 23.26.3.0.0 - Develop, Learn, and Run for Free 23.26.3.0.0