Linux下oracle自启动 4年前

系统运维
652
Linux下oracle自启动

文档详见:http://www.oracle-base.com/articles/linux/AutomatingDatabaseStartupAndShutdownOnLinux.php

[root@localhost oracle]# vim /etc/oratab

$ORACLE_SID:$ORACLE_HOME:Y

[root@localhost oracle]# vim /etc/init.d/dbora

#!/bin/sh
# chkconfig: 345 99 10
# description: Oracle auto start-stop script.
#
# Set ORA_HOME to be equivalent to the $ORACLE_HOME
# from which you wish to execute dbstart and dbshut;
#
# Set ORA_OWNER to the user id of the owner of the 
# Oracle database in ORA_HOME.

ORA_HOME=$ORACLE_HOME
ORA_OWNER=oracle

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

case "$1" in
    'start')
        # Start the Oracle databases:
        # The following command assumes that the oracle login 
        # will not prompt the user for any values
        su - $ORA_OWNER -c "$ORA_HOME/bin/lsnrctl start"
        su - $ORA_OWNER -c $ORA_HOME/bin/dbstart
        touch /var/lock/subsys/dbora
        ;;
    'stop')
        # Stop the Oracle databases:
        # The following command assumes that the oracle login 
        # will not prompt the user for any values
        su - $ORA_OWNER -c $ORA_HOME/bin/dbshut
        su - $ORA_OWNER -c "$ORA_HOME/bin/lsnrctl stop"
        rm -f /var/lock/subsys/dbora
        ;;
esac

[root@localhost oracle]# chmod 750 /etc/init.d/dbora

[root@localhost oracle]# chkconfig --add dbora

在chkconfig时,若出现bash: chkconfig: command not found

[root@localhost oracle]# rpm -aq |grep chkconfig
chkconfig-1.3.30.2-2.el5
[root@localhost oracle]# export PATH=/sbin:$PATH
[root@localhost oracle]# chkconfig

 应该可以了,重启系统吧!

c
chercher
我对普通的人类没有兴趣,你们只要是有外星人、未来人、异世界人、超能力者, 就尽管来找我吧!以上!
3
发布数
1
关注者
3980
累计阅读

热门教程文档

Javascript
24小节
Golang
23小节
Spring Boot
24小节
爬虫
6小节
Maven
5小节
广告