Kill session and process
Hi,
There are many answers in this forum related with my question but could not complete answer.
I have problem with process count in db. Firstly I killed sessions
alter system kill session 'xxx,yyyy';
and then queried v$session. The status of sessions were changed as killed but in v$process it showed that the count of process same as before.
So I decided to create profile and set idle time.
select * from v$resource_limit
RESOURCE_NAME CURRENT_UTILIZATION MAX_UTILIZATION INITIAL_ALLOCATION LIMIT_VALUE
processes 459 466 500 500
sessions 459 467 555 555
select * from dba_profiles
PROFILE RESOURCE_NAME RESOURCE_TYPE LIMIT
myUser_PROFILE IDLE_TIME KERNEL 2880 (2 days)
select username,profile from dba_users
USERNAME PROFILE
myUser myUser_PROFILE
select
p.spid,
s.username,
s.sid,
s.serial#,
to_char(s.logon_time, 'Dy dd Mon HH24:MI:SS') start_time,
s.status
from V$PROCESS p, V$SESSION s
where s.paddr = p.addr
and s.username is not null;
SPID USERNAME SID SERIAL# START_TIME STATUS
3880 myUser 181 102 Wed 24 Mar 19:37:10 SNIPED
5135 myUser 71 190 Wed 24 Mar 20:41:00 SNIPED
5259 myUser 422 3,794 Wed 24 Mar 20:47:31 SNIPED
5666 myUser 189 197 Wed 24 Mar 21:15:35 SNIPED
32109 myUser 421 3,746 Thu 25 Mar 21:57:07 SNIPED
32371 myUser 344 10,518 Thu 25 Mar 22:16:31 SNIPED
32395 myUser 65 28 Thu 25 Mar 22:18:01 SNIPED
32518 myUser 35 205 Thu 25 Mar 22:23:37 SNIPED
19703 myUser 40 18 Fri 26 Mar 21:03:24 SNIPED
19870 myUser 242 106 Fri 26 Mar 21:12:05 SNIPED
19965 myUser 212 11,276 Fri 26 Mar 21:19:10 SNIPED
23054 myUser 215 535 Sat 27 Mar 00:08:01 SNIPED
23668 myUser 17 6,237 Sat 27 Mar 00:48:25 SNIPED
26200 myUser 218 1,323 Sat 27 Mar 03:44:07 SNIPED
18830 myUser 388 256 Sun 28 Mar 00:40:10 INACTIVE
18894 myUser 177 461 Sun 28 Mar 00:41:35 INACTIVE
18954 myUser 357 36 Sun 28 Mar 00:45:09 INACTIVE
19124 myUser 52 325 Sun 28 Mar 00:53:38 INACTIVE
14697 myUser 448 2 Mon 29 Mar 00:06:05 INACTIVE
14741 myUser 447 6 Mon 29 Mar 00:07:53 INACTIVE
14786 myUser 449 3 Mon 29 Mar 00:09:26 INACTIVE
8678 SYS 461 10,762 Mon 29 Mar 10:45:00 ACTIVEI think pmon should kill process related with killed session but it does not.
Please explain me how it happens,what should I do.
After while I will again get error as 'ORA-00020: maximum number of processes (%s) exceeded'
Thanks in advance
Edited by: catastrophe on Mar 28, 2010 11:24 PM
Hi,
When you are killing an oracle session which is created by some unix shell script you need to follow some other steps to kill that session.
When you kill a session using sid and serial# it kills only oracle session but does not frees unix process associated with that session.
To perform it correctly pls do the following.
SQL> ;
1 select s.sid, s.serial#, p.pid, p.spid, p.username
2 from v$session s, v$process p
3 where s.paddr=p.addr
4* and s.username='SCOTT'
SQL> /
SID SERIAL# PID SPID USERNAME
530 32662 40 14258 oracle
462 47581 49 17344 kuldeep
$ ptree 17344
4974 /usr/sbin/inetd -s
10598 in.telnetd
10603 login -p -d /dev/pts/1 -h 172.24.242.183
10671 -ksh
14814 sqlplus /
17344 oracleffdt01 (DESCRIPTION=(LOCAL=YES)(ADDRESS=(PROTOCOL=beq)))Kill deepest process in ptree output i.e. 17344
Edited by: [email protected] on Mar 29, 2010 4:25 PM
Similar Messages
-
Kill inactiv session and process automatically
Hello!
I have made a JSP (JavaServerPages) Application witch can made a connection to a oracle database. Wenn I open the connection the database generates a new process and makes a session.
Now, I have the problem, when I never close the connection, the session and the process are still alive but inactiv.
How can I automatically kill sessions and the appropriate process after a time?Sorry, but it doesnt work. I have set sqlnet.expire_time=60, to keep alive the connection for one hour. But now I found a lot of sessions witch are inactiv and where the last SQl-quere was more than one hour...
any other idea? -
Difference between connection, session and process
Hi all,
Can anyone please update me on the difference between connection,session and process.
Thanks in advance,
- SriI got this useful note by googled in net. It describes session,connection,process gracefully.
A connection is a physical circuit between you and the database.A connection
might be one of many types -- most popular begin DEDICATED server and SHARED
server. Zero, one or more sessions may be established over a given connection
to the database as show above with sqlplus. A process will be used by a session
to execute statements. Sometimes there is a one to one relationship between
CONNECTION->SESSION->PROCESS (eg: a normal dedicated server connection).
Sometimes there is a one to many from connection to sessions (eg: like
autotrace, one connection, two sessions, one process). A process does not have
to be dedicated to a specific connection or session however, for example when
using shared server (MTS), your SESSION will grab a process from a pool of
processes in order to execute a statement. When the call is over, that process
is released back to the pool of processes. -
Parameters session and process
How to set session and process parameters to more 500 connections...?
Oracle10g R2 Standard Edition
Windows 2003 Server R2
6GB RAMWindows 2003 Enterprise Edition 32bitSince it's the Enterprise edition, the os can "see" and use all the RAM. Fine.
However, a 32-bit Windows means a virtual address space of 4GB (2^32) per process, split as 2:2 GB (system:user). So if you want a single process, for example oracle, to use most of available RAM, you would need to do some tweaking and testing.
Why do you need to increase the processes parameter?
What type of application is it and how is it used?
Message was edited by:
orafad -
How to find the killed session and machine name
Hi,
At the time of batch job running .somebody killed that session .let me know how to find out the particular user name db level or oslevel .from which machine they killed how to find out at OS level . but when i have set the audit_trail=os only SYSDBA user activities are audited not the other user activities.
The server is AIX and db version 11i .provide the query for finding or os level .
thanks,
DBC.
Edited by: dbc001 on Mar 26, 2013 9:48 PMAre you sure that somebosy had killed the session? Did you get any error regarding kill session? Is there any other errors you can see in logs?its suspect only....
>
How that job was scheduled?...actually we have lot of source systems, from those source system we are getting the data into BI machine, by using BI apps team process data and trigger load jobs @db
Apps team is having database unix logins aswell as db logins to process their requests.
Your OS admin can check the history upto some extent? Check if he has auditing enabled at OS level?we are in the process of checking with OS sysadmin.
upto now we didnt got any clue....apps team successfully re-ran failed job. -
SGA, Sessions and process in 9i
Dear Experts
I have installed Oracle9i Enterprise Edition Release 9.2.0.7.0 - 64bit Production on Enterprise Linux 4 x86_64bit.
and dell server 6850 with 16GB RAM.
please suggest me how much i should keep maximum SGA? and sessions plus processes.
please guide me.
regards
saimauser2108660 wrote:
Dear Experts
I have installed Oracle9i Enterprise Edition Release 9.2.0.7.0 - 64bit Production on Enterprise Linux 4 x86_64bit.
and dell server 6850 with 16GB RAM.
please suggest me how much i should keep maximum SGA? and sessions plus processes.I would echo the same what Anand has mentioned. At this moment, going for 9i and that too for 9207 is probably not the best thing to do. About the sizing of the SGA, there is no rule of thumb for it. If you have an idea about the work load, you may want to start with a reasonable amount like 3-4 gb and monitor it for some time in accordance with the work load. Once reached to a satisfactory level, you should check the performance of the system and try to re-adjust the values of the parameters again. Also read the below link,
http://download.oracle.com/docs/cd/B10501_01/server.920/a96533/memory.htm#34133
HTH
Aman.... -
I want to know when a session is killed , oracle release its resources and update dynamic view ?
1* select sid,status from v$session where sid = 239
SQL> /
SID STATUS
239 KILLED
but when i some dynamic views...
SQL> SELECT *
2 FROM V$SESSTAT, V$STATNAME
3 WHERE NAME = 'session uga memory max'
4 AND V$SESSTAT.STATISTIC# = V$STATNAME.STATISTIC#
5 and sid = 239
6 /
SID STATISTIC# VALUE STATISTIC# NAME
239 16 43355372 16 session uga memory max
this show that this SID is using 41MB of RAM.
Please help mewhen a session is killed , oracle release its resources and update dynamic view Only when the changes done by the session are rolled back completely by pmon.
-
Regarding Alter System Kill Session
Hi Guys,
I have to do db refresh from the build .For this I have to kill the sessions and drop the users and recreate the users with the latest build.As the application is running and there are some idle sessions, I have to kill the sessions and drop the users for that I am using a code as below
DECLARE
v_alt_stmt VARCHAR2(1000) := 'ALTER SYSTEM KILL SESSION ''';
v_kill_stmt VARCHAR2(1000);
CURSOR cur_session IS
SELECT s.type type,
s.sid sid,
s.serial# srl_no,
s.username user_name,
s.PROGRAM prog_name
FROM v$session s JOIN gv$process p ON p.addr = s.paddr and s.type='USER';
BEGIN
EXECUTE IMMEDIATE 'ALTER SYSTEM ENABLE RESTRICTED SESSION';
DBMS_OUTPUT.PUT_LINE('The Session has been put in the restricted mode');
FOR v_cur_ssn IN cur_session
LOOP
BEGIN
v_kill_stmt := v_alt_stmt || v_cur_ssn.sid || ',' || v_cur_ssn.srl_no || '''';
DBMS_OUTPUT.PUT_LINE(v_kill_stmt);
EXECUTE IMMEDIATE v_kill_stmt;
EXCEPTION
WHEN others THEN
-- DBMS_OUTPUT.PUT_LINE('The current sessions sid is ' || v_cur_ssn.sid || ' and the srl no is ' || v_cur_ssn.srl_no || ' can not be killed');
END;
END LOOP;
EXECUTE IMMEDIATE 'ALTER SYSTEM DISABLE RESTRICTED SESSION';
DBMS_OUTPUT.PUT_LINE('The restricted mode of the system has been removed');
END;
But sometimes after killing the sessions there are some os processes are going on,to avoid that I have to use 'ALTER SYSTEM DISCONNECT SESSION ''' and 'MMEDIATE' it is workig fine .
Can Any one tell me the logical difference between kill sessions and disconnect
Any information will be highly appreciated.
Thanks in advance
Prafulla>
Can Any one tell me the logical difference between kill sessions and disconnect
>
Disconnect can be used to disconnect immediately without waiting for any ongoing transactions to complete and recovers all session resousrces.
Kill rolls back ongoing transactions and partially recovers session resources.
Kill is simiilar to SHUTDOWN IMMEDIATE while disconnect is more like SHUTDOWN ABORT.
See DISCONNECT SESSION Clause in the SQL Language doc
http://docs.oracle.com/cd/B28359_01/server.111/b28286/statements_2013.htm
>
Use the DISCONNECT SESSION clause to disconnect the current session by destroying the dedicated server process (or virtual circuit if the connection was made by way of a Shared Sever).
•The IMMEDIATE setting disconnects the session and recovers the entire session state immediately, without waiting for ongoing transactions to complete.
>
And KILL SESSION in the same doc next section
>
The KILL SESSION clause lets you mark a session as terminated, roll back ongoing transactions, release all session locks, and partially recover session resources.
IMMEDIATE Specify IMMEDIATE to instruct Oracle Database to roll back ongoing transactions, release all session locks, recover the entire session state, and return control to you immediately. -
Hello Everybody,
1) Is there any difference between “ALTER SYSTEM KILL SESSION & “kill -9”? Which one is the preferred method?
2) When we do alter system kill 'sid, serial#'. Are we killing the user process or the server process?
thanks in advanceWelcome to the forum!
Whenever you post provide your 4 digit Oracle version (result of SELECT * FROM V$VERSION)
>
Hello Everybody,
1) Is there any difference between “ALTER SYSTEM KILL SESSION & “kill -9”? Which one is the preferred method?
2) When we do alter system kill 'sid, serial#'. Are we killing the user process or the server process?
>
You should only use the 'kill' from the OS as a last resort.
There are TWO Oracle options: KILL session and DISCONNECT session. Only rarely, in my experience will DISCONNECT SESSION not get the job done.
See ALTER SYSTEM in the SQL Language doc
http://docs.oracle.com/cd/B28359_01/server.111/b28286/statements_2013.htm
>
end_session_clauses
The end_session_clauses give you several ways to end the current session.
DISCONNECT SESSION Clause
Use the DISCONNECT SESSION clause to disconnect the current session by destroying the dedicated server process (or virtual circuit if the connection was made by way of a Shared Sever). To use this clause, your instance must have the database open. You must identify the session with both of the following values from the V$SESSION view:
•For integer1, specify the value of the SID column.
•For integer2, specify the value of the SERIAL# column.
If system parameters are appropriately configured, then application failover will take effect.
•The POST_TRANSACTION setting allows ongoing transactions to complete before the session is disconnected. If the session has no ongoing transactions, then this clause has the same effect described for as KILL SESSION.
•The IMMEDIATE setting disconnects the session and recovers the entire session state immediately, without waiting for ongoing transactions to complete.
◦If you also specify POST_TRANSACTION and the session has ongoing transactions, then the IMMEDIATE keyword is ignored.
◦If you do not specify POST_TRANSACTION, or you specify POST_TRANSACTION but the session has no ongoing transactions, then this clause has the same effect as described for KILL SESSION IMMEDIATE.
See Also:
"Disconnecting a Session: Example"
KILL SESSION Clause
The KILL SESSION clause lets you mark a session as terminated, roll back ongoing transactions, release all session locks, and partially recover session resources. To use this clause, your instance must have the database open. Your session and the session to be terminated must be on the same instance unless you specify integer3.You must identify the session with the following values from the V$SESSION view:
•For integer1, specify the value of the SID column.
•For integer2, specify the value of the SERIAL# column.
•For the optional integer3, specify the ID of the instance where the target session to be killed exists. You can find the instance ID by querying the GV$ tables.
If the session is performing some activity that must be completed, such as waiting for a reply from a remote database or rolling back a transaction, then Oracle Database waits for this activity to complete, marks the session as terminated, and then returns control to you. If the waiting lasts a minute, then Oracle Database marks the session to be terminated and returns control to you with a message that the session is marked to be terminated. The PMON background process then marks the session as terminated when the activity is complete.
Whether or not the session has an ongoing transaction, Oracle Database does not recover the entire session state until the session user issues a request to the session and receives a message that the session has been terminated.
See Also:
"Terminating a Session: Example"
IMMEDIATE Specify IMMEDIATE to instruct Oracle Database to roll back ongoing transactions, release all session locks, recover the entire session state, and return control to you immediately. -
Seesion and Process increase..
Dear All
There are 75 to 100 users are accesing the databse simulateuosly and i recently got the error of session and process exceeded ....then i tried to increase seesion and process using OEM but i got following error
Io exception: Unknown host specified Is there any other way to do this? Can any one suggest me a best way to do this? or how do i tune it properly to acces DB without any interruption?
Vijay
Edited by: Vijayamurugan on Dec 8, 2010 9:29 PMDear Anand
The below is the out put v$resource_limit
RESOURCE_NAME CURRENT_UTILIZATION MAX_UTILIZATION INITIAL_AL
LIMIT_VALU
processes 70 150 150
150
sessions 74 170 170
170
enqueue_locks 12 47 2380
2380
RESOURCE_NAME CURRENT_UTILIZATION MAX_UTILIZATION INITIAL_AL
LIMIT_VALU
enqueue_resources 164 263 968
UNLIMITED
ges_procs 0 0 0
0
ges_ress 0 0 0
UNLIMITED
RESOURCE_NAME CURRENT_UTILIZATION MAX_UTILIZATION INITIAL_AL
LIMIT_VALU
ges_locks 0 0 0
UNLIMITED
ges_cache_ress 0 0 0
UNLIMITED
ges_reg_msgs 0 0 0
UNLIMITED
RESOURCE_NAME CURRENT_UTILIZATION MAX_UTILIZATION INITIAL_AL
LIMIT_VALU
ges_big_msgs 0 0 0
UNLIMITED
ges_rsv_msgs 0 0 0
0
gcs_resources 0 0 0
0
RESOURCE_NAME CURRENT_UTILIZATION MAX_UTILIZATION INITIAL_AL
LIMIT_VALU
gcs_shadows 0 0 0
0
dml_locks 2037 7548 748
UNLIMITED
temporary_table_locks 0 3 UNLIMITED
UNLIMITED
RESOURCE_NAME CURRENT_UTILIZATION MAX_UTILIZATION INITIAL_AL
LIMIT_VALU
transactions 45 123 187
UNLIMITED
branches 0 0 187
UNLIMITED
cmtcallbk 0 1 187
UNLIMITED
RESOURCE_NAME CURRENT_UTILIZATION MAX_UTILIZATION INITIAL_AL
LIMIT_VALU
sort_segment_locks 0 6 UNLIMITED
UNLIMITED
max_rollback_segments 12 66 187
65535
max_shared_servers 1 1 UNLIMITED
UNLIMITED
RESOURCE_NAME CURRENT_UTILIZATION MAX_UTILIZATION INITIAL_AL
LIMIT_VALU
parallel_max_servers 0 3 80
3600Vijay -
How to kill Forms Runaway Process using 95% CPU and running for 2 hours.
We had a situation at E-Business Suite customer (using Oracle VM server) where some of Form processes were not being cleared by form timeout settings automatically.
Also when user exits the form session from front end, the linux form process (PID) and DB session did not exit properly, so they got hung.
They were spiking CPU and memory usage and causing e-business suite to perform slowely and ultimately causing VM host to reboot the production VM guest (running on Linux).
We could see the form processes (PIDs) using almost 100% cpu with "top" command and running for a long time.
Also we verified those Form Sessions did not exist in the application itself.
ie. Using from Grid Control -> OAM-> Site Map -> Monitoring (tab) -> "Form Sessions".
It means that we could safely kill that form process from Linux using "kill -9 <PID>" command.
But that required a continuous monitoring and manual DBA intervention as customer is 24x7 customer.
So, I wrote a shell script to do the following;
• Cron job runs every half an hour 7 days a week which calls this shell script.
• Shell script runs and tries to find "top two" f60webmx processes (form sessions) using over 95% cpu with 2 minutes interval.
• If no process is found or CPU% is less than 95%, it exits and does nothing.
• If top process is found, it searches for its DB session using apps login (with hidden apps password file - /home/applmgr/.pwd).
a. If DB session is NOT found (which means form process is hung), it kills the process from unix and emails results to <[email protected]>
b. If DB session is found, it waits for 2 hours so that form process times automatically via form session timeout setting.
It also emails the SQL to check the DB session for that form process.
c. If DB session is found and it does not timeout after 2 hours,
it kills the process from unix (which in turn kills the DB session). Output is emailed.
This are the files required for this;
1. Cron job which calls the shell script looks like this;
# Kill form runaway process, using over 95% cpu having no DB session or DB session for > 2hrs
00,30 * * * * /home/applmgr/forms_runaway.sh 2>&1
2. SQL that this script calls is /home/applmgr/frm_runaway.sql and looks like;
set head off
set verify off
set feedback off
set pagesize 0
define form_client_PID = &1
select count(*) from v$session s , v$process p, FND_FORM_SESSIONS_V f where S.AUDSID=f.audsid and p.addr=s.paddr and s.process='&form_client_PID';
3. Actual shell script is /home/applmgr/forms_runaway.sh and looks like;
# Author : Amandeep Singh
# Description : Kills runaway form processes using more than 95% cpu
# and Form Session with no DB session or DB session > 2hrs
# Dated : 11-April-2012
#!/bin/bash
. /home/applmgr/.bash_profile
PWD=`cat ~/.pwd`
export PWD
echo "`date`">/tmp/runaway_forms.log
echo "----------------------------------">>/tmp/runaway_forms.log
VAR1=`top -b -u applmgr -n 1|grep f60webmx|grep -v sh|grep -v awk|grep -v top|sort -nrk9|head -2|sed 's/^[ \t]*//;s/[ \t]*$//'| awk '{ if ($9 > 95 && $12 = "f60webmx") print $1 " "$9 " "$11 " "$12; }'`
PID1=`echo $VAR1|awk '{print $1}'`
CPU1=`echo $VAR1|awk '{print $2}'`
TIME1=`echo $VAR1|awk '{print $3}'`
PROG1=`echo $VAR1|awk '{print $4}'`
PID_1=`echo $VAR1|awk '{print $5}'`
CPU_1=`echo $VAR1|awk '{print $6}'`
TIME_1=`echo $VAR1|awk '{print $7}'`
PROG_1=`echo $VAR1|awk '{print $8}'`
echo "PID1="$PID1", CPU%="$CPU1", Running Time="$TIME1", Program="$PROG1>>/tmp/runaway_forms.log
echo "PID_1="$PID_1", CPU%="$CPU_1", Running Time="$TIME_1", Program="$PROG_1>>/tmp/runaway_forms.log
echo " ">>/tmp/runaway_forms.log
sleep 120
echo "`date`">>/tmp/runaway_forms.log
echo "----------------------------------">>/tmp/runaway_forms.log
VAR2=`top -b -u applmgr -n 1|grep f60webmx|grep -v sh|grep -v awk|grep -v top|sort -nrk9|head -2|sed 's/^[ \t]*//;s/[ \t]*$//'| awk '{ if ($9 > 95 && $12 = "f60webmx") print $1 " "$9 " "$11 " "$12; }'`
PID2=`echo $VAR2|awk '{print $1}'`
CPU2=`echo $VAR2|awk '{print $2}'`
TIME2=`echo $VAR2|awk '{print $3}'`
PROG2=`echo $VAR2|awk '{print $4}'`
PID_2=`echo $VAR2|awk '{print $5}'`
CPU_2=`echo $VAR2|awk '{print $6}'`
TIME_2=`echo $VAR2|awk '{print $7}'`
PROG_2=`echo $VAR2|awk '{print $8}'`
HRS=`echo $TIME1|cut -d: -f1`
exprHRS=`expr "$HRS"`
echo "PID2="$PID2", CPU%="$CPU2", Running Time="$TIME2", Program="$PROG2>>/tmp/runaway_forms.log
echo "PID_2="$PID_2", CPU%="$CPU_2", Running Time="$TIME_2", Program="$PROG_2>>/tmp/runaway_forms.log
echo " ">>/tmp/runaway_forms.log
# If PID1 or PID2 is NULL
if [ -z ${PID1} ] || [ -z ${PID2} ]
then
echo "no top processes found. Either PID is NULL OR CPU% is less than 95%. Exiting...">>/tmp/runaway_forms.log
elif
# If PID1 is equal to PID2 or PID1=PID_2 or PID_1=PID2 or PID_1=PID_2
[ ${PID1} -eq ${PID2} ] || [ ${PID1} -eq ${PID_2} ] || [ ${PID_1} -eq ${PID2} ] || [ ${PID_1} -eq ${PID_2} ];
then
DB_SESSION=`$ORACLE_HOME/bin/sqlplus -S apps/$PWD @/home/applmgr/frm_runaway.sql $PID1 << EOF
EOF`
echo " ">>/tmp/runaway_forms.log
echo "DB_SESSION ="$DB_SESSION >>/tmp/runaway_forms.log
# if no DB session found for PID
if [ $DB_SESSION -eq 0 ] then
echo " ">>/tmp/runaway_forms.log
echo "Killed Following Runaway Forms Process:">>/tmp/runaway_forms.log
echo "-------------------------------------------------------------------">>/tmp/runaway_forms.log
echo "PID="$PID1", CPU%="$CPU1", Running Time="$TIME1", Program="$PROG1>>/tmp/runaway_forms.log
kill -9 $PID1
#Email the output
mailx -s "Killed: `hostname -a` Runaway Form Processes" [email protected] </tmp/runaway_forms.log
cat /tmp/runaway_forms.log
else
# If DB session exists for PID
if [ ${exprHRS} -gt 120 ]; then
echo $DB_SESSION "of Database sessions exist for this forms process-PID="$PID1". But its running for more than 2 hours. ">>/tmp/runaway_forms.log
echo "Process running time is "$exprHRS" minutes.">>/tmp/runaway_forms.log
echo "Killed Following Runaway Forms Process:">>/tmp/runaway_forms.log
echo "-------------------------------------------------------------------">>/tmp/runaway_forms.log
echo "PID="$PID1", CPU%="$CPU1", Running Time="$TIME1", Program="$PROG1>>/tmp/runaway_forms.log
kill -9 $PID1
#Email the output
mailx -s "`hostname -a`: Runaway Form Processes" [email protected] </tmp/runaway_forms.log
cat /tmp/runaway_forms.log
else
echo "Process running time is "$exprHRS" minutes.">>/tmp/runaway_forms.log
echo $DB_SESSION "of Database sessions exist for PID="$PID1" and is less than 2 hours old. Not killing...">>/tmp/runaway_forms.log
echo "For more details on this PID, run following SQL query;">>/tmp/runaway_forms.log
echo "-----------------------------------------------------------------------">>/tmp/runaway_forms.log
echo "set pages 9999 lines 150">>/tmp/runaway_forms.log
echo "select f.user_form_name, f.user_name, p.spid DB_OS_ID , s.process client_os_id,, s.audsid, f.PROCESS_SPID Forms_SPID,">>/tmp/runaway_forms.log
echo "to_char(s.logon_time,'DD-Mon-YY hh:mi:ss'), s.seconds_in_wait">>/tmp/runaway_forms.log
echo "from v\$session s , v\$process p, FND_FORM_SESSIONS_V f">>/tmp/runaway_forms.log
echo "where S.AUDSID=f.audsid and p.addr=s.paddr and s.process='"$PID1"' order by p.spid;">>/tmp/runaway_forms.log
mailx -s "`hostname -a`: Runaway Form Processes" [email protected] </tmp/runaway_forms.log
cat /tmp/runaway_forms.log
fi
fi
else
#if PID1 and PID2 are not equal or CPU% is less than 95%.
echo "No unique CPU hogging form processes found. Exiting...">>/tmp/runaway_forms.log
cat /tmp/runaway_forms.log
fi
If you have the same problem with some other unix and DB processes, the script can be easily modified and used.
But use this with thorough testing first (by commenting out <kill -9 $PID1> lines.
Good luck.
Edited by: R12_AppsDBA on 19/04/2012 13:10Thanks for sharing the script!
Hussein -
Kill a session and release all locks immediatly
Hi,
How to kill a session and release all locks immediately.
Thank you
AK> Actually I am working on development envrionment (Not
production) with oracle 10g DB. What heppened is that
I needed to replace a stored DB Package, but I
couldn't even when I am the only connected user.
A read lock is placed on data dictionary objects when used - that prevents someone else from changing that data dictionary object and in effect pull the carpet from beneath the feet of the process using that object.
When trying to replace a package, it will fail if another session is busy using that package.
As for being the only user on the database and still running into this problem - there could have been a DBMS_JOB executing that package.
> I killed all sessions, and even next day still the
locks are there from a session I killed 1 day
before!
Unusual. But a killed session can take 24+ hours to rollback. A rollback is often a lot more time consuming than the elapsed run-time of the session at the time it was killed.
Back with Oracle 8i and prior, it was not uncommon to see a killed session lingering forever until the instance was bounced. But I have not yet seen this in 10G.
Suggest that when you run into this situation again, you monitor the killed session to determine just what it is doing (looking at its current wait states and events) - and whether it is indeed hanging and not releasing any locks that should have been released. -
Killing user session & and update v$session
i use
alter system kill session 'sid,serial#) immediate.
user session killed but not clean, V$session show that user connect
i also want clean user session and remove form V$session
Any one who can do this ...
ThanksHi,
>>how remove on killing user session
As I said before, you just need to wait ... Don't worry about. On the other hand, by finding the SPID, you can force the process to be killed instead of waiting for PMON to wake up and kill it, but I think that it is not necessary.
Cheers
Legatti -
Killing User sessions and user calcs
Hi all,
We have a situation where users run their business rules during evening and at times in night.
We also have a maxl script which does aggregation and other calcs daily in night and it does not run as other calcs are launched by users.
Is it possible to kill the user session and calcs launched by users before running maxl calculation for consolidations?
I know I can do in in EAS, but want to try to do it in MAxL for automation.
Thanks in advanceYou would be better off locking people out. After you kick off the automated calc, killing sessions doesn't stop them from initiating calcs while your automated calc is running. In answer to your question, yes, you can do that in maxl.
alter system kill request all;
You have other options if you want to be more selective on what you kill.
kill request <session-id>
kill request by user
kill request on application
kill request on database
Check out the technical documentation for more info - http://docs.oracle.com/cd/E17236_01/epm.1112/esb_tech_ref/launch.html.
Kyle Goodfriend
http://www.in2hyperion.com
Please make sure to assign helpful/answered to responses if applicable - it rewards those who help and benefits the user community. -
Where i will give the date and time of the session background process
Hi.
I created a program on XD01 by using Session Method.
It is executed properly and process in forground also fine.
What my problem is i want execute process of session in Back ground on that time i want give the Date and Time. I do not know where i will provide date and Time.
I want Process the BDC Session after 2 days. How it is possbile. Where i will give the date and Time?
With in these 2 days i want know the status of the Session Process. How i will check the status?
Any body will explain these things with full flow of sequence.
I do not want use the BDC Session by using RSBDCSUB. In that program there is no options for giving the Date and Time.
Thank You.
B. Krishna.Hi,
While creating session through BDC_OPEN_GROUP function, populate HOLDDATE field to set lock on the created session till that date, say 31.12.2008 and you would like to execute your session on 1.1.2009 at 2:00 AM.
Once session is created, create a batch job for program RSBDCSUB and schedule it on 1.1.2009 at 2:00 AM (server time).
I am confident that it solves your problem.
Regards,
Prasanth
Maybe you are looking for
-
I cannot download a PDF and open it from the internet--not with Adobe Acrobat Pro X nor Adobe Reader even when the file is from Adobe. I don't get it. I am using iMac with Mountain Lion OS (10.8.2). I reviewed the Preferences but I don't see any
-
Workflow for Creating Encore Menu in Photoshop
This question deals with working between Encore and Photoshop CS5... I hope this is the proper Forum to post. I'll post in the Photoshop Forum as well... I'm creating a DVD menu from scratch in Photoshop CS5 to be used in authoring a DVD in Encore.
-
Regarding Excel file creation.
Hi experts, I retrieved the ALV output into an internal Table which is containing Text(1024) as member. After getting Data I need to pass this data to Excel file. Excel file should contain exact format of ALV. Please suggest me.............. Regards,
-
Sales document is deleted still billing plans are in billing due list
Hello, Sales document is deleted which have billing plans, But still billing plans are showing in billing due list for billing. Please let me know how to delete the entries in billing due list. Thanks and Regards Vikram.M
-
We have a palette with several edit boxes and a button. Whenever return is pressed in any of the text view we want to "press" the button, i.e. just like a default button in a dialog. I have achieved the "pressing" of the button using a custom event h