Handling of locking when updating ORACLE Data

Source: Internet
Author: User

When we operate databases, database tables may be locked due to improper operations, so we are often at a loss and do not know how to unlock these tables, the "sessions" in the menu "tools" of pl/SQL Developer can query existing sessions, but it is difficult to find that session is locked, it is more difficult to find the locked session.

The following is a simple and easy-to-use process of unlocking an effective kill process through the combination of online materials and on-site environment:

View the locked table:

SELECT p. spid,
C. object_name,
B. session_id,
A. serial #,
B. oracle_username,
B. OS _user_name
FROM v $ process p, v $ session a, v $ locked_object B, all_objects c
WHERE p. addr = a. paddr
AND a. process = B. process
AND c. object_id = B. object_id;

Record the queried session_id and serial # and use the following statement to unlock them.

Unlock:
Alter system kill session 'B. session_id, a. serial #';


If the unlock fails, you can try to end the process at the operating system level (powerful, use with caution)

[Windows] ntsd-c q-pp. spid
[Linux] ps-ef | grepp. spid

In linux, KILL the system process first. In some cases, kill-9 spid is used.

I have used the above methods to solve this problem several times and have not encountered any invalid problems yet.

I hope to help you.

Related Article

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.