文章详情

  • 游戏榜单
  • 软件榜单
关闭导航
热搜榜
热门下载
热门标签
php爱好者> php文档>ora-00054:resource busy and acqui..

ora-00054:resource busy and acqui..

时间:2010-09-20  来源:marvelyu

 数据库用户在数据库中truncate表时,常常会出现ora-00054:resource busy and acquire with nowait specified这样的错误。主要是因为有事务正在执行(或者事务已经被锁),所有导致执行不成功。

 1、用sysdba权限的用户查看数据库都有哪些锁
 SQL> 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
---------- -------------------
ATM                                                                  19
       359 2010-05-24 10:23:56 

2。 根据sid查看具体的sql语句,如果sql不重要,可以kill

SQL> 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: 19
old   3:   and a.sid=&sid order by piece
new   3:   and a.sid=19 order by piece

 

SQL_TEXT
--------------------------------------------------------------------------------
insert into atm1_collectconfiglog (id,collecttype,collectdate,co
llectdataid,collectdataname,collectaction,collectcontent) values
 ((select decode(max(id)+1,'','1',max(id)+1) from atm1_collectco
nfiglog),'ATM1_Circuit',sysdate,'439612','BJ3G_s5p5_vp3c123-FJXM
1B2_s7p5_d123_CCS','update','更新:电路ID439612,更新电路名称:BJ3
G_s5p5_vp3c123-FJXM1B2_s7p5_d123_CCS,更新电路带宽:262144')

6 rows selected.

 

3、kill该事务

SQL> alter system kill session '19,359';

 

alter system kill session '19,359'
*
ERROR at line 1:
ORA-00031: session marked for kill

不行,需要这样做:

 

SQL>select 'kill -9  ' ||SPID||  from v$process where addr in (select PADDR from v$session where sid=&sid and SERIAL#=&serial);

 

后执行

SQL> truncate table atm.atm1_collectconfiglog;

 

Table truncated.
 

 

 

 

 

 

相关阅读 更多 +
排行榜 更多 +
辰域智控app

辰域智控app

系统工具 下载
网医联盟app

网医联盟app

运动健身 下载
汇丰汇选App

汇丰汇选App

金融理财 下载