#!/bin/bash
# 如果是10g比較好是把前面的SQL提出去變另一個檔案
# ScriptName : mountcheck.sh
# 自動重啟 $1 = GO
# mountcheck.sh GO
PATH=$PATH:$HOME/bin
. ~/.bash_profile
S=`sqlplus -s / as sysdba <<EOF
select OPEN_MODE
from v\$database
where 1=1 ;
exit;
EOF`
echo $S
#MOUNT=`echo $S | awk '{print $1}'`
#echo $MOUNT
if [ "$S" = "MOUNTED" ]
then
echo "Mount OK good"
else
if [ "$S" = "READ ONLY" ]
then
echo "Must shutdown NG !!"
if [ "$1" = "GO" ]
then
echo "DO Shutdown"
sqlplus -s / as sysdba <
SET HEADING OFF FEEDBACK OFF ECHO OFF PAGESIZE 0
startup mount ;
exit;
EOF
TimeStr=`date +%Y-%m-%dT%H-%M-%S`
STR="TEST STB DB is restart mount as ${TimeStr}"
/omscripts/sendsms.sh "$STR" "177" "300"
fi
fi
fi
omscripts oracle$ cat S_96.sql
select OPEN_MODE
from v$database
where 1=1 ;
沒有留言:
張貼留言