Solved

Kill Oracle Sessions

Posted on 2014-11-14
7
254 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 76

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 76

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

Live: Real-Time Solutions, Start Here

Receive instant 1:1 support from technology experts, using our real-time conversation and whiteboard interface. Your first 5 minutes are always free.

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
oracle 11g 23 73
Need help with fine tuning the windows batch script to change password 9 29
Use of Exception to end a Loop 3 31
create a nested synonym 4 23
Note: this article covers simple compression. Oracle introduced in version 11g release 2 a new feature called Advanced Compression which is not covered here. General principle of Oracle compression Oracle compression is a way of reducing the d…
From implementing a password expiration date, to datatype conversions and file export options, these are some useful settings I've found in Jasper Server.
This video explains at a high level about the four available data types in Oracle and how dates can be manipulated by the user to get data into and out of the database.
Via a live example, show how to restore a database from backup after a simulated disk failure using RMAN.

815 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

Need Help in Real-Time?

Connect with top rated Experts

9 Experts available now in Live!

Get 1:1 Help Now