⟩ How To Experiment a Data Lock in Oracle?
If you want to have some experience with data locks, you can create two windows runing two SQL*Plus sessions. In session 1, you can run a UPDATE statements to create a data lock. Before committing session 2, switch to session 2, and run a UPDATE statements on the same row as session 1. The UPDATE statement will be put into wait status because of the data lock. Follow the tutorial exercise below to experience yourself:
(session 1)
SQL> connect HR/globalguideline
SQL> SET TRANSACTION
ISOLATION LEVEL
READ COMMITTED;
Transaction set.
SQL> SELECT * FROM ggl_links;
ID URL NOTES
--- ---------------- --------
101 globalguideline.COM
110 globalguideline.COM
SQL> UPDATE ggl_links
SET url='rendc.org'
WHERE id=101;
1 row updated.
(lock created on row id=101)