FRM-40501 ORACLE error: unable to reserve record for update or delete.

用户今天提交了一个无法删除的日记账,出错界面如下

经检查发现该数据记录在执行上次操作时没有完成,导致表内记录被锁定,因此需要程序kill锁定记录的session

解决方法如下:

/* Formatted on 2010/3/29 18:57:44 (QP5 v5.136.908.31019) Created By Chelsea Wang */

SELECT aob.object_name,

aob.object_id,

vob.process,

vob.session_id

FROM all_objects aob, v$locked_object vob

WHERE aob.object_id = vob.object_id

然后将session_id代入下程序中kill锁定记录的session

DECLARE

v_sid NUMBER := &sid;

v_SERIAL_id NUMBER;

sqlStmt VARCHAR2 (1000);

BEGIN

SELECT SERIAL#

INTO v_SERIAL_id

FROM v$session

WHERE SID = TO_CHAR (v_sid);

sqlStmt :=

‘ALTER SYSTEM KILL SESSION ”’

|| TO_CHAR (v_sid)

|| ‘,’

|| TO_CHAR (v_SERIAL_id)

|| ””;

EXECUTE IMMEDIATE sqlStmt;

END;

Advertisements

One thought on “FRM-40501 ORACLE error: unable to reserve record for update or delete.

  1. laith January 29, 2014 at 3:20 pm Reply

    I have the same error,,, help please
    http://www.uodiyala.edu.iq

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Google+ photo

You are commenting using your Google+ account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

w

Connecting to %s

%d bloggers like this: