What it means
Two sessions each hold a lock the other one needs. Oracle rolls back one statement to break the deadlock.
Common causes
- Sessions update the same rows in a different order
- Foreign keys without an index cause table-level locks
- Bitmap indexes with concurrent DML
How to fix it
- Open the trace file named in the alert log and read the deadlock graph to see the two sessions and SQL
- Make every transaction touch tables and rows in the same order
- Index foreign key columns so child-table locks stay small
- Retry the failed transaction in the application
How to prevent it
Keep transactions short and always lock in a consistent order.
Still stuck? Ask the community in Q&A.