Records in Oracle data are locked by another user

Source: Internet
Author: User

Reason: PL/SQL inside the execution of the statement execution for a long time without results, and then interrupt execution, and then directly on the above to change the field, in the point hook (note changes) when prompted, the record is locked by another user.

Workaround:

The first step: (just to see which tables are locked, what really works is the second and third steps)

Select B.owner,b.object_name,l.session_id,l.locked_mode
From V$locked_object L, dba_objects b
where b.object_id=l.object_id

Shown below:

OWNER object_name session_id Locked_mode

1 BSZCGL tdispose_accept_f 1115 3
2 BSZCGL tdispose_accept_f 1097 3
3 BSZCGL tdispose_accept_z 1116 3
4 BSZCGL tdispose_accept_z 1111 3
5 BSZCGL tdispose_accept_z 1103 3
6 BSZCGL tdispose_accept_z 1100 3
7 BSZCGL tdispose_accept_z 1097 3
8 BSZCGL tdispose_accept_z 1092 3
9 BSZCGL tdispose_damage_z 1106 3
BSZCGL TZC6_22CL 1097 3

As you can see, those tables are locked.

Step Two:

Select T2.username,t2.sid,t2.serial#,t2.logon_time
From V$locked_object t1,v$session T2
where T1.session_id=t2.sid order by T2.logon_time;

Shown below:

USERNAME SID serial# Logon_time

1 bszcgl   1115   132   2011-12-6 14:51:35
2  Bszcgl   1097   116   2011-12-6 14:51:57
3 BSZCGL    1097   116   2011-12-6 14:51:57
4 bszcgl    1097   116   2011-12-6 14:51:57
5 bszcgl   1111    155   2011-12-6 14:56:29
6 bszcgl   1103   292    2011-12-6 14:57:34
7 bszcgl   1116   388    2011-12-6 15:04:56
8 bszcgl   1100   240   2011-12-6 15:08:13
9 bszcgl   1106   228   2011-12-6 15:26:20
10  bszcgl  1092   10    2011-12-6 15:26:46

Step three: (key)

Execution: (Alter system kill session ' sid,serial# ') specific as follows:

Alter system kill session ' 1115,132 '

Alter system kill session ' 1097,116 '

Alter system kill session ' 1111,155 '

Alter system kill session ' 1103,292 '

Alter system kill session ' 1116,388 '

Alter system kill session ' 1100,240 '

Alter system kill session ' 1106,228 '

Alter system kill session ' 1092,10 '

Successful execution, will prompt execution finished!

It is possible to execute one after another, the other ID also disappeared, after the execution of 3, in the execution of 2, check the time to clear the end

Records in Oracle data are locked by another user

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.