前往小程序,Get更优阅读体验!
立即前往
首页
学习
活动
专区
工具
TVP
发布
社区首页 >专栏 >Linux下设置Oracle自启动

Linux下设置Oracle自启动

作者头像
bisal
发布2019-01-29 11:13:52
2.4K0
发布2019-01-29 11:13:52
举报
文章被收录于专栏:bisal的个人杂货铺

测试机总是断电,导致重启后Oracle不自动重启,需要手工操作,因此可以设置成自启动模式。

操作系统:Linux

数据库:Oracle 10g

1、vi /etc/oratab

找到bisal:/opt/oracle/102:N,将N设为Y。

文件的注释:

# 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.

可以看到这里$ORACLE_SID是bisal,$ORACLE_HOME是/opt/oracle/102。

设置为Y时,允许实例自启动,当设置为N时,则不允许自启动。 

这个文件里的配置仅仅起一个开关的作用,其并不会具体的执行启动和关闭,具体的操作由$ORACLE_HOME/bin/dbstart和dbshut 脚本来实现。 这2个脚本在执行时会检查/etc/oratab 文件里的配置,为Y时才能继续执行。

2、将lsnrctl start和dbstart添加到rc.local文件中:

vi /etc/rc.d/rc.local

su oracle -lc "/opt/oracle/102/bin/lsnrctl start"

su oracle -lc  /opt/oracle/102/bin/dbstart

文件:

#!/bin/sh # # This script will be executed *after* all the other init scripts. # You can put your own initialization stuff in here if you don't # want to do the full Sys V style init stuff.

此处也可以使用自己定义的脚本作为启动脚本。

然后重启服务器,就可以看到监听和实例都可以自动启动了。

本文参与 腾讯云自媒体同步曝光计划,分享自作者个人站点/博客。
原始发表:2014年02月12日,如有侵权请联系 cloudcommunity@tencent.com 删除

本文分享自 作者个人站点/博客 前往查看

如有侵权,请联系 cloudcommunity@tencent.com 删除。

本文参与 腾讯云自媒体同步曝光计划  ,欢迎热爱写作的你一起参与!

评论
登录后参与评论
0 条评论
热度
最新
推荐阅读
相关产品与服务
数据库
云数据库为企业提供了完善的关系型数据库、非关系型数据库、分析型数据库和数据库生态工具。您可以通过产品选择和组合搭建,轻松实现高可靠、高可用性、高性能等数据库需求。云数据库服务也可大幅减少您的运维工作量,更专注于业务发展,让企业一站式享受数据上云及分布式架构的技术红利!
领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档