ITPub博客

首页 > Linux操作系统 > Linux操作系统 > Oracle自动启动和关闭

Oracle自动启动和关闭

原创 Linux操作系统 作者:zaokaichen 时间:2008-05-11 15:51:55 0 删除 编辑

1.修改/etc/oratab
 TSH1:/u01/app/oracle/product/9.2.0:Y
2.新建启动脚本文件/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=/u01/app/oracle/product/9.2.0
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
        ;;
    '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"
        ;;
esac

3.设置权限
  chmod 750 /etc/init.d/dbora
4.设置自动启动服务
  chkconfig --level 345 dbora on

来自 “ ITPUB博客 ” ,链接:https://blog.itpub.net/658698/viewspace-265011/ ,如需转载,请注明出处,否则将追究法律责任。

请登录后发表评论 登录
全部评论

注册时间:2008-04-15

  • 博文量
    88
  • 访问量
    168563