Oracle Script to Check Health of All Database running on Shared Server
Oracle Script to Check Health of All Database running on Shared Server
For DBA ,Be is any activity , Need to perform health check for all the database running on the server. In this blog , We have come up with a script to perform DB health check and remote connectivity using Listener.
Below is Script for all DB health check on Unix bases server:
#!/bin/bash
for i in `ps -eaf | grep pmon | grep -v "grep" | egrep -v 'ASM|MGMT' | cut -d "_" -f 3`
do
echo "======================"
echo $i
export ORACLE_SID=$i
export ORACLE_HOME=`cat /etc/oratab | grep -i $i | cut -d ":" -f 2`
export PATH=$PATH:$ORACLE_HOME/bin
sqlplus '/ as sysdba' << EOF
spool `echo $i`_health_checks.log
set lines 200
col HOST_NAME for a40
Select d.inst_id,d.name,i.INSTANCE_NAME,i.host_name,d.open_mode,i.STARTUP_TIME,i.STATUS,i.ARCHIVER,i.VERSION from gv\$database d,gv\$instance i where d.inst_id=i.inst_id;
spool off
EOF
echo "======================"
done
for i in `ps -eaf | grep pmon | grep -v "grep" | egrep -v 'ASM|MGMT' | cut -d "_" -f 3`
do
echo "======================"
echo $i
export ORACLE_SID=$i
export ORACLE_HOME=`cat /etc/oratab | grep -i $i | cut -d ":" -f 2`
export PATH=$PATH:$ORACLE_HOME/bin
sqlplus '/ as sysdba' << EOF
spool `echo $i`_health_checks.log
set lines 200
col HOST_NAME for a40
Select d.inst_id,d.name,i.INSTANCE_NAME,i.host_name,d.open_mode,i.STARTUP_TIME,i.STATUS,i.ARCHIVER,i.VERSION from gv\$database d,gv\$instance i where d.inst_id=i.inst_id;
spool off
EOF
echo "======================"
done
for i in `srvctl config database`
do
echo "======================"
echo $i
srvctl status database -d $i
sqlplus -L a/a@${i}
echo "======================"
done
do
echo "======================"
echo $i
srvctl status database -d $i
sqlplus -L a/a@${i}
echo "======================"
done
==========================================================
Please check our other blogs for Oracle
Comments
Post a Comment
Please do not enter any spam link in comment Section suggestions are Always Appreciated. Thanks.. !