ITPUX技术网

交流 . 资讯 . 分享
Make progress together!
Linux操作系统下Oracle11g R2 RAC 安装配置教程
Oracle数据库培训-备份恢复-性能优化-集群容灾
Oracle数据库DBA高级工程师培训视频

Oracle Database 12c开机脚本

内容发布:luashin| 发布时间:2017-6-7 23:01:18
Create an init Script to make Oracle start automatically on system booting.
[1] Set environment variables for "oracle" user like follows.
[oracle@dlp ~]$ vim /etc/oratab
# end line: change
orcl:/u01/app/oracle/product/12.2.0/dbhome_1:Y

[oracle@dlp ~]$ vim ~/.bash_profile
# add follows to the end
export ORACLE_SID=orcl

[2] Create an init Script with the root user.
[root@dlp ~]# vim /etc/rc.d/init.d/oracle
# it's an example, edit it you like.
#!/bin/bash
# oracle: Start/Stop Oracle Database 12c R2
#
# chkconfig: 345 90 10
# description: The Oracle Database is an Object-Relational Database Management System.
#
# processname: oracle
. /etc/rc.d/init.d/functions
LOCKFILE=/var/lock/subsys/oracle
ORACLE_HOME=/u01/app/oracle/product/12.2.0/dbhome_1
ORACLE_USER=oracle

case "$1" in
'start')
    if [ -f $LOCKFILE ]; then
        echo $0 already running.
        exit 1
    fi
    echo -n $"Starting Oracle Database:"
    su - $ORACLE_USER -c "$ORACLE_HOME/bin/lsnrctl start"
    su - $ORACLE_USER -c "$ORACLE_HOME/bin/dbstart $ORACLE_HOME"
    touch $LOCKFILE
    ;;

'stop')
    if [ ! -f $LOCKFILE ]; then
        echo $0 already stopping.
        exit 1
    fi
    echo -n $"Stopping Oracle Database:"
    su - $ORACLE_USER -c "$ORACLE_HOME/bin/lsnrctl stop"
    su - $ORACLE_USER -c "$ORACLE_HOME/bin/dbshut"
    rm -f $LOCKFILE
    ;;

'restart')
    $0 stop
    $0 start
    ;;

'status')
    if [ -f $LOCKFILE ]; then
        echo $0 started.
    else
        echo $0 stopped.
    fi
    ;;

*)
    echo "Usage: $0 [start|stop|status]"
    exit 1
esac
exit 0

[root@dlp ~]# chmod 755 /etc/init.d/oracle && chkconfig --add oracle && chkconfig oracle on



上一篇:基于ASM环境Oracle Database 12c单实例安装与配置
下一篇:Oracle Database 11g R2 RAC启动关闭步骤
回复

使用道具 举报

1框架
您需要登录后才可以回帖 登录 | 立即注册

本版积分规则

快速回复 返回顶部 返回列表