Solved

Kill Oracle Sessions

Posted on 2014-11-14
7
250 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 36

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

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.

Join & Write a Comment

Subquery in Oracle: Sub queries are one of advance queries in oracle. Types of advance queries: •      Sub Queries •      Hierarchical Queries •      Set Operators Sub queries are know as the query called from another query or another subquery. It can …
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 shows how to copy a database user from one database to another user DBMS_METADATA.  It also shows how to copy a user's permissions and discusses password hash differences between Oracle 10g and 11g.
This video shows how to Export data from an Oracle database using the Original Export Utility.  The corresponding Import utility, which works the same way is referenced, but not demonstrated.

747 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

13 Experts available now in Live!

Get 1:1 Help Now