CentOS6.0_X86_64 racle 11g R2 开机自动启动(linux)
oracle 在 linux 下的开机自动启动脚本,设置如下:
[root@ora11gr2 ~]# vi /etc/oratab
mytest:/apps/oracle/product/11.2.0.1/db_1:Y
[root@ora11gr2 ~]# su - oracle
[oracle@ora11gr2 ~]$cd $ORACLE_HOME/bin
[oracle@ora11gr2 bin]$ vi dbstart
找到 ORACLE_HOME_LISTNER=$1 这行, 修改成:
ORACLE_HOME_LISTNER=/apps/oracle/product/11.2.0.1/
ORACLE_HOME_LISTNER=$ORACLE_HOME
[oracle@ora11gr2 bin]$ vi dbshut
测试运行 dbshut, dbstart 看能否启动oracle 服务及listener服务
[oracle@ora11gr2 bin]$ ps -efw | grep ora_
[oracle@ora11gr2 bin]$ lsnrctl status
[oracle@ora11gr2 bin]$ ps -efw | grep LISTEN | grep -v grep
[root@ora11gr2 ~]# cd /etc/rc.d/init.d/
[root@ora11gr2 init.d]# vi oracle11g
- #!/bin/bash
- # chkconfig: 345 99 10
- # description: Startup Script for Oracle Databases
- # /etc/init.d/oracle11g
- export ORACLE_SID=mytest
- # export ORACLE_HOME_LISTNER=/apps/oracle/product/11.2.0.1/db_1/bin/
- export ORACLE_BASE=/apps/oracle
- export ORACLE_HOME=/apps/oracle/product/11.2.0.1/db_1
- export PATH=$PATH:$ORACLE_HOME/bin
- case "$1" in
- start)
- su oracle -c $ORACLE_HOME/bin/dbstart
- touch /var/lock/oracle
- echo "OK"
- ;;
- stop)
- echo -n "Shutdown Oracle: "
- su oracle -c $ORACLE_HOME/bin/dbshut
- rm -f /var/lock/oracle
- echo "OK"
- ;;
- *)
- echo "Usage: 'basename $0' start|stop"
- exit 1
- esac
- exit 0
[root@ora11gr2 ~]# chkconfig --add oracle11g
[root@ora11gr2 ~]# chkconfig oracle11g on
这样,当系统重启开机时,oracle11g服务就会启动.
本文转自vcdog 51CTO博客,原文链接:http://blog.51cto.com/255361/837489 ,如需转载请自行联系原作者