oracle19c开机自启动

配置

bash 复制代码
cat > /etc/init.d/oracle19c <<'EOF'
#!/bin/bash
# Oracle startup and shutdown script

export ORACLE_HOME=/opt/oracle/product/19c/dbhome_1
export ORACLE_SID=ORCLCDB
export LISTENER_NAME=LISTENER
# General exports and vars
export PATH=$ORACLE_HOME/bin:$PATH

case "$1" in
  start)
    echo "Starting Oracle Database and Listener..."
    sqlplus -s / as sysdba <<EOF1
    startup;
    alter pluggable database all open;
    exit;
EOF1
    lsnrctl start
    ;;
  stop)
    echo "Stopping Oracle Database and Listener..."
    lsnrctl stop
    sqlplus -s / as sysdba <<EOF2
    shutdown immediate;
    exit;
EOF2
    ;;
  *)
    echo "Usage: $0 {start|stop}"
    exit 1
    ;;
esac

exit 0
EOF

chmod 755 /etc/init.d/oracle19c
bash 复制代码
cat > /usr/lib/systemd/system/oracle.service <<"EOF"
[Unit]
Description=Oracle Database and Listener
After=network.target

[Service]
Type=forking
User=oracle
Group=oinstall
ExecStart=/etc/init.d/oracle19c start
ExecStop=/etc/init.d/oracle19c stop
Restart=on-failure

[Install]
WantedBy=multi-user.target
EOF
bash 复制代码
systemctl daemon-reload
systemctl enable --now oracle

参考连接

https://www.cnblogs.com/dll102/p/18454351
https://blog.csdn.net/Pepsiboy1/article/details/141718609?spm=1001.2101.3001.6650.3&utm_medium=distribute.pc_relevant.none-task-blog-2%7Edefault%7EYuanLiJiHua%7EPosition-3-141718609-blog-143025821.235%5Ev43%5Econtrol&depth_1-utm_source=distribute.pc_relevant.none-task-blog-2%7Edefault%7EYuanLiJiHua%7EPosition-3-141718609-blog-143025821.235%5Ev43%5Econtrol&utm_relevant_index=6

相关推荐
小柏ぁ2 分钟前
calico/node is not ready: BIRD is not ready: BGP not established with xxx
运维·docker·kubernetes
Mintimate23 分钟前
云服务器 Linux 手动 DD 安装第三方 Linux 发行版:原理与实战
linux·运维·服务器
RussellFans34 分钟前
Linux 环境配置
linux·运维·服务器
高冷的肌肉码喽1 小时前
Linux-进程间的通信
linux·运维·服务器
乖乖是干饭王1 小时前
Linux系统编程中的_GNU_SOURCE宏
linux·运维·c语言·学习·gnu
jekc8681 小时前
禅道18.2集成LDAP
linux·运维·服务器
weixin_434936282 小时前
k8S 命令
linux·容器·kubernetes
weixin_307779132 小时前
Linux下GCC和C++实现统计Clickhouse数据仓库指定表中各字段的空值、空字符串或零值比例
linux·运维·c++·数据仓库·clickhouse
Tender_光3 小时前
iptables实验
运维·服务器
szxinmai主板定制专家4 小时前
【飞腾AI加固服务器】全国产化飞腾+昇腾310+PCIe Switch的AI大模型服务器解决方案
运维·服务器·arm开发·人工智能·fpga开发