Solved

Kill Oracle Sessions

Posted on 2014-11-14
7
255 Views
Last Modified: 2014-12-02
If i have a script that kills all sessions that are not owned by 'SYS%'
should there be associated PID(s) at the os level that die as a result?
oracle   18618     1  0 Nov13 ?        00:00:14 oracleBB60 (LOCAL=NO)
oracle   18620     1  0 Nov13 ?        00:00:22 oracleBB60 (LOCAL=NO)
oracle   18636     1  0 Nov13 ?        00:00:37 oracleBB60 (LOCAL=NO)
oracle   18719     1  0 Nov13 ?        00:00:13 oracleBB60 (LOCAL=NO)
oracle   18721     1  0 Nov13 ?        00:00:13 oracleBB60 (LOCAL=NO)
oracle   18724     1  0 Nov13 ?        00:00:14 oracleBB60 (LOCAL=NO)
oracle   18767     1  0 Nov13 ?        00:03:03 oracleBB60 (LOCAL=NO)
oracle   18769     1  0 Nov13 ?        00:00:22 oracleBB60 (LOCAL=NO)
oracle   18778     1  0 Nov13 ?        00:00:39 oracleBB60 (LOCAL=NO)
oracle   18889     1  0 Nov13 ?        00:00:12 oracleBB60 (LOCAL=NO)
oracle   20552     1  0 Nov13 ?        00:00:00 oracleBB60 (LOCAL=NO)
oracle   25601 25592  0 Nov12 pts/0    00:00:00 -bash
oracle   27065     1  0 Nov12 ?        00:00:00 ora_pmon_BB60
oracle   27067     1  0 Nov12 ?        00:00:00 ora_psp0_BB60
oracle   27081     1  0 Nov12 ?        00:00:00 ora_vktm_BB60
oracle   27087     1  0 Nov12 ?        00:00:00 ora_gen0_BB60
oracle   27089     1  0 Nov12 ?        00:00:00 ora_diag_BB60
oracle   27091     1  0 Nov12 ?        00:00:00 ora_dbrm_BB60
oracle   27093     1  0 Nov12 ?        00:03:50 ora_dia0_BB60
oracle   27095     1  0 Nov12 ?        00:00:03 ora_mman_BB60
oracle   27097     1  0 Nov12 ?        00:00:44 ora_dbw0_BB60
oracle   27099     1  0 Nov12 ?        00:01:01 ora_dbw1_BB60
oracle   27101     1  0 Nov12 ?        00:04:20 ora_lgwr_BB60
oracle   27103     1  0 Nov12 ?        00:00:53 ora_ckpt_BB60
0
Comment
Question by:xoxomos
7 Comments
 
LVL 77

Accepted Solution

by:
slightwv (䄆 Netminder) earned 500 total points
ID: 40443161
>>should there be associated PID(s) at the os level that die as a result?

If you use 'alter system kill session' then the OS process should also go away when Oracle has actually removed the session.  Some times the session is 'marked for kill' and remains until Oracle has cleaned it up.

There is another possibility:  If the applications use connection pooling, the app may spin up new sessions after you've kill all the existing ones.

The ones like this should be possible user connections (not server processes):
oracle   18618     1  0 Nov13 ?        00:00:14 oracleBB60 (LOCAL=NO)

You need to take the pid,18618 in the above example and see what session in the database that refers to.
0
 

Author Comment

by:xoxomos
ID: 40443257
WOW!  THANK YOU!!
0
 
LVL 13

Expert Comment

by:Alexander Eßer [Alex140181]
ID: 40443548
And, for heaven's sake, do NOT kill any of these background processes:
oracle   27065     1  0 Nov12 ?        00:00:00 ora_pmon_BB60
oracle   27067     1  0 Nov12 ?        00:00:00 ora_psp0_BB60
oracle   27081     1  0 Nov12 ?        00:00:00 ora_vktm_BB60
oracle   27087     1  0 Nov12 ?        00:00:00 ora_gen0_BB60
oracle   27089     1  0 Nov12 ?        00:00:00 ora_diag_BB60
oracle   27091     1  0 Nov12 ?        00:00:00 ora_dbrm_BB60
oracle   27093     1  0 Nov12 ?        00:03:50 ora_dia0_BB60
oracle   27095     1  0 Nov12 ?        00:00:03 ora_mman_BB60
oracle   27097     1  0 Nov12 ?        00:00:44 ora_dbw0_BB60
oracle   27099     1  0 Nov12 ?        00:01:01 ora_dbw1_BB60
oracle   27101     1  0 Nov12 ?        00:04:20 ora_lgwr_BB60
oracle   27103     1  0 Nov12 ?        00:00:53 ora_ckpt_BB60

This one might be interesting to read:
https://docs.oracle.com/cd/E11882_01/server.112/e40402/bgprocesses.htm#REFRN104
0
PRTG Network Monitor: Intuitive Network Monitoring

Network Monitoring is essential to ensure that computer systems and network devices are running. Use PRTG to monitor LANs, servers, websites, applications and devices, bandwidth, virtual environments, remote systems, IoT, and many more. PRTG is easy to set up & use.

 

Author Comment

by:xoxomos
ID: 40443640
Thanks.  Right.  I've got a couple ways where i avoid that......WHERE username NOT LIKE 'SYS%'
or sticking to oracleBB60(s)
0
 
LVL 37

Expert Comment

by:Geert Gruwez
ID: 40444435
why not restart the instance
and if you don't want anyone to logon, stop the listener first
0
 
LVL 77

Expert Comment

by:slightwv (䄆 Netminder)
ID: 40445039
>> if you don't want anyone to logon, stop the listener first

That just stops new sessions/processes.  If the app uses connection pooling and has spun up the pool of available connections, I'm not sure it will stop the app users from connecting.

Never thought to test that one...
0
 

Author Closing Comment

by:xoxomos
ID: 40477871
Forgot to close.  Yes, it looks like the '...another possibility...,
0

Featured Post

Free Tool: IP Lookup

Get more info about an IP address or domain name, such as organization, abuse contacts and geolocation.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Title # Comments Views Activity
SQL Query 34 116
use lov values 2 64
Oracle Forms 10g: How-To Prevent a Commit of 1 Record in Master-Detail block. 3 56
update statement in oracle 9 30
How to Create User-Defined Aggregates in Oracle Before we begin creating these things, what are user-defined aggregates?  They are a feature introduced in Oracle 9i that allows a developer to create his or her own functions like "SUM", "AVG", and…
How to Unravel a Tricky Query Introduction If you browse through the Oracle zones or any of the other database-related zones you'll come across some complicated solutions and sometimes you'll just have to wonder how anyone came up with them.  …
Via a live example, show how to take different types of Oracle backups using RMAN.
This videos aims to give the viewer a basic demonstration of how a user can query current session information by using the SYS_CONTEXT function

821 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question