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

相关推荐
Lupino3 小时前
我把 OpenClaw 装到服务器上后,才明白它真正该装在哪里(实战复盘)
运维
蝎子莱莱爱打怪4 小时前
ESXi 强制断电后恢复CentOS7虚拟机避坑指南:解决重复注册&目录清理难题
linux·后端·程序员
xlp666hub1 天前
Leetcode第五题:用C++解决盛最多水的容器问题
linux·c++·leetcode
张宏2361 天前
原子操作 (基于Linux 应用层 C 语言)
linux
kymjs张涛2 天前
OpenClaw 学习小组:初识
android·linux·人工智能
程序设计实验室2 天前
经历分享,发现挖矿木马后,服务器快速备份与重装(腾讯云平台)
linux
Miku162 天前
OpenClaw-Linux+飞书官方Plugin安装指南
linux·人工智能·agent
Miku162 天前
OpenClaw 接入 QQ Bot 完整实践指南
linux·人工智能·agent
Yogurt_cry2 天前
[树莓派4B] 闲置近10年的爱普生 L310 打印机爆改无线打印机
linux·物联网·树莓派
爱吃橘子橙子柚子3 天前
3CPU性能排查总结(超详细)【Linux性能优化】
运维·cpu