How to Kill all Oracle processes from OS-Linux
Usually if any sessions are causing much load on server and you are unable to connect to instance any more even using prelim, there will be some situations where you have to clear all the Oracle processes either local or remote connections. If you have many sessions and in that case it will be time taking and not easy to kill each session by using “kill -9 <pid>”, Instead of that with a single command you can kill all processes, If you have multiple database then based on the $ORACLE_SID you can clear only processes belongs to the particular instance.
Use “ps -ef|grep pmon”, then based on the instance name you can grep list of processes.
-bash-3.2$ ps -ef|grep pmon oracle 3428 1 0 13:05 ? 00:00:00 ora_pmon_ind oracle 3662 3386 0 13:07 pts/1 00:00:00 grep pmon -bash-3.2$ ps -ef|grep ind oracle 3428 1 0 13:05 ? 00:00:00 ora_pmon_ind oracle 3430 1 0 13:05 ? 00:00:00 ora_psp0_ind oracle 3432 1 0 13:05 ? 00:00:00 ora_vktm_ind oracle 3436 1 0 13:05 ? 00:00:00 ora_gen0_ind oracle 3438 1 0 13:05 ? 00:00:00 ora_mman_ind oracle 3440 1 0 13:05 ? 00:00:00 ora_diag_ind oracle 3444 1 0 13:05 ? 00:00:00 ora_dbrm_ind oracle 3446 1 0 13:05 ? 00:00:00 ora_dia0_ind oracle 3448 1 0 13:05 ? 00:00:00 ora_dbw0_ind oracle 3450 1 0 13:05 ? 00:00:00 ora_lgwr_ind oracle 3452 1 0 13:05 ? 00:00:00 ora_ckpt_ind oracle 3454 1 0 13:05 ? 00:00:00 ora_smon_ind oracle 3456 1 0 13:05 ? 00:00:00 ora_reco_ind oracle 3458 1 0 13:05 ? 00:00:00 ora_lreg_ind oracle 3460 1 0 13:05 ? 00:00:00 ora_mmon_ind oracle 3462 1 0 13:05 ? 00:00:00 ora_mmnl_ind oracle 3464 1 0 13:05 ? 00:00:00 ora_d000_ind oracle 3466 1 0 13:05 ? 00:00:00 ora_s000_ind oracle 3485 1 0 13:05 ? 00:00:00 ora_nss2_ind oracle 3488 1 0 13:05 ? 00:00:00 ora_tmon_ind oracle 3490 1 0 13:05 ? 00:00:00 ora_arc0_ind oracle 3492 1 0 13:05 ? 00:00:00 ora_arc1_ind oracle 3494 1 0 13:05 ? 00:00:00 ora_arc2_ind oracle 3496 1 0 13:05 ? 00:00:00 ora_arc3_ind oracle 3498 1 0 13:05 ? 00:00:00 ora_tt00_ind oracle 3500 1 0 13:05 ? 00:00:00 ora_smco_ind oracle 3509 1 0 13:05 ? 00:00:00 ora_w000_ind oracle 3511 1 0 13:05 ? 00:00:00 ora_aqpc_ind oracle 3516 1 2 13:05 ? 00:00:01 ora_p000_ind oracle 3518 1 3 13:05 ? 00:00:02 ora_p001_ind oracle 3520 1 0 13:05 ? 00:00:00 ora_p002_ind oracle 3522 1 0 13:05 ? 00:00:00 ora_p003_ind oracle 3550 1 0 13:05 ? 00:00:00 ora_qm02_ind oracle 3554 1 0 13:05 ? 00:00:00 ora_q002_ind oracle 3556 1 0 13:05 ? 00:00:00 ora_q003_ind oracle 3570 1 0 13:06 ? 00:00:00 ora_cjq0_ind oracle 3574 1 0 13:06 ? 00:00:00 ora_p004_ind oracle 3576 1 0 13:06 ? 00:00:00 ora_p005_ind oracle 3578 1 0 13:06 ? 00:00:00 ora_p006_ind oracle 3580 1 0 13:06 ? 00:00:00 ora_p007_ind oracle 3664 3386 0 13:07 pts/1 00:00:00 grep ind
From above command you can still get output of only PID which you are going to kill and of course you can crosscheck.
-bash-3.2$ ps -ef|grep ind|grep -v grep|awk '{print $2}' 3428 3430 3432 3436 3438 3440 3444 3446 3448 3450 3452 3454 3456 3458 3460 3462 3464 3466 3485 3488 3490 3492 3494 3496 3498 3500 3509 3511 3516 3518 3520 3522 3550 3554 3556 3570 3574 3576 3578 3580
The above command is just only displays and now we will kill the same processes by adding kill statment to the above command
-bash-3.2$ kill -9 `ps -ef|grep ind|grep -v grep|awk '{print $2}'` -bash-3.2$ ps -ef|grep ind|grep -v grep|awk '{print $2}' -bash-3.2$
Now all the processes belongs to “ind” were cleared, you can crosscheck again with the below command.
-bash-3.2$ps -ef|grep pmon oracle 3891 3386 0 13:12 pts/1 00:00:00 grep pmon -bash-3.2$ ps -ef|grep ind oracle 3901 3386 0 13:12 pts/1 00:00:00 grep ind -bash-3.2$
— Happy Reading —