欢迎光临
我们一直在努力

Oracle DB 开机自启动和关闭

参考http://docs.oracle.com/database/122/UNXAR/stopping-and-starting-oracle-software.htm#UNXAR417

Automating Database Startup and Shutdown这个章节.

[root@ecs-fb50-0002 ~]# cd /etc/init.d/

[root@ecs-fb50-0002 init.d]# vi dbora

#! /bin/sh

# description: Oracle auto start-stop script.

#

# Set ORACLE_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 ORACLE_HOME.

ORA_HOME=/disk/oracle/product/11.2.0.4/db_1

ORA_OWNER=oracle

case “$1” in

‘start’)

# Start the Oracle databases:

# The following command assumes that the oracle login

# will not prompt the user for any values

# Remove “&” if you don’t want startup as a background process.

su – $ORA_OWNER -c “$ORA_HOME/bin/dbstart $ORA_HOME” &

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 $ORA_HOME” &

rm -f /var/lock/subsys/dbora

;;

esac

chgrp dba dbora

chmod 750 dbora

ln -s /etc/init.d/dbora /etc/rc.d/rc0.d/K01dbora

ln -s /etc/init.d/dbora /etc/rc.d/rc3.d/S99dbora

ln -s /etc/init.d/dbora /etc/rc.d/rc5.d/S99dbora

赞(0)
【声明】:本博客不参与任何交易,也非中介,仅记录个人感兴趣的主机测评结果和优惠活动,内容均不作直接、间接、法定、约定的保证。访问本博客请务必遵守有关互联网的相关法律、规定与规则。一旦您访问本博客,即表示您已经知晓并接受了此声明通告。