LinuxSir.cn,穿越时空的Linuxsir!

 找回密码
 注册
搜索
热搜: shell linux mysql
查看: 1084|回复: 4

关于oracle9i在redhat9下自启动脚本的修改!的一点敲门!

[复制链接]
发表于 2004-1-4 22:12:28 | 显示全部楼层 |阅读模式
以前我在用使用oracle817的时候只要修改一下/etc/oratab文件把N该为Y 然后在
/etc/init.d下新建一个oradb的启动脚本,然后ln s rc0,rc1,rc3,rc5,rc6一下更具不同运行级来启动和关闭数据库;但到了oracle9i就发现这样作数据是不能起来的,监听可以起来,为什么呢?其实很件在启动oracle9i是还要需要两个重要的文件pfile和spfile;里面存放有oracle数据的一些基本参数SGA,db block, db cache,logfile,undo file……;所以我们必须还要修改$oracle_home/bin/dbstart文件
- add the following line:
SPFILE=/dbs/oracle/ora_ap/dbs/spfileoradb.ora[spfile+sid]
PFILE=/dbs/oracle/ora_ap/dbs/init.ora
然后就可以到/etc/init.d/目录下执行
./oradb start|stop 看看有没有成功
我oradba脚本:
                                                                                
#!/bin/bash
  #
  # chkconfig: 35 99 10
  # description: Starts and stops Oracle processes
  #
  # Set ORA_HOME to be equivalent to the $ORACLE_HOME
  # from which you wish to execute dbstart and dbshut;
  #
  # Set ORA_OWNER to the user id of the owner of the
  # Oracle database in ORA_HOME.
  #
. /home/oracle/.bash_profile
  ORA_OWNER=oracle
                                                                                
  case "$1" in
    start)
       echo "Starting Oracle DataBase(s) dbstart in /etc/oratab...."
       # Start the Oracle databases:
       # The following command assumes that the oracle login
       # will not prompt the user for any values
       su - $ORA_OWNER -c $ORACLE_HOME/bin/dbstart
       echo "Starting TNS listener...."

       su - $ORA_OWNER -c "$ORACLE_HOME/bin/lsnrctl start"
                                                                                
        # Start the Intelligent Agent
       if [ -f $ORA_HOME/bin/agentctl ]; then
          su - $ORA_OWNER -c "$ORACLE_HOME/bin/agentctl start"
       else
          su - $ORA_OWNER -c "$ORACLE_HOME/bin/lsnrctl dbsnmp_start"
       fi
       # Start Management Server
       if [ -f $ORACLE_HOME/bin/oemctl ]; then
          su - $ORA_OWNER -c "$ORACLE_HOME/bin/oemctl start oms"
       fi
       # Start HTTP Server
       echo "Starting Oracle DataBase(s) apachectl start ..... "
       if [ -f $ORACLE_HOME/Apache/Apache/bin/apachectl ]; then
          su - $ORA_OWNER -c "$ORACLE_HOME/Apache/Apache/bin/apachectl start"
       fi
       touch /var/lock/subsys/dbora
       ;;
    'stop')
       # Stop HTTP Server
       if [ -f $ORACLE_HOME/Apache/Apache/bin/apachectl ]; then
          su - $ORA_OWNER -c "$ORACLE_HOME/Apache/Apache/bin/apachectl stop"
       fi
       # Stop Management Server
       if [ -f $ORACLE_HOME/bin/oemctl ]; then
          su - $ORA_OWNER -c "$ORACLE_HOME/bin/oemctl stop oms system/system"
       fi
       # Stop the Intelligent Agent
       if [ -f $ORACLE_HOME/bin/agentctl ]; then
          su - $ORA_OWNER -c "$ORACLE_HOME/bin/agentctl stop"
       else
          su - $ORA_OWNER -c "$ORACLE_HOME/bin/lsnrctl dbsnmp_stop"
       fi
       # Stop the TNS Listener
       su - $ORA_OWNER -c "$ORACLE_HOME/bin/lsnrctl stop"
       # Stop the Oracle databases:
       # The following command assumes that the oracle login
       # will not prompt the user for any values
       su - $ORA_OWNER -c $ORACLE_HOME/bin/dbshut
       rm -f /var/lock/subsys/dbora
       ;;
  esac

  # End of script dbora
发表于 2004-1-6 16:49:21 | 显示全部楼层
呵呵,修改脚本是一个途径,最简单的就是直接create pfile from spfile这样创建一个pfile,一来作个文本的备份,二来也不用修改脚本了。
 楼主| 发表于 2004-1-7 15:11:06 | 显示全部楼层
这样做是为了转换init.ora到spfile吧!
发表于 2004-1-8 17:16:32 | 显示全部楼层
说反了,是为了转换spfile到pfile,目的就是为了生成一个pfile,这样dbstart脚本就不会报错了
 楼主| 发表于 2004-1-13 07:15:54 | 显示全部楼层
多谢大虾指正;谢谢;
您需要登录后才可以回帖 登录 | 注册

本版积分规则

快速回复 返回顶部 返回列表