Oracle resolves lock-table problem ____oracle

Source: Internet
Author: User
Preface

Update the data for one table, on hundreds of, and then especially slowly, all the time, and then force it to return, again or again, taking into account the possibility of locking the table. Solve

① first finds which sessions 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;

After finding out, three objects were found.
② then kills the three objects one by one:

Alter system kill session ' 13,52136 ';
--Here's 13 is the sid,52136 detected by the top serial

Then there's another problem, and I'm going to check it again, the SID 13 session is still there, but the state is killed, I execute ALTER system kill session ' 13,52136 '; Ora-00031:session marked for Kill (marks the session to terminate)

The resource locked on the server database is still not released, at which point we can go to the server to kill the process.
first Identify the process number spid:

Select spid, Osuser, s.program from
v$session s,v$process p
where s.paddr=p.addr and s.sid=13;   --spid=5162

and then kill the process based on the SPID of the query.
1. Linux os:kill-9 5162
2. Windows Os:orakill Mars 5162, where Mars is the instance name to kill the process.
open cmd under Windows, and enter a command tasklist/svc to view the service name of PID 5162, the instance name.

Here are three concepts:

The SPID one by one system process ID that
represents the Porcess ID of the server process at the OS level, that is, the operating system process ID
pid One by one Oracle process ID
Oracle process ID SID one by one session identity, which can be understood for Oracle's own use, is
commonly used to connect other columns

Reference Articles:
Ora-00031:session marked for kill handle locks that cannot be killed in Oracle
Oracle Lock Table Processing

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.