描述: linux7安装oracle11G后,设置开机自启动 问题:
描述:
问题:
当服务器重启或使用systemctl start oracle.service以后,会把在start的脚本执行,并把stop的脚本一起执行。
配置文件和脚本:
[root@localhost ray]# vim /lib/systemd/system/oracle.service
[Unit]
Description=oracle Server
After=network.target
[Service]
Type=forking
ExecStart=/root/scripts/dbstart.sh
ExecStop=/root/scripts/dbstop.sh
ExecReload=
PrivateTmp=true
[Install]
WantedBy=multi-user.target
[root@localhost scripts]# vim dbstart.sh
#!/bin/bash
su - oracle -c "dbstart"
[root@localhost scripts]# vim dbstop.sh
#!/bin/bash
su - oracle -c "dbshut"
解决:
不使用脚本调用oracle用户的命令,而是直接指定服务的用户和属组。
[root@localhost ray]# vim /lib/systemd/system/oracle.service
[Unit]
Description=oracle Server
After=network.target
[Service]
Type=forking
User=oracle
Group=oinstall
ExecStart=/u01/oracle/product/11.2.0/db_1/bin/dbstart
ExecStop=/u01/oracle/product/11.2.0/db_1/bin/dbshut
ExecReload=
PrivateTmp=true
[Install]
WantedBy=multi-user.target
--结束END--
本文标题: linux7 开机自启动oracle
本文链接: https://www.lsjlt.com/news/45975.html(转载时请注明来源链接)
有问题或投稿请发送至: 邮箱/279061341@qq.com QQ/279061341
下载Word文档到电脑,方便收藏和打印~
2024-03-01
2024-03-01
2024-03-01
2024-03-01
2024-03-01
2024-02-29
2024-02-29
2024-02-29
2024-02-29
2024-02-29
回答
回答
回答
回答
回答
回答
回答
回答
回答
回答
0