***************************************************
check oracle db status in a server
***************************************************
#!/bin/csh
setenv ORATAB /var/opt/oracle/oratab
date
foreach x (`cat ${ORATAB} | grep -v “^#”| grep “^[a-z]” | grep -v “demo” | grep -v “test”| grep -v “*” | awk -F:
‘{print $1}’`)
setenv ORAENV_ASK 1
setenv ORACLE_SID “$x”
source /usr/local/default/oracle_sid.csh
sqlplus -s <<EOF
/ as sysdba
set lines 132 pages 200 hea off feedback off trims on
col host_name for a20
spool chk_dbstatus.log
select instance_name, host_name, logins, version, status from v\$instance;
spool off
exit
EOF
Note: The above script is written using “C” shell, so if you are using any other shell, make necessary changes. Also as always first test it in lower environments
No comments:
Post a Comment