?
Solved

Kill Oracle Sessions

Posted on 2014-11-14
7
Medium Priority
?
282 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 78

Accepted Solution

by:
slightwv (䄆 Netminder) earned 2000 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 14

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
Technology Partners: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

 

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 38

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 78

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

Concerto Cloud for Software Providers & ISVs

Can Concerto Cloud Services help you focus on evolving your application offerings, while delivering the best cloud experience to your customers? From DevOps to revenue models and customer support, the answer is yes!

Learn how Concerto can help you.

Question has a verified solution.

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

Why doesn't the Oracle optimizer use my index? Querying too much data Most Oracle developers know that an index is useful when you can use it to restrict your result set to a small number of the total rows in a table. So, the obvious side…
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…
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.
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
Suggested Courses
Course of the Month8 days, 4 hours left to enroll

616 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