您好,登錄后才能下訂單哦!
case 變量值 in
模式1)
命令序列1
;;
模式2)
命令序列2
;;
……
*)
默認命令序列
esac
以下是腳本
#! /bin/bash
case "$1" in
start)
sqlplus -s /nolog > /dev/null <<eof
conn / as sysdba
startup
exit;
EOF
echo "Database openned."
;;
stop)
sqlplus -s /nolog > /dev/null <<eof
conn / as sysdba
shutdown immediate
exit
EOF
echo "Database stopped."
;;
restart)
sqlplus -s /nolog > /dev/null <<eof
conn / as sysdba
shutdown immediate
startup
exit
EOF
echo "Database restarted."
;;
status)
pmonstat=`ps -ef | grep ora_pmon | grep -v grep | wc -l`
if [ $pmonstat -gt 0 ]
then
dbstatus=`sqlplus -s /nolog <<eof
conn / as sysdba
set feedback off heading off pagesize 0
select status from v\\$instance;
exit
EOF`
echo "Database status:$dbstatus"
else
echo "Database not started."
fi
;;
*)
echo "----------------------------------------"
echo "Usage: start, stop, status, restart"
echo "----------------------------------------"
;;
esac
</eof
</eof
</eof
</eof
免責聲明:本站發布的內容(圖片、視頻和文字)以原創、轉載和分享為主,文章觀點不代表本網站立場,如果涉及侵權請聯系站長郵箱:is@yisu.com進行舉報,并提供相關證據,一經查實,將立刻刪除涉嫌侵權內容。