最近一臺oracle數據庫服務器,由於過度消耗內存,導致內核報錯,監聽老是斷掉,所以寫了個腳本,做監聽狀態檢測,一旦檢測到斷了,自動起來
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 |