栏目分类:
子分类:
返回
名师互学网用户登录
快速导航关闭
当前搜索
当前分类
子分类
实用工具
热门搜索
名师互学网 > IT > 系统运维 > 运维 > Linux

linux 开机自启动 oracle

Linux 更新时间: 发布时间: IT归档 最新发布 模块sitemap 名妆网 法律咨询 聚返吧 英语巴士网 伯小乐 网商动力

linux 开机自启动 oracle

思路 /etc/rc.d/rc.local 中修改,添加oracle 启动命令【虚拟机中存在部分不生效的问题】

1、/etc/rc.d/下,创建 start_oracle.sh 文件 修改权限700

#!/bin/bash

###LOGING
LOG=/home/oracle/oracle_start_log/`date "+%Y%m%d-%H%M%S"`_log_z.txt  ## 日志存放地址

###Start listener
lsnrctl status  >> $LOG 2>&1
nolis_num=`grep -i "no listener" $LOG |wc -l`
if [ $nolis_num -ne 0 ];then
  lsnrctl start  >> $LOG 2>&1
fi

###database status
sqlplus / as sysdba >> $LOG 2>&1 << eeooff
 select status from v$instance;
 exit
eeooff

###if database not open then database start
db_status=`grep -A 3 STATUS $LOG |grep "OPEN" |wc -l`
if [ $db_status -ne 1 ];then
sqlplus / as sysdba >> $LOG 2>&1 << eeooff
 startup force;
 exit
eeooff
fi

2、/etc/rc.d/rc.local添加命令

su - oracle -lc "/bin/bash /home/oracle/start_oracle.sh"

一下是第二种方法

1、修改文件 /etc/oratab 注意文件需要有执行权限

orcl:/data/app/oracle/product/12.2.0/dbhome_1:Y

实例名:安装路径:Y(自动启动的意思)

2、修改文件 /etc/rc.d/rc.local  注意文件需要有执行权限

su oracle -lc "/data/app/oracle/product/12.2.0/dbhome_1/bin/lsnrctl start"
su oracle -lc "/data/app/oracle/product/12.2.0/dbhome_1/bin/dbstart"
 

转载请注明:文章转载自 www.mshxw.com
本文地址:https://www.mshxw.com/it/885042.html
我们一直用心在做
关于我们 文章归档 网站地图 联系我们

版权所有 (c)2021-2022 MSHXW.COM

ICP备案号:晋ICP备2021003244-6号