?
Solved

Kill Oracle Sessions

Posted on 2014-11-14
7
Medium Priority
?
267 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
7 Comments
 
LVL 77

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 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
What is SQL Server and how does it work?

The purpose of this paper is to provide you background on SQL Server. It’s your self-study guide for learning fundamentals. It includes both the history of SQL and its technical basics. Concepts and definitions will form the solid foundation of your future DBA expertise.

 

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 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

NEW Veeam Agent for Microsoft Windows

Backup and recover physical and cloud-based servers and workstations, as well as endpoint devices that belong to remote users. Avoid downtime and data loss quickly and easily for Windows-based physical or public cloud-based workloads!

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…
Checking the Alert Log in AWS RDS Oracle can be a pain through their user interface.  I made a script to download the Alert Log, look for errors, and email me the trace files.  In this article I'll describe what I did and share my script.
This video explains at a high level with the mandatory Oracle Memory processes are as well as touching on some of the more common optional ones.
Via a live example, show how to restore a database from backup after a simulated disk failure using RMAN.
Suggested Courses

801 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