当某个数据库用户在数据库中插入、更新、删除一个表的数据,或者增加一个表的主键时或者表的索引时,常常会出现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

ora-00054:resource busy and acquire with nowait specified相关推荐

  1. oracle之 RA-00054: resource busy and acquire with NOWAIT specified or timeout expired

    1. truncate 表报 ORA-00054 ,标明有事务正在操作该表 SQL> truncate table alldm.DM_XQKD_YUJING_D; truncate table ...

  2. resource busy and acquire with nowait specified解决方法

    http://blog.csdn.net/wbj1234566/article/details/4156147 resource busy and acquire with nowait specif ...

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

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

  4. 【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,看报错应该是 ...

  5. ORA-00054 resource busy and acquire with NOWAIT specified Cause 错误解决方法

    1.查询被锁对象: select object_name,machine,s.sid,s.serial# from v$locked_object l,dba_objects o ,v$session ...

  6. java openfile busy_android java.io.IOException: open failed: EBUSY (Device or resource busy)

    今天遇到一个奇怪的问题, 测试在程序的下载界面,下载一个文件第一次下载成功,删除后再下载结果下载报错, 程序:file.createNewFile(); 报错:java.io.IOException: ...

  7. cannot open line '/dev/tty.usbserial' for r/w resource busy

    在进行串口调试的时候,需要在iterm上查看log信息只需要输入以下命令 screen /dev/tty.usbserial-gggggggg1 115200 有时候会遇到以下问题 cannot op ...

  8. cnpm install时提示resource busy or locked,syslink...

    场景 在使用cnpm install安装项目依赖时提示: resource busy or locked... 注: 博客: https://blog.csdn.net/badao_liumang_q ...

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

    rm: cannot remove directory `misc': Device or resource busy 解决方法: [root@crmnormal misc]# cat /etc/mi ...

最新文章

  1. Java数据结构和算法:位运算
  2. 在eclipse中创建第一个java应用程序,并在控制台输出“hello world”。
  3. 转:min(x,y)高效算法
  4. 怎么把 html做成雪花特效,CSS3 HTML5下雪特效 雪花飘飘
  5. gitbook使用及book.json详细配置
  6. 华中科技大学计算机学院离散数学2,华中科技大学计算机学院2015离散数学二考试点评.pdf...
  7. 《诗经》(全集) (2)
  8. [外星与文明]外星人的离开对地球有什么影响?
  9. Docker概述(一)(标贝科技)
  10. java 裁剪 pdf_java拆分pdf文档
  11. “3D 元宇宙技术”在汽车新零售领域的应用与实践
  12. 《一》注册订阅号并完成基本配置
  13. 苹果6s上市时间_6s为什么会在iOS14系统支持名单?
  14. 如何打开.epub格式的电子书?
  15. 微信小程序-全局数据共享
  16. 汽车自动变速器的控制技术
  17. js数字金额滚动动画(vue)
  18. 【Lua笔记】、Lua元表
  19. 过程参数仪表与检测课后作业知识点总结
  20. 微信小程序开发之——个人中心-订单物流查询(8)

热门文章

  1. impala的详细介绍--图文描述
  2. 测试基础-03-用例设计方法:案例讲解
  3. n卡eth挖矿设置_ETH2.0要来了,要不要布局显卡挖矿?
  4. Spring MVC中@Controller和@RequestMapping注解详解
  5. 03-15 截图、日志与录屏
  6. python一次性输入多个数_python如何一次性输入多个数
  7. inventor软件绘制百叶窗方法_三维工厂设计该使用什么软件?
  8. 正在迷茫的你,为什么不考虑这份工作呢?
  9. 前端请求后端数据的三种方式
  10. 学习前端开发,那你值得css的特点有哪些?