首页 > 数据库 > Oracle > 关于linux oracle自启动 [转]
关于oracle在linux系统下安装后,如何在系统重启的情况下让服务自动启动起来,网上有很多的教程和现成的脚本,这里只是个人工作中的一点经验。
以redhat as4和oracle
10g为例。单机在安装过程依照oracle官方的文档一步步下来,只要设置好参数、安装好必要的包,一般不会出什么问题。安装好了以后系统重
启,oracle重启服务,网上很多人建议自己写脚本(其实脚本也很简单),这里讲的是用oracle本身的脚本实现,当然不可避免最后还要写一点点的。
1、配置dbstart和dbshut
在$ORACLE_HOME/bin中,有dbstart和dbshut这两个脚本,more dbstart看一下可以看到:
| QUOTE: |
| # # $Id: dbstart.sh.pp 11-may-2005.18:18:07 vikrkuma Exp $ # Copyright (c) 1991, 2005, Oracle. All rights reserved. # ################################### # # usage: dbstart # # This is used to start ORACLE from /etc/rc(.local). # It should ONLY be executed as part of the system boot procedure. # # This will start all databases listed in the oratab file # whose third field is a "Y". If the third field is set to "Y" and # there is no ORACLE_SID for an entry (the first field is a *), # then this will ignore that entry. # # This requires that ASM ORACLE_SID's start with a +, and # that non-ASM instance ORACLE_SID's do not start with a +. # # If ASM instances are to be started with this , it cannot # be used inside an rc*.d directory, and should be invoked from # rc.local only. Otherwise, the CSS service may not be available # yet, and this will block init from completing the boot # cycle. # # Note: # Use ORACLE_TRACE=T for tracing this . # # The progress log for each instance bringup plus Error and Warning message[s] # are logged in file $ORACLE_HOME/startup.log. The error messages related to # instance bringup are also logged to syslog (system log module). # The Listener log is located at $ORACLE_HOME_LISTNER/listener.log ...... |
| QUOTE: |
| $ORACLE_HOME/bin/emctl start dbconsole |
| QUOTE: |
| su - oracle -c "/u01/product/10.2.0/db_1/bin/dbstart" su - oracle -c "/u01/product/10.2.0/db_1/bin/emctl start dbconsole" |
| QUOTE: |
| #!/bin/sh #chkconfig: 2345 99 01 #deion: ORACLE 10g Server ORACLE_HOME=/u01/product/10.2.0/db_1 if [ ! -f $ORACLE_HOME/bin/dbstart ] then echo "ORACLE cannot start" exit fi case "$1" in 'start') echo "Starting Oracle Database..." su - oracle -c "$ORACLE_HOME/bin/dbstart" su - oracle -c "$ORACLE_HOME/bin/emctl start dbconsole" ;; 'stop') echo "Stoping Oracle Database" su - oracle -c "$ORACLE_HOME/bin/emctl stop dbconsole" su - oracle -c "$ORACLE_HOME/bin/dbshut" ;; esac |
| QUOTE: |
| #chkconfig: 2345 99 01 #deion: ORACLE 10g Server |
| QUOTE: |
| # cd /etc/rc2.d # ln -s /etc/rc.d/init.d/oracle S99oracle # chkconfig --list oracle # chkconfig --level 2345 on |
【转自】http://www.shineblog.com/user5/net-work/archives/2009/1022166.shtml
来自 “ ITPUB博客 ” ,链接:https://blog.itpub.net/161195/viewspace-1051927/ ,如需转载,请注明出处,否则将追究法律责任。