Shell script to check standby configations for all instances running on a node

# #####################################################################
# Description : This script checks standby database configurations      #
#                for all instances running on a node.                  #
#Author          : Pavan Yennampelli                                      #
# ####################################################################
#!/bin/ksh
if [ `uname` = Linux ] ; then
export ORATAB=/etc/oratab
elif [ `uname` = Sunos ] ; then
export ORATAB=/var/opt/oracle/oratab
fi
for i in `ps -ef|grep pmon|awk '{print $8}'|cut -d_ -f3|grep -v grep|grep -v +ASM*|grep -v "\-MGMTDB"`
do
export ORACLE_SID=$i
export ORACLE_HOME=`cat $ORATAB|grep $i|cut -d: -f2`
export PATH=$ORACLE_HOME/bin:$PATH:
export DNAME=`sqlplus -s / as sysdba <<END
set pagesize 0 feedback off verify off heading off echo off
select name from v\\$database;
exit;
END`
export ROLE=`sqlplus -s / as sysdba <<END
set pagesize 0 feedback off verify off heading off echo off
select database_role from v\\$database;
exit;
END`
export FAL_CLIENT=`sqlplus -s / as sysdba <<END
set pagesize 0 feedback off verify off heading off echo off
select value from v\\$spparameter where name='fal_client';
exit;
END`
export FAL_SERVER=`sqlplus -s / as sysdba <<END
set pagesize 0 feedback off verify off heading off echo off
select value from v\\$spparameter where name='fal_server';
exit;
END`
export LOG_ARCHIVE_CONFIG=`sqlplus -s / as sysdba <<END
set pagesize 0 feedback off verify off heading off echo off
select value from v\\$spparameter where name='log_archive_config';
exit;
END`
export LOG_ARCHIVE_DEST_STATE=`sqlplus -s / as sysdba <<END
set pagesize 0 feedback off verify off heading off echo off
select value from v\\$parameter where name='log_archive_dest_state_2';
exit;
END`
export LOG_ARCHIVE_DEST=`sqlplus -s / as sysdba <<END
set pagesize 0 feedback off verify off heading off echo off
select value from v\\$parameter where name='log_archive_dest_2';
exit;
END`
if [ -z "$LOG_ARCHIVE_DEST" ] ; then
echo -e "Database name is \033[32m $DNAME \e[0m"
echo -e "Database role is \033[32m $ROLE \e[0m"
echo -e "FAL_CLIENT parameter is set as  \033[32m $FAL_CLIENT \e[0m"
echo -e "FAL_SERVER parameter is set as  \033[32m $FAL_SERVER \e[0m"
echo -e "LOG_ARCHIVE_CONFIG parameter is set as  \033[32m $LOG_ARCHIVE_CONFIG \e[0m"
echo -e "LOG_ARCHIVE_DEST_STATE parameter is set as  \033[32m $LOG_ARCHIVE_DEST_STATE \e[0m"
echo -e "LOG_ARCHIVE_DEST_2 parameter is set as  \033[32m $LOG_ARCHIVE_DEST \e[0m"
elif [ ! -z "$LOG_ARCHIVE_DEST" ] ; then
echo -e " \033[35m standby is configured on database $DNAME ....Please check \e[0m"
echo -e "Database role is \033[35m $ROLE \e[0m"
echo -e "FAL_CLIENT parameter is set as  \033[35m $FAL_CLIENT \e[0m"
echo -e "FAL_SERVER parameter is set as  \033[35m $FAL_SERVER \e[0m"
echo -e "LOG_ARCHIVE_CONFIG parameter is set as  \033[35m $LOG_ARCHIVE_CONFIG \e[0m"
echo -e "LOG_ARCHIVE_DEST_STATE parameter is set as  \033[35m $LOG_ARCHIVE_DEST_STATE \e[0m"
echo -e "LOG_ARCHIVE_DEST_2 parameter is set as  \033[35m $LOG_ARCHIVE_DEST \e[0m"
fi
done