CentOS6.5下設定Oracle 11gR2 開機自動啟動

來源:互聯網
上載者:User

CentOS6.5下設定Oracle 11gR2 開機自動啟動

CentOS6.5下設定Oracle 11gR2 開機自動啟動

1.root 使用者下修改ORATAB(將N該為Y):

[root@ora11gr2 ~]# vim /etc/oratab 
mytest:/oracle/product/11.2.0/db_1:Y

2.oracle 使用者下修改:

[oracle@ora11gr2 ~]$cd $ORACLE_HOME/bin
[oracle@ora11gr2 bin]$ vim dbstart

找到 ORACLE_HOME_LISTNER=$1  這行, 修改成:
ORACLE_HOME_LISTNER=/oracle/product/11.2.0/
或者直接修改成:
ORACLE_HOME_LISTNER=$ORACLE_HOME
 
同樣道理修改 dbshut

測試回合 dbshut, dbstart 看能否啟動oracle 服務及listener服務

3.root 使用者下修改:

[root@ora11gr2 ~]# cd /etc/rc.d/init.d/
[root@ora11gr2 init.d]# vi oracle

#!/bin/bash
# chkconfig: 345 99 10
# description: Startup Script for Oracle Databases
# /etc/init.d/oracle
export ORACLE_SID=oracle
# export ORACLE_HOME_LISTNER=/oracle/product/11.2.0/bin/
export ORACLE_BASE=/apps/oracle
export ORACLE_HOME=/oracle/product/11.2.0
export PATH=$PATH:$ORACLE_HOME/bin
case "$1" in
start)
su oracle -c $ORACLE_HOME/bin/dbstart
touch /var/lock/oracle
echo "OK"
;;
stop)
echo -n "Shutdown Oracle: "
su oracle -c $ORACLE_HOME/bin/dbshut
rm -f /var/lock/oracle
echo "OK"
;;
*)
echo "Usage: 'basename $0' start|stop"
exit 1
esac
exit 0

儲存!修改檔案許可權

chmod 755 /etc/rc.d/init.d/oracle

[root@ora11gr2 ~]# chkconfig --add oracle11g
[root@ora11gr2 ~]# chkconfig oracle11g on

相關文章

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.