码迷,mamicode.com
首页 > 数据库 > 详细

Oracle检查锁及其等待的行ROWID

时间:2017-02-04 16:56:29      阅读:310      评论:0      收藏:0      [点我收藏+]

标签:imm   system   char   rom   substr   roc   acl   wait   row   

SELECT l.session_id sid ,
       substr(o.owner,
              1,
              8) owner,
       o.object_type object_type,
       substr(o.object_name,
              1,
              18) object_name,
       decode(l.locked_mode,
              0,
              ‘None‘,
              1,
              ‘Null‘,
              2,
              ‘Row-S‘,
              3,
              ‘Row-X‘,
              4,
              ‘Share‘,
              5,
              ‘S/Row-X‘,
              6,
              ‘Exclusive‘) locked_mode,
       l.oracle_username username,
       l.os_user_name osuser,
       to_char(s.logon_time,
               ‘YYYY/MM/DD HH24:MI:SS‘) logon_time,
       decode(s.row_wait_obj#,
              - 1,
              NULL,
              dbms_rowid.rowid_create( 1,
                                      s.row_wait_obj#,
                                      s.row_wait_file#,
                                      s.row_wait_block#,
                                      s.row_wait_row#)) row_id
  FROM gv$locked_object l, --gv$locked_object
       all_objects     o,
       gv$session       s --gv$session
 WHERE l.object_id = o.object_id
   AND l.session_id = s.sid
--AND l.inst_id = s.inst_id
-- AND o.object_name = ‘LOCK_TEST‘;
 
 

--杀死session及进程

SELECT s.sid session_id,
       p.spid os_process_id,
       p.pid oracle_process_id,
       ‘alter system kill session ‘‘‘ || to_char(s.sid) || ‘,‘ || to_char(s.serial#) || ‘‘‘ immediate;‘ kill_db_session,
       ‘kill -9 ‘ || p.spid kill_os_session
  FROM v$process p,
       v$session s
 WHERE p.addr = s.paddr
   AND s.sid = &sid;

Oracle检查锁及其等待的行ROWID

标签:imm   system   char   rom   substr   roc   acl   wait   row   

原文地址:http://www.cnblogs.com/-lisunman/p/6365416.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!