码迷,mamicode.com
首页 > 数据库 > 详细

oracle 11g 开机服务启动

时间:2015-08-29 23:09:54      阅读:285      评论:0      收藏:0      [点我收藏+]

标签:

一、修改/etc/oratab
#orcl:/u01/app/oracle/product/11gr2:N orcl:/u01/app/oracle/product/11gr2:Y 将“N”改为“Y”
二、修改/u01/app/oracle/product/11gr2/bin目录下dbstart和dbshut
[oracle@localhost bin]$ vim dbstart

将注释去掉
 ORATAB=/etc/oratab
将ORACLE_HOME_LISTNER=$1改为oracle的安装目录
ORACLE_HOME_LISTNER=/u01/app/oracle/product/11gr2
将“echo "Processing $INST \"$ORACLE_SID\": log file $ORACLE_HOME/startup.log"”注释

[oracle@localhost bin]$ vim dbstart 

将注释去掉
 ORATAB=/etc/oratab
将ORACLE_HOME_LISTNER=$1改为oracle的安装目录
ORACLE_HOME_LISTNER=/u01/app/oracle/product/11gr2
在“LOG=$ORACLE_HOME/shutdown.log”下添加“chmod 766 $LOG”
LOG=$ORACLE_HOME/shutdown.log
chomod 766 $LOG

三、添加oracle到系统服务
vim /etc/rc.d/init.d/oracle
#!/bin/sh
# chkconfig: 345 61 61
# description: Oracle 11g AutoRun Services
# /etc/init.d/oracle
#
# Run-level Startup script for the Oracle Instance, Listener, and
# Web Interface

export ORACLE_BASE=/u01/app/oracle
export ORACLE_HOME=/u01/app/oracle/product/11gr2
export ORACLE_SID=ORCL
export PATH=$PATH:$ORACLE_HOME/bin

ORA_OWNR="oracle"

# if the executables do not exist -- display error

if [ ! -f $ORACLE_HOME/bin/dbstart -o ! -d $ORACLE_HOME ]
then
     echo "Oracle startup: cannot start"
     exit 1
fi

# depending on parameter -- startup, shutdown, restart
# of the instance and listener or usage display

case "$1" in
 start)
     # Oracle listener and instance startup
     su $ORA_OWNR -lc $ORACLE_HOME/bin/dbstart
     echo "Oracle start OK..."
     sleep 1
     ;;
 stop)
     # Oracle listener and instance shutdown
     su $ORA_OWNR -lc $ORACLE_HOME/bin/dbshut
     echo "Oracle stop OK..."
     sleep 1
     ;;
 reload|restart)
     $0 stop
     $0 start
     ;;
 *)
     echo $"Usage: `basename $0` {start|stop|reload|reload}"
     exit 1
esac
exit 0

[root@localhost ~]# chkconfig --add oracle
[root@localhost ~]# chkconfig oracle on








 

oracle 11g 开机服务启动

标签:

原文地址:http://www.cnblogs.com/houzhiqing/p/4769993.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!