1、root用户下修改/etc/oratab文件:将ora9idb:/u01/app/oracle/product/9.2.0/db_1:N改为ora9idb:/u01/app/oracle/product/9.2.0/db_1:Y
ora9idb:/u01/app/oracle/product/9.2.0/db_1:Y
2、oracle用户下执行dbstart(执行之前最好先将数据库shutdown immediate)
执行dbstart启动数据库数据库可能无法启动,报告Can’t find init file …的错误,如果没有报错,直接启动成功也有可能(oracle 高版本11g是这样的,10g还没有实验;9i肯定会失败).
解决办法:
需要复制一个初始化文件: cp /opt/oracle/admin/gedb/pfile/init.ora.* /opt/oracle/product/9.2.0/dbs/initgedb.ora(具体要看环境变量设置)
实际上就是在执行:cp $ORACLE_BASE/admin/$ORACLE_SID/pfile/init.ora.* $ORACLE_HOME/dbs/init$ORACLE_SID.ora.
cp完成后,再次执行dbstart就可以了.
3、截止到第2步骤,是在手工操作启动数据库.假如需要在操作系统时,自动启动数据库监听及数据库,还需要做一点操作:
root身份登陆,在/etc/rc.d/rc.local文件末尾添加两行命令即可:
su - oracle -c "lsnrctl start"
su - oracle -c "dbstart"
然后,reboot你的os,测试一下是否启动成功!
执行dbstart时报错
gtone-> dbstart ORACLE_HOME_LISTNER is not SET, unable to auto-start Oracle Net Listener Usage: /u01/app/oracle/product/11.2.0/db_1/bin/dbstart ORACLE_HOME Processing Database instance "CQRCB": log file /u01/app/oracle/product/11.2.0/db_1/startup.log gtone->
解决办法
gtone-> cp /u01/app/oracle/product/11.2.0/db_1/bin/dbstart //u01/app/oracle/product/11.2.0/db_1/bin/dbstart.bak gtone-> ll total 20 -rw-r----- 1 oracle oinstall 16549 Jan 5 13:10 CreateDatabase-summary.html gtone-> vi /u01/app/oracle/product/11.2.0/db_1/bin/dbstart #!/bin/sh # # $Id: dbstart.sh /st_buildtools_11.2.0/1 2013/01/24 16:20:35 tmagana Exp $ # Copyright (c) 1991, 2013, Oracle and/or its affiliates. All rights reserved. # ################################### # # usage: dbstart $ORACLE_HOME # # This script is used to start ORACLE from /etc/rc(.local). # It should ONLY be executed as part of the system boot procedure. # # This script 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 script will ignore that entry. # # This script 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 script, 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 script will block init from completing the boot # cycle. # # If you want dbstart to auto-start a single-instance database that uses # an ASM server that is auto-started by CRS (this is the default behavior # for an ASM cluster), you must change the database's ORATAB entry to use # a third field of "W" and the ASM's ORATAB entry to use a third field of "N". # These values specify that dbstart auto-starts the database only after # the ASM instance is up and running. # # Note: # Use ORACLE_TRACE=T for tracing this script. # # 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 # # On all UNIX platforms except SOLARIS # ORATAB=/etc/oratab # # To configure, update ORATAB with Instances that need to be started up # Entries are of the form: # $ORACLE_SID:$ORACLE_HOME:<N|Y|W>: # An example entry: # main:/usr/lib/oracle/emagent_10g:Y # # Overall algorithm: # 1) Bring up all ASM instances with 'Y' entry in status field in oratab entry # 2) Bring up all Database instances with 'Y' entry in status field in # oratab entry # 3) If there are Database instances with 'W' entry in status field # then # iterate over all ASM instances (irrespective of 'Y' or 'N') AND # wait for all of them to be started # fi # 4) Bring up all Database instances with 'W' entry in status field in # oratab entry # ##################################### LOGMSG="logger -puser.alert -s " trap 'exit' 1 2 3 # for script tracing case $ORACLE_TRACE in T) set -x ;; esac # Set path if path not set (if called from /etc/rc) SAVE_PATH=/bin:/usr/bin:/etc:${PATH} ; export PATH SAVE_LLP=$LD_LIBRARY_PATH # First argument is used to bring up Oracle Net Listener # ORACLE_HOME_LISTNER=$1 ORACLE_HOME_LISTNER=$ORACLE_HOME (将$1替换成$ORACLE_HOME) if [ ! $ORACLE_HOME_LISTNER ] ; then echo "ORACLE_HOME_LISTNER is not SET, unable to auto-start Oracle Net Listener" echo "Usage: $0 ORACLE_HOME" else LOG=$ORACLE_HOME_LISTNER/listener.log # Set the ORACLE_HOME for the Oracle Net Listener, it gets reset to # a different ORACLE_HOME for each entry in the oratab. ORACLE_HOME=$ORACLE_HOME_LISTNER ; export ORACLE_HOME
再次验证dbstart命令
gtone-> dbstart Processing Database instance "CQRCB": log file /u01/app/oracle/product/11.2.0/db_1/startup.log