时间:2021-07-01 10:21:17 帮助过:2人阅读
二、修改/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 开机服务启动
标签: