Processing of Oracle Stubborn killed State Sessions

Source: Internet
Author: User

Recently, a large volume of data stored in the process is interrupted, resulting in a lock on a table. Now I want to modify the stored procedure, because the lock exists and remains waiting.

In PL/SQL developer, set the session status to killed. After waiting for a long time, the result is not cleared by pmon, and the lock table remains there. For more information, use the following methods to unlock your account.

-- In the following SQL statement, you can list all scripts and enter sid. This Sid can be found in session of PL/SQL developer.

Select 'alter system kill session ''' | ta. Sid | ',' | ta. Serial # | ''';',
'Alter system disconnect session ''' | ta. Sid | ',' | ta. Serial # | ''' immediate ;',
'Host orakill' | TC. instance_name | ''| TB. spid,
'Kill-9' | TB. spid,
TB. spid,
Ta. osuser,
TB. program,
Ta. Terminal,
Ta. Program
From v $ session Ta, V $ process TB, V $ instance TC
Where TB. ADDR = TA. paddr
And ta. Sid = & yoursid;

-- You can also use the script provided by Metalink. The OS thread is the spid written at orakill.

Select P. spid "OS thread", B. Name "name-user", S. osuser, S. Program
From v $ PROCESS p, V $ session S, V $ bgprocess B
Where p. ADDR = S. paddr
And P. ADDR = B. paddr Union all
Select P. spid "OS thread", S. username "name-user", S. osuser, S. Program
From v $ PROCESS p, V $ session s
Where p. ADDR = S. paddr
And S. username is not null;

Then execute C:/> orakill oracle_sid OS _thread to kill the killed process. Do not kill system processes to avoid database downtime.

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.