Using :
select substr(object_name,1,30),substr(os_user_name,1,20) from v$locked_object,user_objects
where v$locked_object.object_id = user_objects.object_idyou can find the locked object and who is locking it .If you query the v$session with above result . You will get more clear view .

解决方案 »

  1.   

    不止一次贴过这个帖子,希望以后发贴的时候先看一下是否已经有类似帖子存在。set linesize 200
    column sid format 999;
    column b format 9;
    column spid format 999999;
    column object_type format a5
    column object_name format a30;
    column lock_type format a10;
    column ctime format 99999
    column username format a15
    column machine  format a20;
    column MODULE   format a20;
    column action   format a20;select V$SESSION.sid,v$session.SERIAL#,v$process.spid,
    rtrim(object_type) object_type,rtrim(owner) || '.' || object_name object_name,
    decode(lmode,   0, 'None',
    1, 'Null',
    2, 'Row-S',
    3, 'Row-X',
    4, 'Share',
    5, 'S/Row-X',
    6, 'Exclusive', 'Unknown') LockMode,
    decode(request, 0, 'None',
    1, 'Null',
    2, 'Row-S',
    3, 'Row-X',
    4, 'Share',
    5, 'S/Row-X',
    6, 'Exclusive', 'Unknown') RequestMode
    ,ctime, block b,
    v$session.username,MACHINE,MODULE,ACTION,
    decode(A.type,
    'MR', 'Media Recovery',
    'RT','Redo Thread',
    'UN','User Name',
    'TX', 'Transaction',
    'TM', 'DML',
    'UL', 'PL/SQL User Lock',
    'DX', 'Distributed Xaction',
    'CF', 'Control File',
    'IS', 'Instance State',
    'FS', 'File Set',
    'IR', 'Instance Recovery',
    'ST', 'Disk Space Transaction',
    'TS', 'Temp Segment',
    'IV', 'Library Cache Invalida-tion',
    'LS', 'Log Start or Switch',
    'RW', 'Row Wait',
    'SQ', 'Sequence Number',
    'TE', 'Extend Table',
    'TT', 'Temp Table',
    'Unknown') LockType
    from (SELECT * FROM V$LOCK) A, all_objects,V$SESSION,v$process
    where A.sid > 6
    and object_name<>'OBJ$'
    and A.id1 = all_objects.object_id
    and A.sid=v$session.sid
    and v$process.addr=v$session.paddr;
      

  2.   

    set linesize 200
    column sid format 999;
    column b format 9;
    column spid format 999999;
    column object_type format a5
    column object_name format a30;
    column lock_type format a10;
    column ctime format 99999
    column username format a15
    column machine  format a20;
    column MODULE   format a20;
    column action   format a20;select V$SESSION.sid,v$session.SERIAL#,v$process.spid,
    rtrim(object_type) object_type,rtrim(owner) || '.' || object_name object_name,
    decode(lmode,   0, 'None',
    1, 'Null',
    2, 'Row-S',
    3, 'Row-X',
    4, 'Share',
    5, 'S/Row-X',
    6, 'Exclusive', 'Unknown') LockMode,
    decode(request, 0, 'None',
    1, 'Null',
    2, 'Row-S',
    3, 'Row-X',
    4, 'Share',
    5, 'S/Row-X',
    6, 'Exclusive', 'Unknown') RequestMode
    ,ctime, block b,
    v$session.username,MACHINE,MODULE,ACTION,
    decode(A.type,
    'MR', 'Media Recovery',
    'RT','Redo Thread',
    'UN','User Name',
    'TX', 'Transaction',
    'TM', 'DML',
    'UL', 'PL/SQL User Lock',
    'DX', 'Distributed Xaction',
    'CF', 'Control File',
    'IS', 'Instance State',
    'FS', 'File Set',
    'IR', 'Instance Recovery',
    'ST', 'Disk Space Transaction',
    'TS', 'Temp Segment',
    'IV', 'Library Cache Invalida-tion',
    'LS', 'Log Start or Switch',
    'RW', 'Row Wait',
    'SQ', 'Sequence Number',
    'TE', 'Extend Table',
    'TT', 'Temp Table',
    'Unknown') LockType
    from (SELECT * FROM V$LOCK) A, all_objects,V$SESSION,v$process
    where A.sid > 6
    and object_name<>'OBJ$'
    and A.id1 = all_objects.object_id
    and A.sid=v$session.sid
    and v$process.addr=v$session.paddr;