Linux设置oracle自动启动

我的安装Oracle92.0.4版本

安装目录
ORACLE_BASE=/opt/oracle
ORACLE_HOME=/opt/oracle/product/9.2.0.4
保证dbstart可以启动数据库
创建数据库启动服务
>pwd
/etc/rc.d/init.d
>vi oracle9i

# !/bin/bash
# whoami
# root
# chkconfig: 345 51 49
# description: starts the oracle dabase deamons
#

ORACLE_BASE=/opt/oracle
ORACLE_HOME=/opt/oracle/product/9.2.0.4
ORACLE_OWNER=oracle
case "$1" in
'start')
echo -n "starting oracle9i: "
su - $ORACLE_OWNER -c "$ORACLE_HOME/bin/dbstart" &
su - $ORACLE_OWNER -c "$ORACLE_HOME/bin/lsnrctl start"
touch /var/lock/subsys/oracle9i
echo
;;

'stop')
echo -n "shutting down oracle9i: "
su - $ORACLE_OWNER -c "$ORACLE_HOME/bin/dbshut" &
su - $ORACLE_OWNER -c "$ORACLE_HOME/bin/lsnrctl stop"
rm -f /var/lock/subsys/oracle9i
echo
;;

'restart')
echo -n "restarting oracle10g: "
$0 stop
$0 start
echo
;;
*)
echo "usage: oracle9i { start | stop | restart }"
exit 1

esac
exit 0

保存 添加可执行权限

>chmod a+x oracle9i

>ls -l oracle9i

查看是否有执行的权利
然后添加到服务通过chkconfig

chkconfig --add oracle9i
chkconfig --list oracle9i

你可能感兴趣的:(oracle,linux,职场,自动启动,休闲)