don't know much about RAC......
for tnslistener, you can use 'tnspint $SID'
for 'instance' you can you try to connect with sqlplus and try to 'select from dual'. Something like this should get you started - modifying USER/PASSWD:
Code:
#!/usr/bin/ksh
typeset -irx TRUE=0
typeset -irx FALSE=1
USER='myUser'
PASSWD='myPasswd'
function Is_Oracle_OK
{
if print "
select dummy||'OK' from dual;
" | sqlplus -s ${USER}/${PASSWD} | grep -q XOK
then return ${TRUE}
fi
return ${FALSE}
}
if Is_Oracle_OK
then print "Oracle is up"
else print "Oracle is down"
fi
http://www.tek-tips.com/faqs.cfm?fid=2218