Show parent processes for zombies

Use this script to display all processes related (parents and children) to zombie processes on a Unix system. In this case processes are run by user oracle.

 

#!/bin/ksh

ZOMBIES=`ps -ef|grep oracle|grep 'defunct'|grep -v grep|awk '{printf("%s ", $2);}'`

if [ "X${ZOMBIES}" == "X" ] ; then

echo "No zombies found"

else

ptree ${ZOMBIES} | more

fi


The output may be something like:

4386  ora_qmnc_DBNAME
20255
19860
5902 
8695 
29756
23013
21826
8843 
10816