#!/bin/ksh function is_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() { database_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 sys.v\\$database; EOF` } get_db_role if is_guarded -a $database_role=='PRIMARY' then echo -e "Not Guarded and Standby ($database_role) - No Backup" else echo -e "Guarded and Physical Standby - $database_role" fi # value=`function "fnordness"`