最近一台oracle数据库服务器,由于过度消耗内存,导致内核报错,监听老是断掉,所以写了个脚本,做监听状态检测,一旦检测到断了,自动起来

? View Code BASH
 
1
2
3
4
5
#!/bin/bash
 
bin=/u01/app/oracle/product/10.2.0/db_1/bin/lsnrctl
stat=`su - -c $bin status oracle|grep successfully`
[ -z "$stat" ] && `su - -c '/u01/app/oracle/product/10.2.0/db_1/bin/lsnrctl start' oracle`

用root用户加到crontab里,每分钟检测一次

 
1
*/1 * * * * /home/oracle/lnsrctl_check.sh