| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657 |
- #!/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`
- }
- is_guarded
- retval=$?
- # echo "is_guarded returned ---${retval}---"
- get_db_role
- echo "${retval}:$database_role"
- if [ $retval -eq 0 -a "${database_role}" = "PRIMARY" ]; then
- echo -e "1. Not Guarded and Primary ($database_role) - BACKUP HERE"
- elif [ $retval -eq 0 -a "${database_role}" = "PHYSICAL STANDBY" ] ; then
- echo -e "2. Not Guarded and Physical Standby ($database_role) - BACKUP HERE"
- elif [ $retval -gt 0 -a "${database_role}" = "PHYSICAL STANDBY" ]; then #
- echo -e "3. Not Guarded and Physical Standby ($database_role) - BACKUP HERE"
- elif [ $retval -gt 0 -a "${database_role}" = "PRIMARY" ]; then #
- echo -e "4. Guarded and Primary ($database_role) - NO BACKUP HERE"
- else
- echo -e "ERROR Unknown Configuration"
- fi
- #
- #
- # if [ $retval -gt 0 -a "${database_role}" = "PRIMARY" ]; then
- # echo -e "1. Guarded and Primary ($database_role) - NO BACKUP HERE"
- # elif [ $retval -eq 0 -a "${database_role}" = "PRIMARY" ]; then # OK: SIT3, UAT3, SYSTST2.......
- # echo -e "2. Not Guarded and Primary ($database_role) - BACKUP HERE"
- # elif [ $retval -eq 0 -a "${database_role}" = "PHYSICAL STANDBY" ]; then #
- # echo -e "3. Not Guarded and Physical Standby ($database_role) - BACKUP HERE"
- # else
- # echo -e "ERROR Unknown Configuration"
- # fi
|