Home >Database >Mysql Tutorial >Redhat AS4下Oracle 10g配置dbstart实现开机自启动

Redhat AS4下Oracle 10g配置dbstart实现开机自启动

WBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWB
WBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOriginal
2016-06-07 16:56:51930browse

其中chkconfig:2345 99 01 是指脚本将为运行级2、3、4、5启动oracle 10g服务,启动优先级为99,关闭优先级为01。2.然后以root权

1. 修改dbstart脚本:
$ vi $Oracle_HOME/bin/dbstart
#ORACLE_HOME_LISTNER=/ade/vikrkuma_new/oracle
ORACLE_HOME_LISTNER=$ORACLE_HOME

2. 修改/etc/oratab为如下格式:
$ vi /etc/oratab
SID:$ORACLE_HOME:Y
3. 修改/etc/rc.local实现自启动
# vi /etc/rc.local
su -c "$ORACLE_HOME/bin/dbstart" oracle
su -c "$ORACLE_HOME/bin/emctl start dbconsole" oracle 重启系统检查是否设置成功。

另,使用RedHat启动服务实现:
1. 在/etc/rc.d/init.d下添加如下脚本文件,命名为oracle:
#!/bin/sh
#chkconfig: 2345 99 01
#description: ORACLE 10g Server
ORACLE_HOME=/oracle/product/10.2.0.1
if [ ! -f $ORACLE_HOME/bin/dbstart ]
then
echo "ORACLE cannot start"
exit
fi
case "$1" in
'start')
echo "Starting Oracle Database..."
su - oracle -c "$ORACLE_HOME/bin/dbstart"
su - oracle -c "$ORACLE_HOME/bin/emctl start dbconsole"
;;
'stop')
echo "Stoping Oracle Database"
su - oracle -c "$ORACLE_HOME/bin/emctl stop dbconsole"
su - oracle -c "$ORACLE_HOME/bin/dbshut"
;;
esac

其中chkconfig:2345 99 01 是指脚本将为运行级2、3、4、5启动oracle 10g服务,启动优先级为99,关闭优先级为01。
2.然后以root权限:
# cd /etc/rc2.d
# ln -s /etc/rc.d/init.d/oracle S99oracle
# chkconfig --list oracle
# chkconfig --level 2345 on 重启系统,就可以在启动的过程中看到Starting oracle,因为我们设置的优先级为99,,一般是最后启动。[OK]以后就可以了。因为要启动emctl,可能有点慢,等待的时间要稍微长一点。

启动以后可以以root执行oracle start或者oracle stop来启动或停止服务。

linux

Statement:
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn