linux7 开机自启动oracle
描述:
linux7安装oracle11G后,设置开机自启动
问题:
当服务器重启或使用systemctl start oracle.service以后,会把在start的脚本执行,并把stop的脚本一起执行。
配置文件和脚本:
[root@localhostray]#vim/lib/systemd/system/oracle.service[Unit]Description=oracleServerAfter=network.target[Service]Type=forkingExecStart=/root/scripts/dbstart.shExecStop=/root/scripts/dbstop.shExecReload=PrivateTmp=true[Install]WantedBy=multi-user.target[root@localhostscripts]#vimdbstart.sh#!/bin/bashsu-oracle-c"dbstart"[root@localhostscripts]#vimdbstop.sh#!/bin/bashsu-oracle-c"dbshut"
解决:
不使用脚本调用oracle用户的命令,而是直接指定服务的用户和属组。
[root@localhostray]#vim/lib/systemd/system/oracle.service[Unit]Description=oracleServerAfter=network.target[Service]Type=forkingUser=oracleGroup=oinstallExecStart=/u01/oracle/product/11.2.0/db_1/bin/dbstartExecStop=/u01/oracle/product/11.2.0/db_1/bin/dbshutExecReload=PrivateTmp=true[Install]WantedBy=multi-user.target
声明:本站所有文章资源内容,如无特殊说明或标注,均为采集网络资源。如若本站内容侵犯了原著者的合法权益,可联系本站删除。