--首先查看有哪些鎖 select /*+ rule */ s.username, decode(l.type,'TM','TABLE LOCK','TX','ROW LOCK',null) lock_level, o.owner, o.object_name, o.object_type, s.sid,s.serial#, s.terminal, s.machine, s.program, s.osuser from v$session s,v$lock l,dba_objects o where l.sid = s.sid and l.id1 = o.object_id(+) and s.username is not null --如果發(fā)生了鎖等待,,看是誰(shuí)鎖了表而引起誰(shuí)的等待 --以下的語(yǔ)句可以查詢到誰(shuí)鎖了表,,而誰(shuí)在等待,。 如果有子節(jié)點(diǎn),,則表示有等待發(fā)生 select /*+ rule */ lpad(' ',decode(l.xidusn ,0,3,0))||l.oracle_username user_name, o.owner, o.object_name, o.object_type, s.sid, s.serial# from v$locked_object l,dba_objects o,v$session s where l.object_id=o.object_id and l.session_id=s.sid order by o.object_id,xidusn desc --找到引起等待的session,殺掉該session: alter system kill session 'sid,serial#'; |
|
來(lái)自: wghbeyond > 《oracle優(yōu)化》