ora-00054:resource busy and acquire with nowait specified解决方法

当某个数据库用户在数据库中插入、更新、删除一个表的数据,或者增加一个表的主键时或者表的索引时, 有时会出现ora-00054:resource busy and acquire with nowait specified这个问题,主要原因是事务正在执行或锁表,具体解决方案如下:

1.查看锁:

 

select t2.username,t2.sid,t2.serial#,t2.logon_time
from v$locked_object t1,v$session t2
where t1.session_id=t2.sid order by t2.logon_time;

 

2.查看造成锁表的sql语句

 

select sql_text from v$session a,v$sqltext_with_newlines b
where DECODE(a.sql_hash_value, 0, prev_hash_value, sql_hash_value)=b.hash_value
and a.sid=&sid order by piece;

查看造成死锁的语句(等同于一二步骤):

 

select a.username ,a.sid, a.serial#, a.last_call_et "Seconds", b.event, c.sql_text

  from v$session a, v$session_wait b, v$sqlarea c

 where a.sid = b.sid

   and a.sql_hash_value = c.hash_value

   and b.wait_class not like 'Idle'

 

 

3.kill锁

alter system kill session '339,13545';

你可能感兴趣的:(ora-00054:resource busy and acquire with nowait specified解决方法)