dg1.ksh 881 B

12345678910111213141516171819202122232425262728293031323334353637
  1. #!/bin/ksh
  2. function is_not_guarded
  3. {
  4. return `${ORACLE_HOME}/bin/sqlplus -S / "as sysdba" <<-EOF
  5. set pagesize 0 feedback off verify off heading off termout off echo off
  6. select count(1) from sys.v\\$archive_dest where status = 'VALID' and target = 'STANDBY';
  7. EOF`
  8. }
  9. get_db_role()
  10. {
  11. db_role=`${ORACLE_HOME}/bin/sqlplus -S / "as sysdba" <<-EOF
  12. set pagesize 0 feedback off verify off heading off termout off echo off
  13. select database_role from v\\$DATABASE;
  14. EOF`
  15. }
  16. # -----------------------------------------------------------------------------------------------------------------
  17. get_db_role
  18. if is_not_guarded # 0;SIP|SBY
  19. then
  20. if [ "${db_role}" = "PHYSICAL STANDBY" ]; then
  21. echo -e "${db_role}: Physical Standby"
  22. else
  23. echo -e "${db_role}: Type is Single Instance."
  24. fi
  25. else
  26. echo -e "${db_role}: Primary with Standby (Dataguarded)."
  27. fi