⟩ How To View Existing Locks on the Database?
As can see from the pervious tutorial exercise, performance of the second session is greatly affected by the data lock created on the database. To maintain a good performance level for all sessions, you need to monitor the number of data locks on the database, and how long do they last.
Oracle maintains current existing data locks in a Dynamic Performance View called V$LOCK with columns like:
* SID - Session ID to identify the session that owns this lock.
* TYPE - The type of the lock, like TM (DML enqueue) and TX (Transaction enqueue).
* LMODE - The lock mode in which the session holds the lock.
* REQUEST - The lock mode in which the session requests the lock.
* CTIME - The time since current lock mode was granted
* BLOCK - A value of either 0 or 1, depending on whether or not the lock in question is the blocker.
The following tutorial exercise shows you how to view existing locks on the database:
(session 1)
SQL> connect HR/globalguideline
SQL> UPDATE ggl_links
SET url='rendc.org'
WHERE id=110;
1 row updated.