Oracle unlock, Oracle lock table processing

Source: Internet
Author: User

1. See which objects are locked

Select S.username,       decode (l.type, ' TM ', ' TABLE   lock ', ' TX ', ' ROW   lock ', NULL) lock_level,       O.owner,       O.object_name,       o.object_type,       s.sid,       s.serial#,       s.terminal,       s.machine       , S.program,       S.osuser from  v$session S, v$lock l, dba_objects o where s.sid = L.sid and   o.object_id = l.id1
   and s.username is not null;

2. The following statement is used to kill a process:

Alter system kill session ' 33,456 '; ---33,456 of them are sid,serial# of the above query.

3, once again query the currently locked objects, if found that the above method can not unlock the table, the following methods:

(1) Execute the following statement to get the process (thread) Number:

Select spid, Osuser, S.program  from V$session S, v$process p where s.paddr = P.addr   and S.SID =;---33 is the SID above

(2) Kill the process on the OS

Linux:

Kill-9 3333 (3333 for process number)

Windows (Unix also applies) kills threads with Orakill, Orakill is an executable command provided by Oracle, syntax: Orakill SID thread

  Sid: Indicates the instance name of the process to be killed thread : The number of threads to be killed, that is, the SPID that is queried in step 3rd.   

Cases:

C:>orakill ORCL 3333

Oracle unlock, Oracle lock table processing

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.