How Oracle views the deadlock ____oracle

Source: Internet
Author: User
Tags dba

Oracle deadlock problem has been bothering us, here is a way to teach you the Oracle deadlock, if you have encountered the Oracle deadlock problems, may wish to see ...

Oracle deadlock problem has been bothering us, here is a way to teach you the Oracle deadlock, if you have encountered Oracle deadlock problems, it may be a look.

First, the phenomenon of database deadlock

Program in the process of execution, click OK or save the button, the program is not responding, there is no error.

Second, the principle of Oracle deadlock

When you do an update or delete on a column of a table in a database, after the execution of the statement does not commit, another for this column of data to do the update operation of the statement will be in the waiting state, at this time the phenomenon is that the statement has been executed, but has not executed successfully, there is no error.

Three, Oracle deadlock positioning method

By checking the database table, you can check which statement is deadlocked, which is the machine that produces the deadlock.

1 Execute the following statement with the DBA user

The following is a code fragment:
Select Username,lockwait,status,machine,program from v$session where SID in
(select session_id from V$locked_object)

If there is a result of the output, then there is a deadlock, and can see the deadlock machine is which. Field Description:

Username: The database user used by the deadlock statement;

Lockwait: The state of the deadlock, if there is content to indicate a deadlock.

Status: State, active indicates deadlock

Machine: The machine where the deadlock statement resides.

Program: Which application is the main source of the statement that generated the deadlock.

2 Execute the following statement with the DBA user to view the statement that is deadlocked.

The following is a code fragment:
Select Sql_text from V$sql where Hash_value in
(select Sql_hash_value from v$session where SID in
(select session_id from V$locked_object))
--This article from: http://dev.yesky.com/450/30971950.shtml
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.