| 12345678910111213141516171819202122232425262728293031323334353637383940414243444546 |
- #!/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_type()
- {
- get_db_role
- if is_not_guarded
- then
- if [ "${db_role}" = "PHYSICAL STANDBY" ]; then
- echo -e "${db_role}: Physical Standby"
- export DB_TYPE=3
- else
- echo -e "${db_role}: Single Instance."
- export DB_TYPE=1
- fi
- else
- echo -e "${db_role}: Primary (Dataguarded)."
- export DB_TYPE=2
- fi
- }
- # -------------------------------------------------------------------------------------------------------------------
- get_DB_type
- echo -e "Output: DEBUG: DB_TYPE is ${DB_TYPE}."
|