Processing of table deadlocks in Oracle

Source: Internet
Author: User
During Oracle database management, tables are often locked due to unreasonable operations on data tables. The following describes how to find which tables are locked.

During Oracle database management, tables are often locked due to unreasonable operations on data tables. The following describes how to find which tables are locked.

During Oracle database management, tables are often locked due to unreasonable operations on data tables. The following describes how to find which tables are locked by which users, and how to unlock:

1. Find the locked table:

Select object_name, session_id, OS _user_name, oracle_username, process, locked_mode, status

From v $ locked_object l, all_objects

Where l. object_id = a. object_id;

If you want to know which process is blocked, you can view the following statement:

Select username, v $ lock. sid, trunc (id1/power (2, 16) rbs, bitand (id1, to_number ('ffff', 'xxxx') + 0 slot, id2 seq, lmode, request from v $ lock, v $ session where v $ lock. type = 'tx 'and v $ lock. sid = v $ session. sid and v $ session. username = 'center ';

Or

Select

(Select username | ':' | sid | ':' | serial # from v $ session where sid = a. sid) |

'Blocked '|

(Select username | ':' | sid | ':' | serial # from v $ session where sid = B. sid)

From v $ lock a, v $ lock B

Where a. block = 1

And B. request> 0

And a. id1 = B. id1

And a. id2 = B. id2;

,

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.