查看oracle数据库锁

方法一:查看产生锁的进程ID(在数据库服务器上)、来源主机(如应用服务器)等等

select s.machine sourse_host,p.SPID PID,l.session_id sid,s.serial#,l.locked_mode,l.oracle_username,s.user#,l.os_user_name,s.terminal,a.sql_text,a.action from 
v$sqlarea a,v$session s, v$locked_object l,sys.v_$process p
where l.session_id=s.sid and s.PREV_SQL_ADDR=a.address and s.PADDR=p.addr order by sid,s.serial#;

方法二:

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#;--查看锁的SID

select * from v$session a where a.sid='230';--通过SID查找到PADDR,如C0000004023FEB71

select * from sys.v_$process t where t.ADDR='C0000004023FEB71'; --查看进程id

select * from sys.v_$session t;--查看所有会话

  

猜你喜欢

转载自www.cnblogs.com/qqran/p/9853776.html