oralce设置开机自启动

设置数据库监听自启动

修改/etc/oratab文件N为Y

[oracle@19c ~]$ vim /etc/oratab
# 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.
#
#
orcl:/u01/app/oracle/product/19.2.0/db_1:Y

在/etc/rc.local中添加需执行的命令

[root@19c ~]# cat /etc/rc.local
#!/bin/bash
# THIS FILE IS ADDED FOR COMPATIBILITY PURPOSES
#
# It is highly advisable to create own systemd services or udev rules
# to run scripts during boot instead of using this file.
#
# In contrast to previous versions due to parallel execution during boot
# this script will NOT be run after all other services.
#
# Please note that you must run 'chmod +x /etc/rc.d/rc.local' to ensure
# that this script will be executed during boot.

touch /var/lock/subsys/local

su - oracle -c 'lsnrctl start'
su - oracle -c 'dbstart'

修改 O R A C L E H O M E / b i n / d b s t a r t 文件,修改 O R A C L E H O M E L I S T N E R = ORACLE_HOME/bin/dbstart文件,修改ORACLE_HOME_LISTNER= ORACLEHOME/bin/dbstart文件,修改ORACLEHOMELISTNER=ORACLE_HOME

[oracle@19c db_1]$ vi $ORACLE_HOME/bin/dbstart

#ORACLE_HOME_LISTNER=$1
ORACLE_HOME_LISTNER=$ORACLE_HOME

设置CentOS7,8开机执行/etc/rc.local

chmod a+x /etc/rc.d/rc.local

将 rc-local 服务设置成开机启动

systemctl enable rc-local

[root@19c ~]# systemctl status rc-local
● rc-local.service - /etc/rc.d/rc.local Compatibility
   Loaded: loaded (/usr/lib/systemd/system/rc-local.service; static; vendor preset: disabled)
   Active: active (exited) since Wed 2023-02-22 02:31:07 EST; 11min ago
  Process: 1025 ExecStart=/etc/rc.d/rc.local start (code=exited, status=0/SUCCESS)

至此开机自启动完成

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包

打赏作者

韶博雅

你的鼓励将是我创作的最大动力

¥1 ¥2 ¥4 ¥6 ¥10 ¥20
扫码支付:¥1
获取中
扫码支付

您的余额不足,请更换扫码支付或充值

打赏作者

实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

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

余额充值