ORACLE KILL SESSION

Source: Internet
Author: User

ORACLE Database kill session operation

 

Bytes ---------------------------------------------------------------------------------------------
-- 1. view the locked table
Bytes ---------------------------------------------------------------------------------------------


Select/* + rule */
Lpad ('', decode (l. xidusn, 0, 3, 0) | l. oracle_username user_name,
O. owner,
O. object_name,
O. object_type,
S. sid,
S. serial #,
P. spid,
'Alter system kill session ''' | s. sid | ',' | s. serial # | ''''
From v $ locked_object l, dba_objects o, v $ session s, v $ process p
Where l. object_id = o. object_id
And l. session_id = s. sid
And s. paddr = p. addr
Order by o. object_id, xidusn desc;


Bytes ---------------------------------------------------------------------------------------------
-- 2. Unlock
Bytes ---------------------------------------------------------------------------------------------


-- Alter system kill session '2017 64 ';

 

Bytes ----------------------------------------------------------------------------------------------
-- 3. view the SQL statement executed by the session according to the SID
Bytes ----------------------------------------------------------------------------------------------


Select *
From v $ sqltext v
Where v. HASH_VALUE =
(Select c. SQL _HASH_VALUE from v $ session c where c. SID = 587)
Order by piece;


Bytes ----------------------------------------------------------------------------------------------
-- 4. kill session
Bytes ----------------------------------------------------------------------------------------------

Run the following command in linux:

Kill-9 spid;

Run the following command in windows:

Orakill sid spid

Author: "mikemoon's column"

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.