[systemd-devel] starting Oracle with systemd
Fisher, Charles J. (Top Echelon)
Charles.Fisher at alcoa.com
Tue Oct 28 12:08:45 PDT 2014
Is this the best way to start Oracle?
[root at localhost system]# cat oracle-foo.service
[Unit]
Description=oracle db - foo
After=syslog.target
[Service]
Environment=ORACLE_SID=foo ORACLE_HOME=/home/oracle/Ora12c/db
ExecStart=/bin/ksh -c 'print "connect / as sysdba \n startup \n quit" | $ORACLE_HOME/bin/sqlplus -silent /nolog'
ExecStop=/bin/ksh -c 'print "connect / as sysdba \n shutdown immediate \n quit" | $ORACLE_HOME/bin/sqlplus -silent /nolog'
Type=forking
User=oracle
Group=dba
[Install]
WantedBy=multi-user.target
#This file should be placed in /etc/systemd/system
#enable for start at boot by: systemctl enable oracle_db-foo.service
I used to do it with an init.d script that grabbed the SID out of argv[0] with ORACLE_SID=${0##*-} - I'm assuming that a systemd service file can't grab anything similarly out of argv[0], and I can't hard-link them all together.
I may have several instances on a machine; I'd like one service to start/stop everything if possible (maybe with dbstart/dbshut), but I also want granular control over each Oracle instance.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.freedesktop.org/archives/systemd-devel/attachments/20141028/d1bcc92b/attachment.html>
More information about the systemd-devel
mailing list