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"