ITeye博客

Oracle 10g 自启动脚本

squll369 · 2011-07-13 23:59 · 服务器配置 · 数据库 · Markdown

linux下Oracle自启动脚本, 记录如下:

 

#!/bin/bash
#
#name:/etc/init.d/oracle10ginit
#chkconfig:2345 99 91
#description:Start and Stop ORACLE 10g
start(){
        #Start TNS
 echo "Starting TNS......"
 su - oracle -c "lsnrctl start"
        sleep 5
 echo "TNS started successfully" 

        #Start Oracle Instance
 echo "Starting Oracle Instance......"
 su - oracle -c "echo \"
   CONN SYS/password AS SYSDBA
   STARTUP
   exit \"|sqlplus /NOLOG"
 sleep 5
 echo "Oracle Instance started successfully"

 #start enterprise manager
        echo "Starting Enterprise Manager"
 su - oracle -c "emctl start dbconsole"
 sleep 5
 echo "Enterprise Manager started successfully"

 #Start isqlplus
 echo "Starting isqlplus"
 su - oracle -c "isqlplusctl start"
 sleep 5
        echo "isqlplus started successfully"
}

stop(){
 #shutdown DB Instance
 echo "Shutdown Oracle DB Instance"
 su - oracle -c "echo \"
   CONN SYS/password AS SYSDBA
   SHUTDOWN immediate
   exit \"|sqlplus /NOLOG"
 sleep 5
 echo "DB Instance shutdown successfully"

 #stop TNS
 echo "STOP TNS"
 su - oracle -c "lsnrctl stop"
 sleep 5
 echo "TNS stop successfully"

 #stop enterprise manager
 echo "Stop Emterprise Manager"
 su - oracle -c "emctl stop dbconsole"
 sleep 5
 echo "enterprise manager stop successfully"

 #stop isqlplus
 echo "Stop isqlplus"
 su - oracle -c "isqlplusctl stop"
 sleep 5
 echo "isqlplus stop successfully"
}

case "$1" in
start)
 start
 ;;
stop)
 stop
 ;;
*)
 echo "Usage:oracle10ginit[start|stop]" 
 ;;

esac

评论(0)

暂无评论。

评论功能维护中,当前仅展示历史评论。