您好,登錄后才能下訂單哦!
這篇文章主要介紹了Oracle出現(xiàn)ORA-00054錯(cuò)誤怎么辦,具有一定借鑒價(jià)值,感興趣的朋友可以參考下,希望大家閱讀完這篇文章之后大有收獲,下面讓小編帶著大家一起了解一下。
在進(jìn)行數(shù)據(jù)庫(kù)維護(hù)的過程中要?jiǎng)h除一個(gè)中間表,遇到如下錯(cuò)誤:
sys@DW>drop table dwods.member_DELTA;
drop table dwods.member_DELTA
*
ERROR at line 1:
ORA-00054: resource busy and acquire with NOWAIT specified or timeout expired
發(fā)現(xiàn)表因?yàn)閳?zhí)行dml被鎖住,下面給出錯(cuò)誤的處理思路和過程,具體情況而異:
1 查看被數(shù)據(jù)庫(kù)中被鎖的用戶信息:
sys@DW>select t2.username,t2.sid,t2.serial#,t2.logon_time
2 from v$locked_object t1,v$session t2
3 where t1.session_id=t2.sid order by t2.logon_time;
USERNAME SID SERIAL# LOGON_TIME
------------------------------ ---------- ---------- -------------------
DWODS 1520 42477 2011-11-17 18:00:40
DWODS 1594 7385 2011-11-17 18:41:27
dwods 被鎖住,因?yàn)槭聞?wù)是18:41分發(fā)起的,所以查看一下sid 為1594的信息,
2 查詢出sql信息根據(jù)實(shí)際情況,進(jìn)行操作
sys@DW>select sql_text from v$session a,v$sqltext_with_newlines b
2 where DECODE(a.sql_hash_value, 0, prev_hash_value, sql_hash_value)=b.hash_value
3 and a.sid=&sid order by piece;
Enter value for sid: 1594
old 3: and a.sid=&sid order by piece
new 3: and a.sid=1594 order by piece
SQL_TEXT
----------------------------------------------------------------
insert /*+ append +*/ into DWODS.MEMBER_delta (ACTION,
ADDRESS,
........
32 rows selected.
正是發(fā)起的那個(gè)語(yǔ)句,查看用戶的信息進(jìn)行確認(rèn)
sys@DW>@user_info
Enter value for sid: 1594
old 12: where a.sid = &sid
new 12: where a.sid = 1594
USERNAME SID SERIAL# OS Process Logon time OSUSER PROGRAM STATUS
--------- ----- ------- ----------------------------- -------- ----------------------- -----------
DWODS 1594 7385 3309 17/11/2011 18:41:27 etl sqlplus@dw1 (TNS V1-V3) ACTIVE
1 row selected.
3 選擇kill 掉進(jìn)程
這里知道此session 可以殺掉,所以殺掉此session
sys@DW>alter system kill session '1594,7385';
System altered.
4 進(jìn)行確認(rèn):
在數(shù)據(jù)庫(kù)確認(rèn)
sys@DW>@user_info
Enter value for sid: 1594
old 12: where a.sid = &sid
new 12: where a.sid = 1594
no rows selected
sys@DW>select t2.username,t2.sid,t2.serial#,t2.logon_time
2 from v$locked_object t1,v$session t2
3 where t1.session_id=t2.sid order by t2.logon_time;
USERNAME SID SERIAL# LOGON_TIME
--------------- ------- ------- -------------------
DWODS 1520 42477 2011-11-17 18:00:40
DWODS 1520 42477 2011-11-17 18:00:40
2 rows selected.
在os層確認(rèn),進(jìn)程已經(jīng)被殺。
oracle@dw1:/home/oracle>ps -ef | grep 3309
oracle 22565 18543 0 18:59 pts/5 00:00:00 grep 3309
再次執(zhí)行刪除表的操作:
sys@DW>drop table dwods.member_DELTA;
Table dropped.
------附上:
user_info。sql 腳本的內(nèi)容:
select
a.username,
a.sid,
a.serial#,
b.spid "OS Process",
to_char(a.logon_time,'DD/MM/YYYY hh34:mi:ss') "Logon time",
a.osuser,
a.program,
a.status
from v$session a, v$process b
where a.sid = &sid
and a.paddr = b.addr
/
感謝你能夠認(rèn)真閱讀完這篇文章,希望小編分享的“Oracle出現(xiàn)ORA-00054錯(cuò)誤怎么辦”這篇文章對(duì)大家有幫助,同時(shí)也希望大家多多支持億速云,關(guān)注億速云行業(yè)資訊頻道,更多相關(guān)知識(shí)等著你來學(xué)習(xí)!
免責(zé)聲明:本站發(fā)布的內(nèi)容(圖片、視頻和文字)以原創(chuàng)、轉(zhuǎn)載和分享為主,文章觀點(diǎn)不代表本網(wǎng)站立場(chǎng),如果涉及侵權(quán)請(qǐng)聯(lián)系站長(zhǎng)郵箱:is@yisu.com進(jìn)行舉報(bào),并提供相關(guān)證據(jù),一經(jīng)查實(shí),將立刻刪除涉嫌侵權(quán)內(nèi)容。