且构网

分享程序员开发的那些事...
且构网 - 分享程序员编程开发的那些事

Linux平台下oracle设置开机启动

更新时间:2021-10-10 11:12:15

1】在root账号下

使用命令vi /etc/oratab编辑文件/etc/oratab,把N修改成Y

  1. DB1:/u01/app/oracle/product/OraDb11g_home1:Y
  2. 主机名 oracle_home

     

    2】在oracle账号下,cd $ORACLE_HOME/bin,把ORACLE_HOME_LISTNER=$1,修改成ORACLE_HOME_LISTNER=$ORACLE_HOME

  3. [oracle@db01 ~]$ cd $ORACLE_HOME/bin
  4. [oracle@db01 bin]$ vi dbstart
  5. # First argument is used to bring up Oracle Net Listener
  6. ORACLE_HOME_LISTNER=$ORACLE_HOME
  7. if [ ! $ORACLE_HOME_LISTNER ] ; then
  8. echo "ORACLE_HOME_LISTNER is not SET, unable to auto-start Oracle Net Listener"
  9. echo "Usage: $0 ORACLE_HOME"

     

    3】在oracle账号下  cd $ORACLE_HOME/bin,编辑dbshut文件,找到 ORACLE_HOME_LISTNER=$1,修改成ORACLE_HOME_LISTNER=$ORACLE_HOME

  10. # The this to bring down Oracle Net Listener
  11. ORACLE_HOME_LISTNER=$ORACLE_HOME

     

    4】切换到root账号下vi /etc/rc.d/rc.local

  12. [root@db01 ~]# vi /etc/rc.d/rc.local
  13. #!/bin/sh
  14. #
  15. # This script will be executed *after* all the other init scripts.
  16. # You can put your own initialization stuff in here if you don't
  17. # want to do the full Sys V style init stuff.
  18. touch /var/lock/subsys/local
  19. su oracle -lc "/u01/app/oracle/product/OraDb11g_home1/bin/lsnrctl start"
  20. su oracle -lc /u01/app/oracle/product/OraDb11g_home1/bin/dbstart