****************************************************************
* Description: SQL for querying locks attached on table objects
* Compatiablity: RDBMS 11g, 12c
* Date: 04:08 PM EST, 04/01/2017
****************************************************************


<1> Checking locks attached to database objects:
     |
     |__ SQL> column oracle_username format a15;
              column os_user_name format a15;
              column object_name format a37;
              column object_type format a37;
              
              select a.session_id,a.oracle_username, a.os_user_name, b.owner "OBJECT OWNER", b.object_name,b.object_type,a.locked_mode 
              from (select object_id, SESSION_ID, ORACLE_USERNAME, OS_USER_NAME, LOCKED_MODE from v$locked_object) a, 
                   (select object_id, owner, object_name,object_type from dba_objects) b
              where a.object_id=b.object_id;
      
      		  
      		  
             o. Lock Mode:		
			 
                 0 - NONE: lock requested but not yet obtained
                 1 - NULL
                 2 - ROWS_S (SS): Row Share Lock
                 3 - ROW_X (SX): Row Exclusive Table Lock
                 4 - SHARE (S): Share Table Lock
                 5 - S/ROW-X (SSX): Share Row Exclusive Table Lock
                 6 - Exclusive (X): Exclusive Table Lock
				
				
<2> Reference: https://docs.oracle.com/database/121/REFRN/GUID-3F9F26AA-197F-4D36-939E-FAF1EFD8C0DD.htm#REFRN30125