1.查被锁的表明和sid
select a.sid,p.spid,c.object_name,b.oracle_username,b.session_id
from v$process p,v$session a,v$locked_object b,all_objects c
where p.addr=a.paddr and a.process=b.process and c.object_id=b.object_id;
---object_name:为被锁的表名
2.查是谁锁的这个表
select t2.username,t2.sid,t2.serial#,t2.logon_time,t1.*
from v$locked_object t1,v$session t2
where t1.session_id=t2.sid and t2.sid='301' ; --填上个sql查出的sid
select a.sid,p.spid,c.object_name,b.oracle_username,b.session_id
from v$process p,v$session a,v$locked_object b,all_objects c
where p.addr=a.paddr and a.process=b.process and c.object_id=b.object_id;
---object_name:为被锁的表名
2.查是谁锁的这个表
select t2.username,t2.sid,t2.serial#,t2.logon_time,t1.*
from v$locked_object t1,v$session t2
where t1.session_id=t2.sid and t2.sid='301' ; --填上个sql查出的sid