Killed Session and Rousource
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 me
when 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.
Similar Messages
-
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 PMHi,
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 -
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. -
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? -
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. -
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. -
How to find and kill session similar to forms user session
We have a forms and reports based system that uses the oracle sessions. Sometimes if a form takes a long time we have the need to navigate to iAS>Forms>User Sessions, find the IP of the machine where the form is not responding and kill it based on the IP of the troublesome machine.
I want to add this into our forms environemnt so people can kill their own sessions if need be but not sure how this is handled
is it a simple alter system kill session in the db or something different.
also how is the ip found to match the session?
Thankshi,
Instead Set session timeout parameters..So that user gets logged off automatically from the application after a particular interval of time
For this you have to make changes in httpd.conf file,web.xml file and env file
Regards
Fabian -
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. -
Disconnect session and kill session
Hi
what is the difference between
disconnect session and kill session
Edited by: Pascal Nouma on 21/10/2009 16:23Hi,
You can use the supplied package [dbms_metadata|http://download.oracle.com/docs/cd/B28359_01/appdev.111/b28419/d_metada.htm#i1015856] to get the DDL for database objects, including sequences.
If you want to continue working on this query, then I think you need a CASE expression to do one thing for 0 vlaues, and another for values >0.
Something like this:
select 'create sequence '
|| SEQUENCE_NAME
|| ' minvalue '
|| MIN_VALUE
|| ' maxvalue '
|| MAX_VALUE
|| ' increment by '
|| INCREMENT_BY
|| decode ( CYCLE_FLAG
, 'N' , ' nocycle '
, ' cycle '
|| CASE
WHEN cache_size = 0
THEN ' NOCACHE'
ELSE ' cache ' || cache_size
|| ' start with '
|| LAST_NUMBER
END
|| ';'
from user_sequences;You can also use DECODE instead of CASE (and vice-versa).
Edited by: Frank Kulash on Oct 21, 2009 7:34 PM
A few minutes ago this question was about re-creating sequences. What happened? -
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 -
(ask)how to detect locking and how to kill session
I want to update a row in a table, table "X" for example.
I got ORA-00054:resource busy and acquire with no wait spesified.
How do i search and kill the session that is locking the table? i dont have oracle Enterprise Manager so i think it has to be done by querying against v$session, v$transaction etc. to get the session and kill it.
Can anyone show me the select statement to find out the sesion and the command to kill it.
thank youDBA_OBJECTS holds the object_id.
Use the object_id to select locks from V$LOCK, where object_id equals ID1 or ID2 (depends on the type of lock).
See Oracle Database Reference for more details. -
In my application I want to kill session if any user
is idle for 2 minutes.
I am using oracle forms 6i and database oracle 9iYou have to use D2KWutil.pll
In when new form instance write the following code
declare
hWind PLS_INTEGER;
CheckTimer TIMER;
begin
hWind := get_window_property(FORMS_MDI_WINDOW,WINDOW_HANDLE);
Win_API_Session.Timeout_Start_Timer(hWind);
CheckTimer := Create_Timer('CheckTimeout',1000,repeat);
end;
and in when timer expired trigger write the following code
begin
if upper(get_application_property(TIMER_NAME)) = 'CHECKTIMEOUT' then
:timer.t1 := Win_api_session.Timeout_Get_Inactive_Time;
if :timer.t1 > 120 then -- timer is a block and t1 is text item (don't assign a canvas to it, make it invisible)
Win_API_Session.timeout_delete_timer;
exit_form (NO_VALIDATE);
end if;
end if;
end;
hope this helps !! -
Hi,
I kill a session with the commands:
select username, sid, serial#, status from v$session where username like 'RION%'
alter system kill session 'sid, serial#'
and if I give again the first select command at the status column appears KILLED. I want not to have KILLED in the status column.
Thank you,
Mihaelahi all,
As u know you are seeing the status of at v$session view as killed, I wanna confirm that this will exists in two senario.
When a Session is in inactive state and a kill command on that session is issued then the "status" column of v$session will be updated as killed as to indicate/mark as it is killed, and the "server " column will be updated as psuedo. when the user again try to connect to the session user will receive 0ra-00028 error and the entry will be removed from v$session.
Another senario is that the transaction is at its half way, either in commiting or at the roleback stage for that partucular session then also you can find that the v$table is updated as above.
more information, go through the documentation, at the Server Process handling section.
i hope it cleared your confussion, -
Choice between start new session and restore previous session
I have refused to update firefox since 2.0.0.14. That's mid 2008. The reason? Because EVERY update I have seen has a critical flaw and I am sick of it never having been addressed. Oh, I have tested it many times. I am impatient in general. I have allowed it to update just now for instance with the naive hope that MAYBE you'd put it back the way it should be, and NOPE, you STILL have the critical epic fail that you introduced some time after 2.0.0.14, and I then had to uninstall firefox and reinstall my copy of 2.0.0.14 and restore my passwords and bookmarks from the key3.db and bookmarks.htm files (which also aren't compatible with the later versions, and that's bad too since it was more efficiently done and more comprehensible and more compatible with common knowledge that way, what the hell is a .json file anyway????), and I am sick of it. It's getting harder and harder to use 2.0.0.14, things constantly say snide things like 'upgrade (downgrade) to a modern browser, your browser is not supported', 'you are using md5 for certificate validation, are you insane?', that sort of thing, and things often don't work right, but it is WORTH every bit of it to avoid the critical epic fail.
Ok, enough suspense. That critical epic fail is this: when I start firefox after the previous session crashed (or was killed by the task manager), it does NOT give the NICE CHOICE 2.0.0.14 does between "begin new session" and "restore previous session". It automatically restores the previous session. Do you have any idea how many times I have gone to a webpage only to observe it is infected with a virus which it tries to put on my computer, or just a horrible page with a horrible script that seems to involve an infinite loop or at least something incredibly excessive and inefficiently coded that totally eats up the CPU processing power and I BARELY managed to KILL firefox with the task manager? Do you think I want it to go right back to loading that page when I start firefox again? Do you have the BATSH*T INSANE notion that I should always WANT to restore my previous session? Well I DON'T! I killed it with good reason in the first place. 100% of the time mozilla gets killed by the task manager and 90% of the time it crashes, I don't WANT to restore my previous session. Is there some secret hidden feature representing providing this choice that 2.0.0.14 provided that is by default DISABLED that I can maybe enable, or do I have to continue using 2.0.0.14 and watch as more and more and more things refuse to work with it?
Also, you need to have the "stop" button within reach of the bookmarks and the left side of the address bar, not on the far right of the screen. And I'd also rather not have it be in the same place as the refresh button, though I understand the justification for having the stop button become the refresh button. Is there any way I can also have the "forward, back, stop, refresh" buttons all together and in the most convenient place as they were in 2.0.0.14 while I'm at it?Set the pref browser.sessionstore.max_resumed_crashes to 0 on the about:config page to get the about:sessionrestore page immediately with the first restart after a crash has occurred or the Task Manager was used to close Firefox.
*http://kb.mozillazine.org/browser.sessionstore.max_resumed_crashes
That will allow you to deselect the tab(s) that you do not want to reopen, but will allow to reopen other tabs.
See:
* http://kb.mozillazine.org/Session_Restore#Restoring_a_session_after_a_crash
* http://kb.mozillazine.org/Browser.sessionstore.max_resumed_crashes
Maybe you are looking for
-
Anyone else get more than 4 defective MBP in a row?
I purchased my first Macbook Pro 15" in July right when Lion was released. It's my first Mac. I customized with 500gb/7200rpm and8gb ram. And then my Mac drama began and is still going on now. MBP #1 (purchase #1 late July) - DVD did not work. Fro
-
Satellite P10-802: What was new in sound driver update
There are new sound drivers for Satellite P10-802 which claim to add sound features such as 3d enhancement and software synthesizer and i would like to know what these actually do and if it's effective enough to bother updating. For example the sound
-
Error: method invokemethod Class not found
To execute vo we have added the following code in my page class files. 1.Vo created name as "MyViewObj" 2.Add code under the AM class as mentioned public void setEmployeeData(){ OAViewObject vo = getMyViewObj(); vo.executeQuery(); 3.Call Method under
-
I have a friend who has been using AOL to mail photos from iPhoto. In the last few days, it's reverted to Mail. He went to Preferences to change it back to AOL and found everything grayed out except Mail. He has reinstalled AOL, but it did no good. (
-
Watch DVD Movie From External Dvd Player
Hello! I hope someone can help me. I've been wondering if i can connect an external dvd player (not dvd drive) in my powerbook to watch movies. There are some disc that my PB superdrive couldn't read but when using my external dvd player it works. Is