#!/bin/ksh function is_not_guarded { return `${ORACLE_HOME}/bin/sqlplus -S / "as sysdba" <<-EOF set pagesize 0 feedback off verify off heading off termout off echo off select count(1) from sys.v\\$archive_dest where status = 'VALID' and target = 'STANDBY'; EOF` } get_db_role() { db_role=`${ORACLE_HOME}/bin/sqlplus -S / "as sysdba" <<-EOF set pagesize 0 feedback off verify off heading off termout off echo off select database_role from v\\$DATABASE; EOF` } # ----------------------------------------------------------------------------------------------------------------- get_db_role if is_not_guarded # 0;SIP|SBY then if [ "${db_role}" = "PHYSICAL STANDBY" ]; then echo -e "${db_role}: Physical Standby" else echo -e "${db_role}: Type is Single Instance." fi else echo -e "${db_role}: Primary with Standby (Dataguarded)." fi