欧美bbbwbbbw肥妇,免费乱码人妻系列日韩,一级黄片

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

 更新時(shí)間:2015年12月16日 00:10:22   投稿:mdxy-dxy  
這篇文章主要介紹了oracle ora-00054:resource busy and acquire with nowait specified解決方法,需要的朋友可以參考下

當(dāng)某個(gè)數(shù)據(jù)庫用戶在數(shù)據(jù)庫中插入、更新、刪除一個(gè)表的數(shù)據(jù),或者增加一個(gè)表的主鍵時(shí)或者表的索引時(shí),常常會(huì)出現(xiàn)ora-00054:resource busy and acquire with nowait specified這樣的錯(cuò)誤。

主要是因?yàn)橛惺聞?wù)正在執(zhí)行(或者事務(wù)已經(jīng)被鎖),所有導(dǎo)致執(zhí)行不成功。

1、用dba權(quán)限的用戶查看數(shù)據(jù)庫都有哪些鎖

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、根據(jù)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該事務(wù)

alter system kill session '339,13545';

4、這樣就可以執(zhí)行其他的事務(wù)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中的進(jìn)程被殺掉后,狀態(tài)被置為"killed",但是鎖定的資源很長時(shí)間不釋放,有時(shí)實(shí)在沒辦法,只好重啟數(shù)據(jù)庫。現(xiàn)在提供一種方法解決這種問題,那就是在ORACLE中殺不掉的,在OS一級(jí)再殺。

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.下面的語句用來殺死一個(gè)進(jìn)程:

alter system kill session '24,111'; (其中24,111分別是上面查詢出的sid,serial#)

【注】以上兩步,可以通過Oracle的管理控制臺(tái)來執(zhí)行。

3.如果利用上面的命令殺死一個(gè)進(jìn)程后,進(jìn)程狀態(tài)被置為"killed",但是鎖定的資源很長時(shí)間沒有被釋放,那么可以在os一級(jí)再殺死相應(yīng)的進(jìn)程(線程),首先執(zhí)行下面的語句獲得進(jìn)程(線程)號(hào):

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上殺死這個(gè)進(jìn)程(線程):

1)在unix上,用root身份執(zhí)行命令:
#kill -9 12345(即第3步查詢出的spid)
2)在windows(unix也適用)用orakill殺死線程,orakill是oracle提供的一個(gè)可執(zhí)行命令,語法為:
orakill sid thread
其中:
sid:表示要?dú)⑺赖倪M(jìn)程屬于的實(shí)例名
thread:是要?dú)⒌舻木€程號(hào),即第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

相關(guān)文章

最新評(píng)論