Linux环境中配置Oracle开机自启.doc_第1页
Linux环境中配置Oracle开机自启.doc_第2页
Linux环境中配置Oracle开机自启.doc_第3页
Linux环境中配置Oracle开机自启.doc_第4页
Linux环境中配置Oracle开机自启.doc_第5页
已阅读5页,还剩1页未读 继续免费阅读

下载本文档

版权说明:本文档由用户提供并上传,收益归属内容提供方,若内容存在侵权,请进行举报或认领

文档简介

Linux环境中配置Oracle开机自启一、使用root用户修改/etc/oratab 文件:$ gedit /etc/orataborcl:/oracle/app/product/10.2.0/db_1:N改为:orcl:/oracle/app/product/10.2.0/db_1:Y也就是将最后的N改为Y二、使用Oracle用户修改$ORACLE_HOME/bin/dbstart文件:# su - oracle$ cd $ORACLE_HOME/bin$ gedit dbstart找到 ORACLE_HOME_LISTNER=.这行, 修改成ORACLE_HOME_LISTNER=/u01/app/oracle/product/10.1.0/db_1或者直接修改成:ORACLE_HOME_LISTNER=$ORACLE_HOME注意:是修改,不是增加,可使用gedit的查找功能查找:ORACLE_HOME_LISTNER,然后进行修改,修改后保存三、测试运行 dbshut, dbstart 看能否启动Oracle 服务及listener服务:1.修改dbstart和dbshut的日志文件的权限:$su - root#cd $ORACLE_HOME#chown oracle:oinstall startup.log#chown oracle:oinstall shutdown.log2.执行相应的脚本进行测试#su - oracle$cd $ORACLE_HOME/bin$./dbstart (./dbshut)$ ps -efw | grep ora_$ lsnrctl status$ ps -efw | grep LISTEN | grep -v grep四:创建服务$su - root# cd /etc/rc.d/init.d/# gedit oradbstart复制如下脚本1或者脚本2内容到oradbstart文件:注意点(1).#开始的行不能少,否则后面运行chkconfig命令会报错:oradbstart 服务不支持chkconfig(2).根据自己的环境修改环境变量配置部分(3).从windows下面保存的如下脚本内容,通过ISO复制到linux,再将脚本复制到oradbstart文件中后,在终端下用vi oradbstart命令打开,一些行后面可能有类似M的字符,将其删除,否则在运行后面的chkconfig命令后,在/etc/rc.d/rcN.d目录(N为运行级别)下生成的S99oradbstart文件是空的,可以用vi查看S99oradbstart文件,内容应该和/etc/rc.d/init.d/oradbstart文件内容相同才是正确的(第三种情况是我在xp下使用虚拟机VMWARE安装linux,并将如下脚本保存成文本文件,然后制作成ISO文件,然后把ISO里面的文件的内容复制到oradbstart时遇到的,这种情况一些行后面类似M的字符,用gedit无法看到,只有使用vi才能看到)-脚本1#!/bin/bash# chkconfig: 345 99 10# description: Startup Script for Oracle Databases# /etc/rc.d/init.d/dbstartexport ORACLE_BASE=/u01/app/oracle/export ORACLE_HOME=/u01/app/oracle/product/10.2.0/db_1export ORACLE_SID=orclexport PATH=$PATH:$ORACLE_HOME/binORA_OWNR=oracle# if the executables do not exist - display errorif ! -f $ORACLE_HOME/bin/dbstart -o ! -d $ORACLE_HOME thenecho Oracle startup: cannot startexit 1fi# depending on parameter - startup, shutdown, restart# of the instance and listener or usage displaycase $1 instart)# Oracle listener and instance startupecho -n Starting Oracle: su - $ORA_OWNR -c $ORACLE_HOME/bin/dbstarttouch /var/lock/Oraclesu - $ORA_OWNR -c $ORACLE_HOME/bin/emctl start dbconsolesu - $ORA_OWNR -c $ORACLE_HOME/bin/isqlplusctl startecho OK;stop)# Oracle listener and instance shutdownecho -n Shutdown Oracle: su - $ORA_OWNR -c $ORACLE_HOME/bin/emctl stop dbconsolesu - $ORA_OWNR -c $ORACLE_HOME/bin/isqlplusctl stopsu - $ORA_OWNR -c $ORACLE_HOME/bin/dbshutsu - $ORA_OWNR -c $ORACLE_HOME/bin/lsnrctl stoprm -f /var/lock/Oracleecho OK;reload|restart)$0 stop$0 start;*)echo Usage: basename $0 start|stop|restart|reloadexit 1esacexit 0-脚本2(只启动数据库和听)#!/bin/bash# chkconfig: 345 99 10# description: Startup Script for Oracle Databases# /etc/rc.d/init.d/oradbstartexport ORACLE_BASE=/u01/app/Oracle/export ORACLE_HOME=/u01/app/Oracle/product/10.2.0/db_1export ORACLE_SID=orclexport PATH=$PATH:$ORACLE_HOME/bincase $1 instart)su Oracle -c $ORACLE_HOME/bin/dbstarttouch /var/lock/Oracleecho OK;stop)echo -n Shutdown Oracle: su Oracle -c $ORACLE_HOME/bin/dbshutrm -f /var/lock/Oracleecho OK;*)echo Usage: basename $0 start|stopexit 1esacexit 0保存退出。打开终端执行:$su - root#chown oracle.oinstall /etc/rc.d/init.d/oradbstart#chmod 775 /etc/rc.d/init.d/oradbstart然后执行:chkconfig -add oradbstartchkconfig -list oradbstartchkconfig -list oradbstart运行结果:oradbstart 0:off 1:off 2:off 3:on 4:on 5:on 6:off五.检查:根据上面的运行结果,当相应的运行级别为on时(例如:5:on),在对应的/etc/rc.d/rcN.d(例如:和5:on对应的是:/etc/rc.d/rc5.d)下面会生成一个文件:S99oradbstart,使用vi S99oradbstart打开该文件,可以看到该文件的内容和/etc/rc.d/init.d/oradbstart内容相同,表示配置成功,其实,S99oradbstart是一个到/etc/rc.d/init.d/oradbstart的链接,我们可以使用file命令来查看:$file /etc/rc.d/rc5.d/S99oradbstartS99oradbstart:symbolic link to ./init.d/oradbstart六.一点说明:脚本文件中的:# chkco

温馨提示

  • 1. 本站所有资源如无特殊说明,都需要本地电脑安装OFFICE2007和PDF阅读器。图纸软件为CAD,CAXA,PROE,UG,SolidWorks等.压缩文件请下载最新的WinRAR软件解压。
  • 2. 本站的文档不包含任何第三方提供的附件图纸等,如果需要附件,请联系上传者。文件的所有权益归上传用户所有。
  • 3. 本站RAR压缩包中若带图纸,网页内容里面会有图纸预览,若没有图纸预览就没有图纸。
  • 4. 未经权益所有人同意不得将文件中的内容挪作商业或盈利用途。
  • 5. 人人文库网仅提供信息存储空间,仅对用户上传内容的表现方式做保护处理,对用户上传分享的文档内容本身不做任何修改或编辑,并不能对任何下载内容负责。
  • 6. 下载文件中如有侵权或不适当内容,请与我们联系,我们立即纠正。
  • 7. 本站不保证下载资源的准确性、安全性和完整性, 同时也不承担用户因使用这些下载资源对自己和他人造成任何形式的伤害或损失。

评论

0/150

提交评论