Query and unlock lock table records in Oralce

Source: Internet
Author: User

Query and unlock lock table records in Oralce

First, query the tables that are locked.
 
Select B. owner, B. object_name, a. session_id, a. locked_mode
From v $ locked_object a, dba_objects B
Where B. object_id = a. object_id;

Query the sid and serial of the locked table # Then kill
 
Select B. username, B. sid, B. serial #, logon_time
From v $ locked_object a, v $ session B
Where a. session_id = B. sid and sid in (
Select a. SESSION_ID
From v $ locked_object a, dba_objects B
Where B. object_id = a. object_id) order by B. logon_time

Unlock
 
Alter system kill session '2010 3' immediate; (589,269 is sid, 589 is serial)

In addition, you must have the database management permission to perform this operation. Otherwise, the database cannot be unlocked.

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.