How to deal with Oracle locks that cannot be killed

Source: Internet
Author: User

How to deal with Oracle locks that cannot be killed:

1. The following statement is used to query which objects are locked:

Select object_name, machine, s. sid, s. serial #

From v $ locked_object l, dba_objects o, v $ session s

Where l. object_id = o. object_id and l. session_id = s. sid;

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

Alter system kill session 24,111; (24,111 of which are the sid found above, serial #)

Note: The preceding two steps can be performed on the oracle console.

3. if the process state is set to "killed" after a process is killed by using the preceding command, but the locked resources are not released for a long time, then the corresponding process thread can be killed at the OS level). First, execute the following statement to obtain the process thread) Number:

Select spid, osuser, s. program

From v $ session s, v $ process p

Where s. paddr = p. addr and s. sid = 24 is the sid above)

4. Kill this process thread on the OS ):

1) run the command as root on unix:

# Kill-9 12345 refers to the spid obtained in step 1)

2) It is also applicable in Windows Unix.) Use orakill to kill a thread. orakill is an executable Command provided by oracle. The syntax is as follows:

Orakill sid thread

Where:

Sid: indicates the Instance name of the process to be killed.

Thread: the ID of the thread to be killed, that is, the spid obtained in step 1.

Example: c:> orakill orcl 12345
Through the above method, we can deal with the locks that cannot be eliminated in Oracle, which brings great convenience to the future work.

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.