CentOS 7.6 RPM 方式安装Oracle19c 后 使用 systemd 的方式设置开机自动启动Oracle数据库...

1. 方法简介:

使用systemd 来进行 oracle数据库的启动和关闭操作. 使用的脚本为 lsnrctl和dbstart

2. 修改事项.

需要先修改一下 oracle 的启动脚本配置:

vim /etc/oratab

将里面 最后一句话设置从N 修改为Y 允许启动

ORA19C:/opt/oracle/product/19c/dbhome_1:Y

注意这个文档说明:

# This file is used by ORACLE utilities.  It is created by root.sh
# and updated by either Database Configuration Assistant while creating
# a database or ASM Configuration Assistant while creating ASM instance.

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

3. 然后设置一下 数据库的启动命令

vim /usr/bin/oracle.sh

增加的内容为:
#! /bin/bash
#  script  For oracle19c.service
/opt/oracle/product/19c/dbhome_1/bin/lsnrctl start
/opt/oracle/product/19c/dbhome_1/bin/dbstart /opt/oracle/product/19c/dbhome_1

然后设置这个文件的读写权限

chmod 777 /usr/bin/oracle.sh

4. 设置一个 oracle19c.service

vim /etc/systemd/system/oracle19c.service

编辑添加内容为:

[Unit]
Description=Oracle19c
After=syslog.target network.target

[Service]
LimitMEMLOCK=infinity
LimitNOFILE=65535
Type=oneshot
RemainAfterExit=yes
User=oracle
Environment="ORACLE_HOME=/opt/oracle/product/19c/dbhome_1"
ExecStart=/usr/bin/oracle.sh

[Install]
WantedBy=multi-user.target

5. 设置开机自动启动

systemctl enable oracle19c

6. 重启测试.

成功. 

 

转载于:https://www.cnblogs.com/jinanxiaolaohu/p/10799269.html

  • 0
    点赞
  • 6
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值