查杀ORACLE锁表 锁记录进程

一.查看数据库锁,诊断锁的来源及类型

 

Select object_id,session_id,locked_mode From v$locked_object;

 

或者:

 

Select b.owner,b.object_name,l.session_id,l.locked_mode 

 From v$locked_object l, dba_objects b 

Where b.object_id=l.object_id

 

二.找出serial#值

Select t2.username,t2.sid,t2.serial#,t2.logon_time,t2.OSUSER, t2.MACHINE,t2.PROGRAM,t2.MODULE,t2.LOGON_TIME,t2.STATE From v$locked_object t1,v$session t2 Where t1.session_id=t2.sid Order by t2.logon_time;

 

三.KILL session

Alter system Kill session 'sid,serial#'

你可能感兴趣的:(查杀ORACLE锁表 锁记录进程)