1. 程式人生 > >oracle資料被鎖、解鎖及殺死程序

oracle資料被鎖、解鎖及殺死程序

--查詢那個使用者那個程序造成死鎖
select b.username,b.sid,b.serial#,b.logon_time from v$locked_object a,v$session b where a.session_id=b.sid order by b.logon_time;
select b.*,a.* from v$locked_object a,v$session b where a.session_id=b.sid and b.sid=1300;
--檢視連線的程序
select * from v$session ;
select * from v$session where sid=1300;
--檢視鎖定表的SID
select s.sid,s.serial#,s.username,s.schemaname,s.osuser,s.process,s.machine,s.terminal,s.logon_time,l.type from v$session s, v$lock l where s.sid=l.sid and s.username is not null order by s.sid;