Linux中在Oracle安装完毕以后,如果重新启动Linux ,Oracle是不会自动启动的,你可以通过手动调用dbstart命令来进行启动,不过这样似乎也很繁琐.我们可以通过配置Oracle的自动启动脚本,然后利用Linux的Service来启动Oracle服务器.
首先在/etc/init.d/目录下配置Oracle的服务文件.
- touch oracle10g
- chmod a+x oracle10g
然后编辑此oracle10g文件.内容如下.
# !/bin/bash
# whoami
# root
# chkconfig: 345 51 49
# /etc/init.d/oracle10g
# description: starts the oracle dabase deamons
#
ORA_HOME=/oracle/product/10.2.0/db_1/
ORA_OWNER=oracle
case "$1" in
start)
echo -n "Starting oracle10g: "
su - $ORA_OWNER -c "$ORA_HOME/bin/dbstart" &
su - $ORA_OWNER -c "$ORA_HOME/bin/lsnrctl start"
touch /var/lock/subsys/oracle10g
echo
;;
stop)
echo -n "shutting down oracle10g: "
su - $ORA_OWNER -c "$ORA_HOME/bin/dbshut" &
su - $ORA_OWNER -c "$ORA_HOME/bin/lsnrctl stop"
rm -f /var/lock/subsys/oracle10g
echo
;;
restart)
echo -n "restarting oracle10g: "
$0 stop
$0 start
echo
;;
*)
echo "Usage: `basename $0` start|stop|restart"
exit 1
esac
exit 0
保存文件,退出以后,添加并启动察看服务.
- /sbin/chkconfig --add oracle10g
- /sbin/chkconfig --list oracle10g
重新启动Linux的时候,如果看到启动项Oracle出现OK,代表Oracle成功随Linux启动了.
注意:
这样的脚本启动一般不会启动实例,如果想让实例也随脚本一起启动的话,就需要修改文件:/etc/oratab
如果这个文件不存在,那么就得运行脚本文件产生它.ex:
- sh /oracle/product/10.2.0/db_1/root.sh
比如我的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.
#
#
orcl:/oracle/product/10.2.0/db_1:N
只要在这里设置好后,在配合上面的脚本,即可实现开机自动启动oracle以及实例了.
在dbstart文件中的默认ORACLE_HOME_LISTNER可能是不正确的,编辑dbstart文件
vi dbstar
将该行改为ORACLE_HOME_LISTNER=$ORACLE_HOME
保存退出,然后执行dbstart就没问题了。
分享到:
相关推荐
linux下oracle 服务和监听开机自动启动
Linux 下设置oracle 10g 自动启动服务 Linux 下设置oracle 10g 自动启动服务
Linux下自动启动_关闭oracle.txt 简单,易用, 所有文件有说明/有模板.
在redhat环境下设置oracle10g开机自动启动
linux下自动启动数据库脚本,有兴趣的可以看下,linux是怎么自启动Oracle数据库的
Linux下Oracle自启动脚本,在系统启动的时候自动启动数据库。
个人实施的日记,记述了配置oracle10g在linux中自启动工作的全部过程
linux中安装了数据库之后机器重启之后,会提示数据库无法使用的问题,主要是一些环境参数没有设置的原因,设置好环境参数之后以后oracle数据实例就会随着linux系统启动而自动启动。
linux oracle 12c 自动启动.docx Oracle12c2 开机自动启动 触发器 SQL> create or replace trigger open_pbds 2 after startup on database 3 begin 4 execute immediate 'ALTER PLUGGABLE DATABASE ALL OPEN'; ...
redhat linux下设置oracle随操作系统自动启动的方法.docx
linux操作系统下,oracle数据库自启动配置。 用于服务器重启时,自动加载某些服务。
linux as5下面把oracle做成服务自动启动里面包含了一个文档供参考还有在linux下面oracle10作为服务的脚本文件 来源http://badboyryan.blogjava.net
linux中安装oracle以及自启动,详细介绍了如何在linux操作系统下安装oracle的步骤
linux设置Oracle开机自动启动.docx
ORACLE11g随RHEL5系统自动启动与关闭
简单快捷,一步步亲手截图操作,内含orale安装,Oracle的开机自动启动,命令的配置讲解,让你一个新手也能在Linux环境下10分钟内装好Oracle
本文档主要介绍在Linux(CentOS-5.3)下安装Oracle10.2.1g并将其配置为自启动服务的过程 二 读者对象 Linux服务器维护人员和数据库维护人员 三 具体步骤 所有命令若无特别说明则默认在终端中输入,#代表root用户,...
在CentOS 6.3下安装完Oracle 10g R2,重开机之后,你会发现Oracle没有自行启动,这是正常的,因为在Linux下安装Oracle的确不会自行启动,必须要自行设定相关参数,首先先介绍一般而言如何启动oracle。 一、在Linux下...
在Linux系统中安装Oracle; 安装Oracle过程中的错误解决方案 Oracle自动启动服务配置
NULL 博文链接:https://lbyzx123.iteye.com/blog/829235