from v$lock a,v$session b ,dba_objects c where b.sid=a.sid and c.object_id()=a.id1;
coltypefor a4
col name for a25
col description for a60
selecttype,name,description from v$lock_type wheretype=upper('&type');
col oracle_username for a22
col os_user_name for a22
select xidusn,object_id,session_id,oracle_username,os_user_name,process from v$locked_object;
col object_name for a22
select d.object_id,substr(object_name,1,20) object_name, l.session_id, l.oracle_username, l.locked_mode,xidusn,xidslot,xidsqn from v$locked_object l, dba_objects d where d.object_id=l.object_id;
col username for a22
col machine for a25
col program for a35
select username,lockwait,status,machine,program from v$sessionwhere sid in(select session_id from v$locked_object);
col sql_text for a60
select sql_id,sql_text from v$sql where hash_value in(select sql_hash_value from v$sessionwhere sid in(select session_id from v$locked_object));
select waiting_session, holding_session, lock_type, mode_held from dba_waiters; --慎用,可能返回很多