Site icon IT Tutorial

Oracle Kill Session Scripts -1

Hi,

Sometimes application developers or client offers you to kill any session or sessions group like SQL Net Client, or JDBC Client sessions or RMAN sessions.

You need to find session SID and SERIAL# with below script.

select s.SID,s.SERIAL#,S.USERNAME from v$session s where s.sid=63;

 

You can kill any session with its SID and SERIAL# number like below.

alter system kill session '63,1963';

 

Customer offers you to kill sessions group like SQL Net Client, or JDBC Client sessions or RMAN sessions. You can generate kill session script like below. You can change event to kill any other event group sessions.

SELECT 'kill -9 ' || p.spid, s.username,
'alter system kill session ''' || SID || ',' || s.serial# || ''';'
FROM v$session s, v$process p
WHERE s.paddr = p.addr(+)
AND s.SID IN (SELECT SID
FROM v$session_wait
WHERE event LIKE 'SQL*Net message from client%')
and s.username ='DEVECI'
and s.saddr not in ( select SES_ADDR from v$transaction );

 

 

You can read other Kill Session Scripts in Oracle.

 

https://ittutorial.org/oracle-kill-session-scripts-2/

https://ittutorial.org/oracle-kill-session-scripts-3/

https://ittutorial.org/oracle-kill-session-scripts-4/

 

 

  

Do you want to learn Oracle Database Performance Tuning detailed, then read the following articles.

https://ittutorial.org/oracle-database-performance-tuning-tutorial-12-what-is-the-automatic-sql-tuning-and-how-to-automated-sql-tuning/ 

Exit mobile version