0% found this document useful (0 votes)
8 views

Kill Session Process

Uploaded by

krishna
Copyright
© © All Rights Reserved
Available Formats
Download as TXT, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
8 views

Kill Session Process

Uploaded by

krishna
Copyright
© © All Rights Reserved
Available Formats
Download as TXT, PDF, TXT or read online on Scribd
You are on page 1/ 4

Following query gives details of all locks.

~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
SELECT B.Owner, B.Object_Name, A.Oracle_Username, A.OS_User_Name
FROM V$Locked_Object A, All_Objects B
WHERE A.Object_ID = B.Object_ID;

select
c.owner,
c.object_name,
c.object_type,
b.sid,
b.serial#,
b.status,
b.osuser,
b.machine
from
v$locked_object a ,
v$session b,
dba_objects c
where
b.sid = a.session_id
and
a.object_id = c.object_id;

Query to check the locks on table


~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~`

SELECT s.sid,
l.lock_type,
l.mode_held,
l.mode_requested,
l.lock_id1,
'alter system kill session '''|| s.sid|| ','|| s.serial#|| ''' immediate;'
kill_sid
FROM dba_lock_internal l,
v$session s
WHERE s.sid = l.session_id
AND UPPER(l.lock_id1) LIKE '%XXARB_ITEM_WARRANTY_EXT_PK%'
AND l.lock_type = 'Body Definition Lock'
/

Steps to Kill session on Darr3i instance


~~~~~~~~~~~~~~~~~~~~``

1)Connect to DB tier Example Darr3i instance


auohsarrv06.oracleoutsourcing.com-- DB

2)pbrun ohsdba -u ordarr3i

Example:

$ pbrun ohsdba -u ordarr3i


Successful login using -u option. If you want to allow X traffic please use -x
option.
Usage: /usr/local/bin/pbrun [policy] -x [target user]
su from sginyarp to ordarr3i at Wed Sep 3 04:51:54 CDT 2014

3) sqlplus '/as sysdba'

Example:

-bash-3.2$ sqlplus '/as sysdba'

4)
SQL> alter system kill session '887,11037' immediate;
alter system kill session '887,11037' immediate
*
ERROR at line 1:
ORA-00031: session marked for kill

It will take some time and kill the seeion to confirm please run the below step 5

5)SQL> @/ptsadmin/common/OHSMON/sessiondetails.sql

Details of SID / SPID / Client PID


==================================
Enter value for sid: 887 (Please provide only sid and press enter)
Enter value for spid:
Enter value for clientpid:

Session Id.............................................: 887


Serial Num..............................................: 11037
User Name ..............................................: APPS
Session Status .........................................: KILLED
Client Process Id on Client Machine ....................: *29376*
Server Process ID ......................................: 27389
Sql_Address ............................................: 00
Sql_hash_value .........................................: 0
Schema Name ..... ......................................: APPS
Program ...............................................: JDBC Thin Client
Module .................................................:
eam.stores.materialissue.server.EAMMaterialVerif
Action .................................................: 29376
Terminal ...............................................: unknown
Client Machine .........................................:
auohsarrv07.oracleoutsourcing.com
LAST_CALL_ET ...........................................: 87677
S.LAST_CALL_ET/3600 ....................................:
24.3547222222222222222222222222222222222

Chatting with ARUNA DBA


~~~~~~~~~~~~~~~~~~~~~`

(2:48:11 PM) vamsi.k.krishna: Hi Madam


(2:48:27 PM) aruna.Dba: hi vamsi
(2:48:27 PM) aruna.Dba: GA
(2:48:48 PM) vamsi.k.krishna: Madam need smal help
(2:49:11 PM) vamsi.k.krishna: We want to kill the seesion for one of the instance
(2:49:36 PM) vamsi.k.krishna: when we try to do it sys insufficient previleges
(2:49:54 PM) aruna.Dba: from command promt u can do it na
(2:49:59 PM) aruna.Dba: kill -9 session id
(2:50:18 PM) vamsi.k.krishna: alter system kill session '887,11037' immediate;
(2:50:25 PM) vamsi.k.krishna: we are using this madam
(2:50:28 PM) aruna.Dba: ok
(2:50:35 PM) vamsi.k.krishna: ERROR:
ORA-01031: insufficient privileges

(2:50:45 PM) vamsi.k.krishna: we are geting this error


(2:50:51 PM) aruna.Dba: as sysdba u or unable to?
(2:51:07 PM) vamsi.k.krishna: Enter user-name: SYS /as SYSDBA

(2:51:12 PM) vamsi.k.krishna: this is correct madam


(2:52:11 PM) aruna.Dba: sqlplus '/as sysdba'
(2:52:14 PM) aruna.Dba: use like this
(2:52:38 PM) aruna.Dba: then u can give that command
(2:52:48 PM) vamsi.k.krishna:
Enter user-name: sqlplus '/as sysdba'
$ alter system kill session '887,11037' immediate;
-ksh: alter: not found [No such file or directory]

(2:52:54 PM) vamsi.k.krishna: getting like this madam


(2:53:38 PM) aruna.Dba: first, u connect to sys, wait for sql promt
(2:53:43 PM) aruna.Dba: then u give the command
(2:55:10 PM) vamsi.k.krishna: madam calling u
(2:56:04 PM) vamsi.k.krishna: auohsarrv07.oracleoutsourcing.com - MT
(2:56:38 PM) vamsi.k.krishna:
DARR3I:

(3:08:04 PM) aruna.Dba: hi vamsi


(3:08:08 PM) aruna.Dba: plz call me once
(3:13:15 PM) vamsi.k.krishna: ok madam calling
(3:14:31 PM) aruna.Dba: -bash-3.2$ sqlplus '/as sysdba'

SQL*Plus: Release 11.1.0.7.0 - Production on Wed Sep 3 10:36:47 2014

Copyright (c) 1982, 2008, Oracle. All rights reserved.

Connected to:
Oracle Database 11g Enterprise Edition Release 11.1.0.7.0 - 64bit Production
With the Partitioning, OLAP, Data Mining and Real Application Testing options

SQL> alter system kill session '887,11037' immediate;


alter system kill session '887,11037' immediate
*
ERROR at line 1:
ORA-00031: session marked for kill

(3:14:45 PM) aruna.Dba: In some situations the Oracle.exe is not able to kill the
session immediately.�
In these cases the session will be "marked for kill". It will then be killed as
soon as possible.

(3:14:59 PM) aruna.Dba: -bash-3.2$ ps -ef | grep 887

(3:15:16 PM) aruna.Dba: SQL> @/ptsadmin/common/OHSMON/sessiondetails.sql


Details of SID / SPID / Client PID
==================================
Enter value for sid: 887
Enter value for spid:
Enter value for clientpid:

(3:15:45 PM) aruna.Dba: Session Id.............................................:


887
Serial Num..............................................: 11037
User Name ..............................................: APPS
Session Status .........................................: KILLED

(3:15:59 PM) vamsi.k.krishna: SELECT s.sid,


l.lock_type,
l.mode_held,
l.mode_requested,
l.lock_id1,
'alter system kill session '''|| s.sid|| ','|| s.serial#|| ''' immediate;'
kill_sid
FROM dba_lock_internal l,
v$session s
WHERE s.sid = l.session_id
AND UPPER(l.lock_id1) LIKE '%XXARB_ITEM_WARRANTY_EXT_PK%'
AND l.lock_type = 'Body Definition Lock'
/
(3:16:18 PM) vamsi.k.krishna: alter system kill session '887,11037' immediate;

You might also like