Thursday, August 25, 2011

Kill sessions in Unix - Linux while shutting down the database

When you shutdown the database with the immediate option you have to wait for all processes to terminate. Shutting down a database with 5000 sessions maybe will take some time!

If the database SID for example is DWH01 then you can execute in the Unix shell this command to kill all the oracle sessions to speed up the procedure. 

 
$ ps -ef|grep 'oracleDWH01 (LOCAL=NO)'|grep -v grep|awk '{print$2}'|xargs -i kill {}



OR



for i in `ps -ef|grep oracleDWH01|grep -v grep|awk '{print$2}'`

do

kill -9 $i

done
 It doesn't kill the smon and pmon processes, only the LOCAL=NO 


Apps DBA Free Lance
Sukhwinder Singh

No comments:

Post a Comment

Note: Only a member of this blog may post a comment.