truncate table alldm.DM_XQKD_YUJING_D; truncate table alldm.DM_XQKD_YUJING_D * ERROR at..."/>
溫馨提示×

溫馨提示×

您好,登錄后才能下訂單哦!

密碼登錄×
登錄注冊×
其他方式登錄
點擊 登錄注冊 即表示同意《億速云用戶服務條款》

oracle之 RA-00054: resource busy and acquire with NOWAIT

發(fā)布時間:2020-08-08 19:30:06 來源:ITPUB博客 閱讀:170 作者:張沖andy 欄目:關系型數(shù)據(jù)庫

1、 truncate 表報 ORA-00054 ,標明有事務正在操作該表
SQL> truncate table alldm.DM_XQKD_YUJING_D;
truncate table alldm.DM_XQKD_YUJING_D
*
ERROR at line 1:
ORA-00054: resource busy and acquire with NOWAIT specified or timeout expired

2、 找到正在操作該表的session與sql
SQL> set linesize 400
SQL> set pagesize 400
SQL> col object_name for a40
SQL> select OWNER,OBJECT_NAME,OBJECT_ID from dba_objects where object_name='DM_XQKD_YUJING_D';

OWNER OBJECT_NAME OBJECT_ID
------------------------------ ---------------------------------------- ----------
ALLDM DM_XQKD_YUJING_D 7525915

SQL> select SESSION_ID,OBJECT_ID from v$locked_object where OBJECT_ID = '7525915';

SESSION_ID OBJECT_ID
---------- ----------
2226 7525915

SQL> set linesize 400
SQL> set pagesize 400
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; 
Enter value for sid: 2226
old 3: and a.sid=&sid order by piece
new 3: and a.sid=2226 order by piece

SQL_TEXT
----------------------------------------------------------------
INSERT /*+APPEND*/ INTO DM_XQKD_YUJING_D SELECT /*+ORDERED*/ :B2
, A.AREA_NO, A.CITY_NO, A.XIAOQU_NO PLOT_ID, A.XIAOQU_NAME PLOT

3、 找到該session的os進程
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
/

USERNAME SID SERIAL# OS Process Logon time OSUSER PROGRAM STATUS
------------------------------ ---------- ---------- ------------------------ ------------------- ------------------------------ ------------------------------------------------ --------
ALLDM 2226 28311 76949 13/01/2018 06:04:24 bca JDBC Thin Client ACTIVE

4、 kill session
SQL> alter system kill session '2226,28311';
System altered.

5、 在os層面核實進程是否被kill
oracle@hbdw1:/oratmp$ps -ef | grep 76949
oracle 11057 116412 0 16:21 pts/2 00:00:00 grep 76949

6、 再次truncate成功
SQL> truncate table alldm.DM_XQKD_YUJING_D;
Table truncated.

向AI問一下細節(jié)

免責聲明:本站發(fā)布的內(nèi)容(圖片、視頻和文字)以原創(chuàng)、轉(zhuǎn)載和分享為主,文章觀點不代表本網(wǎng)站立場,如果涉及侵權(quán)請聯(lián)系站長郵箱:is@yisu.com進行舉報,并提供相關證據(jù),一經(jīng)查實,將立刻刪除涉嫌侵權(quán)內(nèi)容。

AI