Sunday, June 8, 2014

Shell script to check db status in Oracle RAC environment

***************************************************
Script to check DB  status in Oracle RAC environment
***************************************************
#!/bin/csh
setenv ORATAB /var/opt/oracle/oratab
date
foreach x (`cat ${ORATAB} | grep -v “^#”| grep “^[a-z]” | grep -v “demo” | grep -v “_sp”|awk -F: ‘{print $1}’`)
        setenv ORAENV_ASK 1
        setenv ORACLE_SID “$x”
        source /usr/local/default/oracle_sid.csh
            $ORACLE_HOME/bin/sqlplus -s <        / as sysdba
        set lines 132
        set pages 200
            set hea off
        set feedback off
        col machine for a30
        col host_name for a40
        select instance_name, host_name, logins, status from gv\$instance;
        exit
EOF
end

No comments: