Database query lock table and SQL to unlock table

Source: Internet
Author: User

Before the operation of the program, the sudden occurrence of the page card dead, the background does not error, after troubleshooting is the database table is locked dead, the following SQL is the query is locked table, as well as the corresponding unlock SQL;

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;

Select B.username,b.sid,b.serial#,logon_time from V$locked_object a,v$session b where a.session_id = B.sid ORDER by B.logo N_time;

Alter system kill session ' 300,37803 ';

SELECT S.sid, s.serial#, S.username, S.schemaname, S.osuser, s.process, S.machine,

S.terminal, S.logon_time, L.type

From V$session S, V$lock l

WHERE S.sid = L.sid

And S.username is not NULL

ORDER by Sid;


Database query lock table and SQL to unlock 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.