Investigating transactions and concurrency
In this recipe we will see more details on locking and, specifically, on deadlocks .
Getting ready
In this recipe we will use two SQL*Plus sessions, to simulate two users concurrently accessing the database.
How to do it...
This recipe deals wits transactions and concurrency. Follow these steps:
- Connect
SESSION 1
to the database asSH
user:-- SESSION 1 CONNECT sh@TESTDB/sh
- Update a row on the
CUSTOMERS
table inSESSION 1
:UPDATE CUSTOMERS SET CUST_FIRST_NAME = 'TEST1-1' WHERE CUST_ID = 26;
- Connect
SESSION 2
to the database asSH
user:-- SESSION 2 CONNECT sh@TESTDB/sh
- Update a row on the
CUSTOMERS
table inSESSION 2
, different from the one updated in step 2 bySESSION 1
:UPDATE CUSTOMERS SET CUST_FIRST_NAME ...
Get Oracle Database 11gR2 Performance Tuning Cookbook now with the O’Reilly learning platform.
O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.