[systemd-devel] starting Oracle with systemd

Andrei Borzenkov arvidjaar at gmail.com
Tue Oct 28 20:51:59 PDT 2014


В Tue, 28 Oct 2014 15:08:45 -0400
"Fisher, Charles J. (Top Echelon)" <Charles.Fisher at alcoa.com> пишет:

> 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.
> 

You can create template unit and simply start every instance as
oracle at foo.service (you do not even need to symlink it - it will be
instantiated on the fly).

> 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.
> 
> 


More information about the systemd-devel mailing list