电脑疯子技术论坛|电脑极客社区

微信扫一扫 分享朋友圈

已有 2132 人浏览分享

linux服务器开机启动oracle如何设置 linux服务器开机启动oracle

[复制链接]
2132 0
本篇文章小编给大家分享一下linux服务器开机启动oracle设置方法 小编觉得挺不错的现在分享给大家供大家参考有需要的小伙伴们可以来看看。

1、首先切换到Oracle用户
  1. oracle@oracletest ~]$ cd /u01/app/oracle/product/11.2.0/db_1/bin/  -----标红字体部分数据库可能
  2. 不一样有的是dbhome_1以自己实际配置目录为准
  3. [oracle@oracletest bin]$ vi dbstart
复制代码
  1. LOGMSG="logger -puser.alert -s "
  2. trap 'exit' 1 2 3
  3. # for script tracing
  4. case $ORACLE_TRACE in
  5. T) set -x ;;
  6. esac
  7. # Set path if path not set (if called from /etc/rc)
  8. SAVE_PATH=/bin:/usr/bin:/etc:${PATH} ; export PATH
  9. SAVE_LLP=$LD_LIBRARY_PATH
  10. # First argument is used to bring up Oracle Net Listener
  11. ORACLE_HOME_LISTNER=$ORACLE_HOME  ############此处原来是$1,改成$ORACLE_HOME
  12. if [ ! $ORACLE_HOME_LISTNER ] ; then
  13. echo "ORACLE_HOME_LISTNER is not SET, unable to auto-start Oracle Net Listener"
  14. echo "Usage: $0 ORACLE_HOME"
  15. else
  16. LOG=$ORACLE_HOME_LISTNER/listener.log
复制代码

2、用root用户编辑oratab和rc.local

  1. root@oracletest ~# vi /etc/oratab
  2. # This file is used by ORACLE utilities. It is created by root.sh
  3. # and updated by either Database Configuration Assistant while creating
  4. # a database or ASM Configuration Assistant while creating ASM instance.
  5. # A colon, ':', is used as the field terminator. A new line terminates
  6. # the entry. Lines beginning with a pound sign, '#', are comments.
  7. # Entries are of the form:
  8. # $ORACLE_SID:$ORACLE_HOME:<n|y>:
  9. # The first and second fields are the system identifier and home
  10. # directory of the database respectively. The third filed indicates
  11. # to the dbstart utility that the database should , "Y", or should not,
  12. # "N", be brought up at system boot time.
  13. # Multiple entries with the same $ORACLE_SID are not allowed.
  14. oadb:/u01/app/oracle/product/11.2.0/db_1:Y ###此处原来是N,改为Y
  15. root@oracletest ~]# vi /etc/rc.d/rc.local
  16. #!/bin/sh
  17. # This script will be executed *after* all the other init scripts.
  18. # You can put your own initialization stuff in here if you don't
  19. # want to do the full Sys V style init stuff.
  20. touch /var/lock/subsys/local
  21. #####在空白处添加下面两行,其中标红字体部分数据库可能不一样 有的是dbhome_1 以自己实际配置目录为准
  22. su oracle -lc "/u01/app/oracle/product/11.2.0/db_1/bin/lsnrctl start"
  23. su oracle -lc /u01/app/oracle/product/11.2.0/db_1/bin/dbstart </n|y>
复制代码
经过上面两步操作 数据库服务器重启后 数据库也会自动启动。

您需要登录后才可以回帖 登录 | 注册

本版积分规则

1

关注

0

粉丝

9021

主题
精彩推荐
热门资讯
网友晒图
图文推荐

Powered by Pcgho! X3.4

© 2008-2022 Pcgho Inc.