ora-00054:resource busy and acquire with nowait specified

当某个数据库用户在数据库中插入、更新、删除一个表的数据,或者增加一个表的主键时或者表的索引时,常常会出现ora-00054:resource busy and acquire with nowait specified这样的错误。

主要是因为有事务正在执行(或者事务已经被锁),所有导致执行不成功。

1、用dba权限的用户查看数据库都有哪些锁

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;

如:testuser 339 13545 2009-3-5 17:40:05
知道被锁的用户testuser,sid为339,serial#为13545

2、根据sid查看具体的sql语句,如果sql不重要,可以kill

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;

查出来的sql,如: begin :id := sys.dbms_transaction.local_transaction_id; end;

3、kill该事务
alter system kill session ‘339,13545‘;

4、这样就可以执行其他的事务sql语句了

如增加表的主键:
alter table test
  add constraint PK_test primary key (test_NO);

若提示:ORA-00030: User session ID does not exist

alter session set events ‘immediate trace name flush_cache level 1‘;

后果不详

ORA-00031: session marked for kill

一些ORACLE中的进程被杀掉后,状态被置为"killed",但是锁定的资源很长时间不释放,有时实在没办法,只好重启数据库。现在提供一种方法解决这种问题,那就是在ORACLE中杀不掉的,在OS一级再杀。

1.下面的语句用来查询哪些对象被锁:

select object_name,machine,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;

2.下面的语句用来杀死一个进程:
alter system kill session ‘24,111‘; (其中24,111分别是上面查询出的sid,serial#)

【注】以上两步,可以通过Oracle的管理控制台来执行。

3.如果利用上面的命令杀死一个进程后,进程状态被置为"killed",但是锁定的资源很长时间没有被释放,那么可以在os一级再杀死相应的进程(线程),首先执行下面的语句获得进程(线程)号:
select spid, osuser, s.program
from v$session s,v$process p
where s.paddr=p.addr and s.sid=24 (24是上面的sid)

4.在OS上杀死这个进程(线程):
1)在unix上,用root身份执行命令:
#kill -9 12345(即第3步查询出的spid)
2)在windows(unix也适用)用orakill杀死线程,orakill是oracle提供的一个可执行命令,语法为:
orakill sid thread
其中:
sid:表示要杀死的进程属于的实例名
thread:是要杀掉的线程号,即第3步查询出的spid。
例:c:>orakill orcl 12345

ORA-00031: session marked for kill

Cause: The session specified in an ALTER SYSTEM KILL SESSION command cannot be killed immediately (because it is rolling back or blocked on a network operation), but it has been marked for kill. This means it will be killed as soon as possible after its current uninterruptible operation is done.

Action: No action is required for the session to be killed, but further executions of the ALTER SYSTEM KILL SESSION command on this session may cause the session to be killed sooner.

kill -9 12345

时间: 2024-08-02 03:23:56

ora-00054:resource busy and acquire with nowait specified的相关文章

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

当某个数据库用户在数据库中插入.更新.删除一个表的数据,或者增加一个表的主键时或者表的索引时,常常会出现ora-00054:resource busy and acquire with nowait specified这样的错误. 主要是因为有事务正在执行(或者事务已经被锁),所有导致执行不成功. 1.用dba权限的用户查看数据库都有哪些锁 select t2.username,t2.sid,t2.serial#,t2.logon_time from v$locked_object t1,v$s

Oracle中的ORA-00054: resource busy and acquire with NOWAIT specified or timeout expired

向某个数据库用户中插入.更新.删除一个表的数据,或是增加一个表的主键.索引时,出现下面的错误: ORA-00054: resource busy and acquire with NOWAIT specified or timeout expired 这是因为有事务正在进行或是事务已经被锁,因此导致不成功 1)用dba权限的用户查询数据库中有哪些锁 select t2.username,t2.sid,t2.serial#,t2.logon_time from v$locked_object t1

【错误整理】ora-00054:resource busy and acquire with nowait specified解决方法【转】

当某个数据库用户在数据库中插入.更新.删除一个表的数据,或者增加一个表的主键时或者表的索引时,常常会出现ora-00054:resource busy and acquire with nowait specified这样的错误. 主要是因为有事务正在执行(或者事务已经被锁),所有导致执行不成功. 1.用dba权限的用户查看数据库都有哪些锁 select t2.username,t2.sid,t2.serial#,t2.logon_timefrom v$locked_object t1,v$se

解决oracle数据库 ora-00054:resource busy and acquire with NOWAIT specified 错误

本人在使用pl/sql developer 客户端调用存储过程进行操作时发现中途卡机然后强制终止pl/sql developer 之后,oracle就一直出现锁相关的错误. 经分析认为在调用存储过程时对表进行了DDL语句操作时导致了悲观封锁.客户端卡机后oracle一直没有对这个锁进行释放且一直不会完成释放导致错误. 需要对此会话进行强制杀掉: 1. 查询当前被锁的对象 select t2.username, t2.sid, t2.serial#, t2.logon_time from v$lo

WARNING: Re-reading the partition table failed with error 16: Device or resource busy.

在 mkfs.ext4 /dev/sda2 格式化硬盘空间时,可能出现这样的错误. had this situation at office where I was told to re-partition an already existing partition. The situation was to get the below schema /dev/sdb1 1 3040 24418768+ 83 Linux /dev/sdb2 3041 6080 24418800 83 Linux

Linux下rm -rf删除文件夹报错_ Device or resource busy

1.错误信息 rm: cannot remove `speechd-centos_6.2-prtl-pred-mf34/modules/t2p/py/third/g2p/.nfs00000000039b946b00000004': Device or resource busyrm: cannot remove `speechd-centos_6.2-prtl-pred-mf34/modules/t2p/py/log/.nfs00000000039c52ef00000005': Device o

rm: cannot remove directory `misc': Device or resource busy

rm: cannot remove directory `misc': Device or resource busy 解决方法: [[email protected] misc]# cat /etc/misc cat: /etc/misc: No such file or directory [[email protected] misc]# cat /etc/auto.master # # $Id: auto.master,v 1.4 2005/01/04 14:36:54 raven Ex

Android文件操作报open failed: EBUSY (Device or resource busy)

Android删除文件后重新创建时偶尔出现 open failed: EBUSY (Device or resource busy)错误,该错误是Android系统的一个bug,大概的意思类似于windows的"改文件正在被使用".产生这个错误的原因是Android在删除文件后没有及时释放文件锁,导致文件在重新创建时仍然处于被某一进程占用的状态.解决的方法是:在删除文件之前对该文件进行重命名,这样可以保证在删除文件时系统持有的文件锁是重命名之后的文件锁.代码可以这样写: final F

docker 磁盘问题:device or resource busy

问题:[[email protected] ~]# docker start 01ea65845e45Error response from daemon: Cannot start container 01ea65845e45: Error getting container 01ea65845e4547be24bc3db0bc3b424faf52b8a0534eb525aa829dd9fd6081c2 from driver devicemapper: Error mounting '/de