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

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 hh24: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.

(0)
上一篇 2022年3月22日
下一篇 2022年3月22日

相关推荐