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  /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. 重启测试.

成功.

最新文章

  1. jQuery验证插件 Validate详解
  2. ASP.NET MVC 异常Exception拦截器Fillter
  3. moment.js 的简单应用
  4. mysql提示:Illegal mix of collations for operation ‘UNION’
  5. BZOJ2121 字符串游戏
  6. 消息系统Kafka介绍
  7. 直接使用ip访问google搜索
  8. switch函数——Gevent源码分析
  9. Java 多线程 (并发)总结
  10. 玩转web之javaScript(五)---js和jquery一些不可不知的方法(input篇)
  11. mongodb中limit与skip方法
  12. Ubuntu 安装 Mysql 5.6 数据库
  13. Flask入门之SQLAlchemy配置与数据库连接
  14. centOS6.5 mysql-community-server安装失败
  15. 百度地图开发者API学习笔记一(转载)
  16. Gedit浏览器常用快捷键备注
  17. 超恶心的TP模版取值
  18. php in_array 的一个坑
  19. linux安装部署Nginx
  20. Elasticsearch分布式机制探究

热门文章

  1. thinkphp5杂谈--模板
  2. vue导航菜单动态展示
  3. Mybatis-Plus和Mybatis的区别
  4. Qt新建工程
  5. 【转载】mysqld_safe Directory ‘/var/run/mysqld’ for UNIX socket file don’t exists.
  6. Module not found: Error: Can&#39;t resolve &#39; vue-resource&#39;
  7. jconsole性能监控
  8. java.sql.SQLException: The server time zone value &#39;&#195;–&#195;&#194;&#185;&#195;&#186;&#194;&#177;&#195;&#170;&#195;—&#194;&#188;&#195;Š&#194;&#177;&#194;&#188;&#195;&#164;&#39; is unrecognized or repr
  9. MVC的一个简单实例
  10. Oracle JET Router 与 Module 数据传递