Search Blog Post

Monday, May 20, 2013

Shell Script for Listener Status

#######################################################################
## cklsnr.sh                                                         ##
#######################################################################
#!/bin/ksh
DBALIST="tyagi.ankur07@gmail.com";export DBALIST
cd $TNS_ADMIN
rm -f lsnr.exist
ps -ef | grep LISTENER_NAME | grep -v grep  > lsnr.exist
if [ -s lsnr.exist ]
then
    echo
else
echo "Alert" | mailx -s "Listener 'LISTENER_NAME' on `hostname` is down" $DBALIST
    TNS_ADMIN=$ORACLE_HOME/network/admin/; export TNS_ADMIN
    ORACLE_SID=$SID; export ORACLE_SID
    ORAENV_ASK=NO; export ORAENV_ASK
    PATH=$PATH:/bin:/usr/local/bin; export PATH
    . oraenv
    LD_LIBRARY_PATH=${ORACLE_HOME}/lib;export LD_LIBRARY_PATH
    lsnrctl start LISTENER_NAME
fi

1 comment:

  1. Hi Ankur,

    Can you please give any script to check the status of DB available on the servers
    using ORATAB file

    Thanks
    A

    ReplyDelete