650) this.width=650; "src=" Http://s1.51cto.com/wyfs02/M01/88/91/wKiom1f7riuRmC1HAABydVZpubA538.png "title=" 1.png " alt= "Wkiom1f7riurmc1haabydvzpuba538.png"/>650) this.width=650; src= http://s4.51cto.com/wyfs02/M01/88/8E/ Wkiol1f7rm3qtnnraabaehcfgyk013.png "title=" 1.png "alt=" Wkiol1f7rm3qtnnraabaehcfgyk013.png "/>
Text Format:
#!/bin/bash
#Author: Wangerguiemail:[email protected]date:2016-10-10
#Release 1.0
#Function: Check Oracle Online
Declare-a instance= (PROD emrep)
[[-f/home/oracle/.bash_profile]] &&. /home/oracle/.bash_profile | | Exit 3
function Check_listener () {
Su-oracle-c "lsnrctl status" >/dev/null 2>&1
if [[$?-ne 0]];then
Su-oracle-c "lsnrctl start" >/dev/null 2>&1
[[$?-ne 0]] && echo-e "\e[40;31;5m Your listener is down!\e[0m"
Fi
}
Check_listener
function Check_oracle () {
For name in "${instance[@]}";d O
(Su-oracle <<eof
Sqlplus Sys/[email Protected]${name} as Sysdba
Select status from V\ $instance;
Quit
Eof
) >/home/oracle/${name}.txt
Egrep-q "OPEN"/home/oracle/${name}.txt
[[$?-ne 0]] && echo-e "\e[40;31;5m Oracle ${name} is down!\e[0m"
Done
}
Check_oracle
This article is from the "Linux Related Technologies" blog, make sure to keep this source http://wangergui.blog.51cto.com/8504247/1860421
Monitoring Oracle Database and Oracle monitoring shell scripts