0701001-fedora下oracle数据库开机自启动

0701001-fedora下oracle数据库开机自启动

1.oratab

修改oratab文件。

/etc/oratab
DB11GR2:/u01/app/oracle/product/11.2.0.4/db_1: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/11.2.0.4/db_1
ORA_OWNER=oracle
export ORACLE_UNQNAME=DB11GR2

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
        # 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

3.添加启动服务

chmod 750 /etc/init.d/dbora
chkconfig --add dbora
#确认服务已添加
[root@fedora21 ~]# systemctl -t service|grep dbora
  dbora.service loaded active exited  SYSV: Oracle auto start-stop script.
[root@fedora21 ~]# 

4.参考

0.修订记录

class nobody{
public:
	string author    = "zhiw";
	string email     = "zhiw2019#163.com"
	string timestamp = "2015年2月10日"
	string version   = "000,初始发布"
};
posted @ 2015-02-10 17:38  zhiw2019  阅读(179)  评论(0编辑  收藏  举报