Terminating Sessions and Cleaning Up ProcessesThis module describes how you can terminate sessions and clean up session-related operating system processes. Show This module discusses the following:
Back to List of Topics In this module you will learn how to terminate sessions using SQL*Plus and Enterprise Manager. You should always terminate user sessions using Oracle tools. However, if the operating system process related to a terminated Oracle user session remains active, you can kill the session-related operating system process by following the appropriate steps for your operating system: Back to List of Topics You can terminate sessions with the ALTER SYSTEM KILL command. When you issue the ALTER SYSTEM KILL session command, you must specify the session's index number and serial number. To identify the session index number (sid) and serial number of a session, query the V$SESSION dynamic performance view as shown below. The value of the STATUS column will be ACTIVE when the session is making a SQL call to Oracle. It will be INACTIVE if it is not making a SQL call to Oracle. Identify the correct session and terminate the session by performing the steps below:
Back to List of Topics Identify the correct session and terminate the session by performing the steps below. Note: Oracle Enterprise Manager 9.2 was used in the examples.
Back to List of Topics The PMON background process will clean up after any user session you terminate with the ALTER SYSTEM KILL SESSION command. You can kill the session-related operating system process by performing the steps outlined below:
Back to List of Topics The PMON background process will clean up after any user session you terminate with the ALTER SYSTEM KILL SESSION command. You can kill the session-related operating system process by performing the steps outlined below:
Move your mouse over this icon to hide all screenshotsCan we kill inactive session in Oracle?You can terminate sessions with the ALTER SYSTEM KILL command. When you issue the ALTER SYSTEM KILL session command, you must specify the session's index number and serial number. To identify the session index number (sid) and serial number of a session, query the V$SESSION dynamic performance view as shown below.
What does Inactive session mean in Oracle?It just means that someone is logged in but not executing SQL right at that instant. Your very own session is "INACTIVE" everytime you are in the process of typing in a query via sqlplus. It is a normal state to be in.
Why are there so many inactive sessions in Oracle?Large numbers of long term inactive sessions are typically caused by problems with an application or an application server not handling its connections properly. The obvious thing to do is correct the problem at the source.
How do I kill an inactive session?Update If you want to kill all the sessions, you could just prepare a small script. SELECT 'ALTER SYSTEM KILL SESSION '''||sid||','||serial#||''' IMMEDIATE;' FROM v$session; Spool the above to a . sql file and execute it, or, copy paste the output and run it.
|