jQuery火箭图标返回顶部代码

ORACLE锁表查询及解锁方法

--查看锁表情况
select distinct a.sid,
                to_char(a.logon_time, 'YYYY-MM-DD HH24:mi:ss') loginTime,
                a.serial#,
                a.USERNAME,
                a.OSUSER,
                a.MACHINE,
                a.STATUS,
                d.sql_text,
                'ALTER SYSTEM KILL SESSION ''' || a.sid || ',' || a.SERIAL# || ',@' ||
                a.inst_id || ''';'
  from gv$session a, gv$locked_object b, dba_objects c, gv$sqlarea d
where a.SID = b.SESSION_ID
   and username = 'CCIC_UAT_RI'
   and d.address = a.sql_address
   and a.status = 'ACTIVE'
   and b.OBJECT_ID = c.object_id;
   
--查看具体是那些sql语句引起锁表   
select l.session_id sid,
       s.serial#,
       l.locked_mode,
       l.oracle_username,
       s.user#,
       l.os_user_name,
       s.machine,
       s.terminal,
       a.sql_text,
       a.action
  from v$sqlarea a, v$session s, v$locked_object l
where l.session_id = s.sid
   and s.prev_sql_addr = a.address
order by sid, s.serial#;

--ORACLE解锁的方法 
alter system kill session 'SID,serial#';  --SID和Serial#共同确定一唯一的session。

 

posted @ 2019-05-06 22:56  小狮子001  阅读(2871)  评论(0编辑  收藏  举报