Quickly kill session! remotely

Source: Internet
Author: User

Today there is a developed buddy a (not to disclose information, called a), asking questions in the group:
Table inserted Big data when the time stuck, a check found is locked, has killed session, but always unlocked, the state is killed, can not release the lock, and delete the operation of the table, also no, prompt resources are busy.
It was just a hasty saying:
Go directly to kill-9 spid in OS
Later the man sent me what to do:
I let him check: Select Spid,username,terminal,program from v$process where addr in (select Paddr from v$session where username= XXX);

A given:

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;

He also found me a:

Then let him execute under the OS:
kill-9 spid; (LINUX)
Orakill InstancesThread (Windows)
At this He said he is a remote database, and can not SSH login server host, this is a headache!
I asked him once more:
Alter system kill session ' 428,310 ';

Alter system kill session ' 727,862 ';

Alter system kill session ' 304,365 ';
The problem is not resolved at this time:



At this point a said has been resolved:
alter system kill session ' 727,862 ' immediate;Plus a mandatory immediate.


In general, when killing a session, direct alter system kill session ' sid,serial# '
When the session is still active, this is to identify the session as killed or pseudo, and does not release the resources held by the sessions, so the conversation persists ( theALTER SYSTEMstatement does not implicitly commits the current transaction.)
On the official website: (http://docs.oracle.com/cd/E11882_01/server.112/e41084/statements_2014.htm#SQLRF00902)
If The session is performing some activity this must be completed, such as waiting for a reply from a remote database Or rolling back a transaction, then Oracle Database waits for this activity to complete, marks the session as terminated, And then returns control to you. If The waiting lasts a minute, then Oracle Database marks the session to being terminated and returns control to you with a M Essage The session is marked to be terminated. thePmonbackground Process then marks the session as terminated when the activity was complete.
IMMEDIATESpecifyIMMEDIATETo instruct Oracle Database to roll back ongoing transactions, release all session locks, recover the entire session State, and return control to immediately.
Learned through the above how to kill the session remotely, usually accustomed to rely on OS commands, just today on a lesson! And thanks a!

Quickly kill session! remotely

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.