Chinaunix首页 | 论坛 | 博客
  • 博客访问: 3540361
  • 博文数量: 715
  • 博客积分: 1860
  • 博客等级: 上尉
  • 技术积分: 7745
  • 用 户 组: 普通用户
  • 注册时间: 2008-04-07 08:51
个人简介

偶尔有空上来看看

文章分类

全部博文(715)

文章存档

2023年(75)

2022年(134)

2021年(238)

2020年(115)

2019年(11)

2018年(9)

2017年(9)

2016年(17)

2015年(7)

2014年(4)

2013年(1)

2012年(11)

2011年(27)

2010年(35)

2009年(11)

2008年(11)

最近访客

分类: Oracle

2021-08-01 18:45:58


rhel7 ,oracle 19.10 单机,测试环境,想随主机自动启动数据库和侦听
1、以root身份编辑/etc/oratab,

其格式说明:
$ORACLE_SID:$ORACLE_HOME:
修改完后可以先 以oracle身份执行
$ dbstart $ORACLE_HOME
验证能否启动数据库和侦听

2、编辑ora.service

进入systemctl目录
# cd /usr/lib/systemd/system/

编辑服务控制文件
# vi ora.service

  1. [Unit]
  2. Description=Oracle Database Start/Stop Service
  3. After=syslog.target network.target local-fs.target remote-fs.target

  4. [Service]
  5. # systemd, by design does not honor PAM limits
  6. # See: https://bugzilla.redhat.com/show_bug.cgi?id=754285
  7. LimitNOFILE=65536
  8. LimitNPROC=16384
  9. LimitSTACK=32M
  10. LimitMEMLOCK=infinity
  11. LimitCORE=infinity

  12. Type=simple
  13. User=oracle
  14. Group=oinstall
  15. Restart=no
  16. ExecStart=/u01/app/oracle/product/19.3/db_1/bin/dbstart /u01/app/oracle/product/19.3/db_1
  17. RemainAfterExit=yes
  18. ExecStop=/u01/app/oracle/product/19.3/db_1/bin/dbshut /u01/app/oracle/product/19.3/db_1
  19. TimeoutStopSec=5min

  20. [Install]
  21. WantedBy=multi-user.target

注意ExecStart对应的命令位置不能使用$ORACLE_HOME环境变量。

3、激活服务

  1. # systemctl enable ora
  2. # systemctl daemon-reload

验证一下
systemctl start ora
systemctl status ora 
看是否正常
# ps -ef | grep -E 'ckpt|tnslsnr' | grep -v grep

参考:
自动停止数据库(dbshut)在 OL 7 的 systemd 中不能运行 (Doc ID 2364833.1)
如何在 Linux 上自动启动/关闭 Oracle 数据库(文档 ID 222813.1)
阅读(1487) | 评论(0) | 转发(0) |
给主人留下些什么吧!~~