Call now: 252-767-6166  
Oracle Training Oracle Support Development Oracle Apps

 E-mail Us
 Oracle Articles
New Oracle Articles

 Oracle Training
 Oracle Tips

 Oracle Forum
 Class Catalog

 Remote DBA
 Oracle Tuning
 Emergency 911
 RAC Support
 Apps Support
 Oracle Support

 SQL Tuning

 Oracle UNIX
 Oracle Linux
 Remote s
 Remote plans
 Application Server

 Oracle Forms
 Oracle Portal
 App Upgrades
 SQL Server
 Oracle Concepts
 Software Support

 Remote S


 Consulting Staff
 Consulting Prices
 Help Wanted!


 Oracle Posters
 Oracle Books

 Oracle Scripts

Don Burleson Blog 







Find Oracle RAC Locks

Oracle Database Tips by Donald Burleson

Oracle RAC is extremely complex and special scripts are required to identify locks within any RAC cluster.  The monitoring of the RAC global enqueue services (GES) process is performed using the gv$enqueue_stat  view.

For full scripts, download the Oracle script collection. Also see these scripts for finding RAC blocking sessions.

The RAC resources managed by the GES include the following lock areas:

         Transaction locks - It is acquired in the exclusive mode when a transaction initiates its first row level change. The lock is held until the transaction is committed or rolled back.

         Library Cache locks - When a RAC database object (such as a table, view, procedure, function, package, package body, trigger, index, cluster, or synonym) is referenced during parsing or compiling of a SQL, DML or DDL, PL/SQL, or Java statement, the process parsing or compiling the statement acquires the library cache lock in the correct mode.

         Dictionary Cache Locks - Global enqueues are used in the cluster database mode. The data dictionary structure is the same for all Oracle instances in a cluster database, as it is for instances in a single-instance database.

 The Oracle script collection contains a complete list of Oracle RAC locking scripts, but this script can be used to quickly identify and isolate RAC locking issues:

select object_name, owner, lid.*
  from (select
               s.inst_id, s.sid, s.serial#, p.spid,nvl (s.sql_id, 0), s.sql_hash_value,
               decode (l.type,
                       'tm', l.id1,
                       'tx', decode (l.request,
                                     0, nvl (lo.object_id, -1),
                      ) as object_id,
                 l.type lock_type,
               DECODE (l.lmode,
                       0, 'NONE',
                       1, 'NULL',
                       2, 'ROW SHARE',
                       3, 'ROW EXCLUSIVE',
                       4, 'SHARE',
                       5, 'SHARE ROW EXCLUSIVE',
                       6, 'EXCLUSIVE',
                      ) mode_held,
               DECODE (l.request,
                       0, 'NONE',
                       1, 'NULL',
                       2, 'ROW SHARE',
                       3, 'ROW EXCLUSIVE',
                       4, 'SHARE',
                       5, 'SHARE ROW EXCLUSIVE',
                       6, 'EXCLUSIVE',
                      ) mode_requested,
               l.id1, l.id2, l.ctime time_in_mode,s.row_wait_obj#, s.row_wait_block#,
               s.row_wait_row#, s.row_wait_file#
          from gv$lock l,
               gv$session s,
               gv$process p,
               (select object_id, session_id, xidsqn
                  from gv$locked_object
                 where xidsqn > 0) lo
         where l.inst_id = s.inst_id
           and s.inst_id = p.inst_id
           and s.sid = l.sid
           and p.addr = s.paddr
           and l.sid = lo.session_id(+)
           and l.id2 = lo.xidsqn(+)) lid,
       SYS.obj$ o,
       SYS.user$ u
 WHERE o.obj#(+) = lid.object_id
 AND o.owner# = u.user#(+)
 AND object_id <> -1;

Oracle Grid and Real Application Clusters

See working examples of Oracle Grid and RAC in the book Oracle Grid and Real Application Clusters.

Order directly from Rampant and save 30%. 





Oracle Training at Sea
oracle dba poster

Follow us on Twitter 
Oracle performance tuning software 
Oracle Linux poster


Burleson is the American Team

Note: This Oracle documentation was created as a support and Oracle training reference for use by our DBA performance tuning consulting professionals.  Feel free to ask questions on our Oracle forum.

Verify experience! Anyone considering using the services of an Oracle support expert should independently investigate their credentials and experience, and not rely on advertisements and self-proclaimed expertise. All legitimate Oracle experts publish their Oracle qualifications.

Errata?  Oracle technology is changing and we strive to update our BC Oracle support information.  If you find an error or have a suggestion for improving our content, we would appreciate your feedback.  Just  e-mail:  

and include the URL for the page.


Burleson Consulting

The Oracle of Database Support

Oracle Performance Tuning

Remote DBA Services


Copyright © 1996 -  2020

All rights reserved by Burleson

Oracle ® is the registered trademark of Oracle Corporation.