7.monitor oracle database listener & instance status
monitor oracle database listener & instance status
[mon@oracle source]$ crontab -l
* * * * * /home/mon/source/mon_db >> /home/mon/log/mon_db.log
[mon@oracle source]$ more mon_db
#!/bin/bash
export ORACLE_BASE=/u01/oracle
export ORACLE_HOME=$ORACLE_BASE/product/11.2.0.4/dbhome_1
export ORACLE_SID=yangxu
datetime=`date +"%Y/%m/%d %H:%M:%S"`
hostname=`hostname`
lsnrstat=`ps -ef | grep -i tnslsnr | grep -v grep | wc -l`
if [ $lsnrstat -eq 0 ];then
echo "$datetime starting listener"
$ORACLE_HOME/bin/lsnrctl start
echo "$datetime start listener completed"
echo "$datetime $hostname started listener" | mutt -s "$datetime $hostname started listener" tolilong@163.com
else
echo "$datetime listener is already runing"
fi
dbstat=`ps -ef | grep -e ora_smon_$ORACLE_SID -e ora_pmon_$ORACLE_SID -e ora_lgwr_$ORACLE_SID | grep -v grep | wc -l`
if [ $dbstat -eq 0 ];then
echo "$datetime starting instance $ORACLE_SID"
$ORACLE_HOME/bin/sqlplus / nolog << EOF
conn / as sysdba;
startup;
EOF
echo "$datetime start instance complete"
echo "$datetime $hostname started database" | mutt -s "$datetime $hostname started database" tolilong@163.com
else
echo "$datetime $ORACLE_SID is already runing"
fi
[mon@oracle source]$ crontab -l
* * * * * /home/mon/source/mon_db >> /home/mon/log/mon_db.log
[mon@oracle source]$ more mon_db
#!/bin/bash
export ORACLE_BASE=/u01/oracle
export ORACLE_HOME=$ORACLE_BASE/product/11.2.0.4/dbhome_1
export ORACLE_SID=yangxu
datetime=`date +"%Y/%m/%d %H:%M:%S"`
hostname=`hostname`
lsnrstat=`ps -ef | grep -i tnslsnr | grep -v grep | wc -l`
if [ $lsnrstat -eq 0 ];then
echo "$datetime starting listener"
$ORACLE_HOME/bin/lsnrctl start
echo "$datetime start listener completed"
echo "$datetime $hostname started listener" | mutt -s "$datetime $hostname started listener" tolilong@163.com
else
echo "$datetime listener is already runing"
fi
dbstat=`ps -ef | grep -e ora_smon_$ORACLE_SID -e ora_pmon_$ORACLE_SID -e ora_lgwr_$ORACLE_SID | grep -v grep | wc -l`
if [ $dbstat -eq 0 ];then
echo "$datetime starting instance $ORACLE_SID"
$ORACLE_HOME/bin/sqlplus / nolog << EOF
conn / as sysdba;
startup;
EOF
echo "$datetime start instance complete"
echo "$datetime $hostname started database" | mutt -s "$datetime $hostname started database" tolilong@163.com
else
echo "$datetime $ORACLE_SID is already runing"
fi
來自 “ ITPUB部落格 ” ,連結:http://blog.itpub.net/24237320/viewspace-2064892/,如需轉載,請註明出處,否則將追究法律責任。
相關文章
- [Shell] monitor oracle database listener & instance statusOracleDatabase
- STATUS OF ORACLE INSTANCEOracle
- Oracle database instanceOracleDatabase
- oracle instance and listener自動啟動Oracle
- Listener in INTERMEDIATE status with "Not All Endpoints Registered
- Listener in INTERMEDIATE status with "Not All Endpoints Registered"
- Check database status in RACDatabase
- The Instance and the Database (285)Database
- Oracle 19c Concepts(13):Oracle Database InstanceOracleDatabase
- Migrate database from single instance to Oracle RACDatabaseOracle
- 理解Database和InstanceDatabase
- Support Status - Oracle Database on Linux Itanium [ID 1130325.1]OracleDatabaseLinux
- oracle 9i physical standby database 中v$database switchover_status的含義OracleDatabase
- Oracle Database Server 'TNS Listener'遠端資料投毒漏洞OracleDatabaseServer
- 3.2.1 Mounting a Database to an InstanceDatabase
- Overview of Instance and Database Startup (289)ViewDatabase
- oracle rconfig convert single instance to rac databaseOracleDatabase
- oracle 9i single instance convert to rac databaseOracleDatabase
- ORA-38760: This database instance failed to turn on flashback databaseDatabaseAI
- oracle中instance name 和database name的一點體會OracleDatabase
- database和instance的區別Database
- Oracle10g RAC 怎麼Listener. CRS , Instance ..... 都是自動開啟 ?Oracle
- Oracle ListenerOracle
- Overview of Database and Instance Shutdown (302)ViewDatabase
- Manual Database Creation in Oracle9i (Single Instance and RAC)-137288.1DatabaseOracle
- Top 5 Database and/or Instance Performance Issues in RAC EnvironmentDatabaseORM
- ORA-38760: This database instance failed to turn on flashback database 第三篇DatabaseAI
- ORA-38760: This database instance failed to turn on flashback database 錯誤解決DatabaseAI
- ORA-15055 ASM Diskgroup Status Showing Dismounted From RDBMS InstanceASM
- 3.1.5.2 Starting an Instance, and Mounting and Opening a DatabaseDatabase
- Connected to an idle instance – while database is runningWhileDatabase
- Close the Database by Terminating the Instance (304)Database
- Oracle ASM Partnership and Status TableOracleASM
- [Oracle Script] Log switch statusOracle
- 理解 oracle 的 “lsnrctl status”Oracle
- How to Rename Database/Change DB_NAME or ORACLE_SID/Instance Name-15390.1DatabaseOracle
- Oracle instance解釋Oracle
- Database and/or Instance Performance Issues in RAC Environment_1373500.1DatabaseORM