Script to check if sql connectivity hangs in RAC nodes due to different issues


### Schedule the script in crontab every 2 minutes based on need, to check if the sql connectivity is ### successful without hanging in each RAC node.

mail_id=`cat /home/oracle/scripts/mail_members.txt`
file=/home/oracle/scripts/logs/1.log
if [ -f $file ];
then
    echo ” sqlplus not connected  ” >> /home/oracle/scripts/logs/sql.log
    cat /home/oracle/scripts/logs/sql.log | mailx -s “sqlplus not connected” $mail_id
else
    touch /home/oracle/scripts/logs/1.log
    . /home/oracle/oracle.env
    sqlplus -s “/ as sysdba” << EOF
        spool out.log
        select name from v$database;
        spool off;
    EOF
    rm /home/oracle/scripts/logs/1.log
fi

### If on any instance the sql connectivity hangs and you are intimated. After fixing the issue remove ### the file /home/oracle/scripts/logs/1.log.

Recent Posts