#!/bin/bash
#chkconfig:35 99 01
case "$1" in
        start)
                echo -e "\n\t\t `date +%F` `date +%T`"
                echo -e "\t\t 正在启动lsnrctl start...."
                su - oracle -c ‘lsnrctl start‘ &>>/var/log/oracle
                echo -e "\t\t 正在启动dbstart...."
                su - oracle -c ‘dbstart‘ &>>/var/log/oracle
                echo -e "\t\t 正在启动emctl start dbconsole...."
                su - oracle -c ‘emctl start dbconsole‘ &>>/var/log/oracle
                echo -e "\t\t\t 启动成功!!"
                echo -e "\t\t `date +%F` `date +%T`\n"
          ;;
        stop)
                echo -e "\n\t\t `date +%F` `date +%T`"
                echo -e "\t\t 正在关闭emctl stop dbconsole...."
                su - oracle -c ‘emctl stop dbconsole‘ &>>/var/log/oracle
                echo -e "\t\t 正在关闭dbshut...."
                su - oracle -c ‘dbshut‘ &>>/var/log/oracle
                echo -e "\t\t 正在关闭lsnrctl stop...."
                su - oracle -c ‘lsnrctl stop‘ &>>/var/log/oracle
                echo -e "\t\t\t 关闭完毕!!"
                echo -e "\t\t `date +%F` `date +%T`\n"
         ;;
          *)
                echo -e "\n\t\t Usage:oracle{start|stop} 该服务暂时只添加了启动|关闭\n"
         ;;
esac本文出自 “一米阳光” 博客,请务必保留此出处http://sunshine3.blog.51cto.com/3988340/1703685
原文:http://sunshine3.blog.51cto.com/3988340/1703685