Monitoring Oracle Database and Oracle monitoring shell scripts

Source: Internet
Author: User

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

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.