--1,查看锁Select * From v$locked_object;--orSelect object_id,session_id,locked_mode From v$locked_object;--orSelect b.owner,b.object_name,l.session_id,l.locked_modeFrom v$locked_object l, dba_objects bWhere b.object_id=l.object_id--2,找出sid,serial#号Select t2.username,t2.sid,t2.serial#,t2.logon_timeFrom v$locked_object t1,v$session t2Where t1.session_id=t2.sid Order by t2.logon_time;--以上两步可以直接用以下语句查出被锁记录的表名,SID,Serial#,用户名,机器名等信息。select s.username, o.owner,o.object_name,o.object_type,decode(l.type,'TM','TABLE LOCK', 'TX','ROW LOCK',NULL) LOCK_LEVEL,s.sid,s.serial#,s.terminal,s.machine,s.program,s.osuserfrom v$session s,v$lock l,dba_objects owhere s.sid=l.sidand o.object_id=l.id1and s.username is not null--3,解锁:杀死被锁的session(用上面查出的SID,Serial#)Alter system Kill session 'sid,serial#'--orAlter system disconnect session 'sid, serial#' immediate;
Tag: Oracle Oracle技巧 Oracle笔记 TTTBLOG