Search

Wednesday, June 22, 2016

Killing Session with TOAD

You need to have DBA privilege to carry out such activity using toad, click on Session Browser, expand the program under program list, select the intended process; on the top click on Kill X button. You can see here not only the session and their SQL statement, cursor, explain plan and DML progress but you can see the database lock, blocking locks, database object being accessed and activities of rollback segment
Open the Database --> Monitor --> Session Browser tab or directly clicking on the session toolbar button and find the ACTIVE one and press the X button. The session will be killed immediately.
SQL>Select * from v$session where type = 'USER' and status = 'ACTIVE';
Take the sid and serial# values from there and use the below command to kill particular session.
SQL>alter system kill session 'sid, serial#';
Once you get the sid you can get the username from v$session
SQL>Select username from v$session where sid=23;
This command Toad issue to kill the process is of form:
SQL>ALTER SYSTEM DISCONNECT SESSION ‘SID#, SERIAL#’ IMMEDIATE;

 


As the Monitoring and killing session is routine DBA task. Therefore you can schedule it using toad after each time toad open or session open it will automatically launch this widow. For more details check the option View –> Toad Option –> startup