Resolving the Oracle deadlock problem, and why it occurs

Source: Internet
Author: User

Article Source: http://www.cnblogs.com/leijh/archive/2012/10/15/2724165.html

The recent height of the program is always found to execute the operation of the database code when found to execute, checked the discovery is the database table lock dead Reason,

, to correct the reason, found that some colleagues operating the database is always like to use SELECT * from the XXX for update

To operate the database, some operations and no commit so that the database is locked, pens are advised not to use, if you want to update after you remember to submit

How to resolve a deadlock

First step: Find the Locked table in the database

Select Object_id,session_id,locked_mode from V$locked_object;

Step two: Find the SID of the table serial#

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;

Step three: Kill the locked Watch

Alter system kill session ' sid,serial# ';

Another: Oracle9i later version has the ability to automatically handle the lock dead table!

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.