首页 诗词 字典 板报 句子 名言 友答 励志 学校 网站地图
当前位置: 首页 > 教程频道 > 数据库 > 其他数据库 >

解决Oracle使用DBSTART启动的有关问题

2014-01-12 
解决Oracle使用DBSTART启动的问题在linux系统下安装完成oracle以后需要设置oracle开机启动,以防以后使用中

解决Oracle使用DBSTART启动的问题
在linux系统下安装完成oracle以后需要设置oracle开机启动,以防以后使用中突然断电,需要手动启动oracle
我在设置开机启动oracle的时候使用的dbstarte
因为使用dbstart的时候需要用到linux下的/etc/oratab 文件如果没有此文件的话可以从

# This file is used by ORACLE utilities.  It is created by root.sh# and updated by the Database Configuration Assistant when creating# a database.# A colon, ':', is used as the field terminator.  A new line terminates# the entry.  Lines beginning with a pound sign, '#', are comments.## Entries are of the form:#   $ORACLE_SID:$ORACLE_HOME:<N|Y>:## The first and second fields are the system identifier and home# directory of the database respectively.  The third filed indicates# to the dbstart utility that the database should , "Y", or should not,# "N", be brought up at system boot time.## Multiple entries with the same $ORACLE_SID are not allowed.##xxxx:/opt/app/oracle/product/10.2:Y

这里复制粘贴.
其中第一个冒号前面的是oracle的SID 设置为自己需要的SID
后面为ORACLE_HOME就是oracle在本机的安装路径这个路径必须和设置在/etc/profile的ORACLE_HOME相同
最后一个是是否使用dbstart启动
这个文件复制好以后
可以使用如下代码创建oratab

 cd /etc/ vi oratab 复制上面的内容粘贴进去然后输入:wq

保存成功以后这个步骤就算完成了
 首先打开/etc/profile vi /etc/profile 在文件的最后面添加如下代码export ORACLE_HOME="oracle的安装路径"export ORACLE_SID=orclexport PATH=$ORACLE_HOME/bin:$PATH

建立oracle的全局变量
然后在/etc/init.d 下面建立oracle的启动文件
cd /etc/init.dvi oracle复制下面的代码#!/bin/sh# chkconfig: 35 80 10# description: Oracle auto start-stop script.## 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.ORA_HOME=/opt/app/oracle/product/10.2ORA_OWNER=oracleif [ ! -f $ORA_HOME/bin/dbstart ]then    echo "Oracle startup: cannot start"    exitficase "$1" in'start')# Start the Oracle databases:echo "Starting Oracle Databases ... "echo "-------------------------------------------------" >> /var/log/oracle.logdate +" %T %a %D : Starting Oracle Databases as part of system up." >> /var/log/oracle.logecho "-------------------------------------------------" >> /var/log/oracle.logsu - $ORA_OWNER -lc "$ORA_HOME/bin/dbstart" >> /var/log/oracle.logecho "Done"# Start the Listener:echo "Starting Oracle Listeners ... "echo "-------------------------------------------------" >> /var/log/oracle.logdate +" %T %a %D : Starting Oracle Listeners as part of system up." >> /var/log/oracle.logecho "-------------------------------------------------" >> /var/log/oracle.logsu - $ORA_OWNER -lc "$ORA_HOME/bin/lsnrctl start" >>/var/log/oracle.logecho "Done."echo "-------------------------------------------------" >> /var/log/oracle.logdate +" %T %a %D : Finished." >> /var/log/oracle.logecho "-------------------------------------------------" >> /var/log/oracle.log;;'stop')# Stop the Oracle Listener:echo "Stoping Oracle Listeners ... "echo "-------------------------------------------------" >> /var/log/oracle.logdate +" %T %a %D : Stoping Oracle Listener as part of system down." >> /var/log/oracle.logecho "-------------------------------------------------" >> /var/log/oracle.logsu - $ORA_OWNER -lc "$ORA_HOME/bin/lsnrctl stop" >>/var/log/oracle.logecho "Done."# Stop the Oracle Database:echo "Stoping Oracle Databases ... "echo "-------------------------------------------------" >> /var/log/oracle.logdate +" %T %a %D : Stoping Oracle Databases as part of system down." >> /var/log/oracle.logecho "-------------------------------------------------" >> /var/log/oracle.logsu - $ORA_OWNER -lc "$ORA_HOME/bin/dbshut" >>/var/log/oracle.logecho "Done."echo ""echo "-------------------------------------------------" >> /var/log/oracle.logdate +" %T %a %D : Finished." >> /var/log/oracle.logecho "-------------------------------------------------" >> /var/log/oracle.log;;'restart')$0 stop$0 start;;esac:wq

文件路径按照自己的需要需要修改一下
保存上面文件后
需要输入下面的命令
chmod -x oraclechkconfig --add oraclechkconfig --level 3 5 oracle on上面命令是赋予oracle执行权限把oracle添加在系统启动列表中输入 chkconfig --list|grep oracle可以查看是否添加成功

完成上面配置 基本就完成了oracle在centenos下面的开机启动了

热点排行