linux7开机自启动oracle

描述:

成都创新互联公司主营大化网站建设的网络公司,主营网站建设方案,重庆APP软件开发,大化h5微信小程序搭建,大化网站营销推广欢迎大化等地区企业咨询

        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

文章名称:linux7开机自启动oracle
文章出自:http://bzwzjz.com/article/ijppch.html

其他资讯

Copyright © 2007-2020 广东宝晨空调科技有限公司 All Rights Reserved 粤ICP备2022107769号
友情链接: 做网站设计 成都网站制作 营销型网站建设 成都网站建设 成都网站制作 营销型网站建设 移动网站建设 梓潼网站设计 响应式网站设计 网站制作 网站建设 成都网站设计 品牌网站建设 企业网站建设 营销网站建设 网站制作公司 高端网站设计推广 成都网站设计 成都响应式网站建设 成都网站建设 成都网站建设公司 温江网站设计