[systemd-devel] starting Oracle with systemd

Andrei Borzenkov arvidjaar at gmail.com
Thu Oct 30 10:40:11 PDT 2014


В Thu, 30 Oct 2014 13:29:10 -0400
"Fisher, Charles J. (Top Echelon)" <Charles.Fisher at alcoa.com> пишет:

> 
> On Tue, 28.10.14 15:08, Fisher, Charles J. (Top Echelon) (Charles.Fisher at alcoa.com) wrote:
> 
> >> Is this the best way to start Oracle?
> >> [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'
> 
> >This looks quite suspicious as you spawn a shell and keep it
> >running. It's fine to run shells and then finally exec the real
> >binary, replacing the shell process, but keeping the shell around
> >would tell systemd that the shell was the actual daemon process.
> 
> It doesn't work like that. The ksh dies when sqlplus exits, after it forks the instance background processes.
> 
> These are the binaries of interest:
> 
> -bash-4.2$ ls -l $ORACLE_HOME/bin/sqlplus $ORACLE_HOME/bin/oracle $ORACLE_HOME/bin/tnslsnr
> -rwsr-s--x. 1 oracle dba 323649834 Aug 13 10:47 /home/oracle/Ora12c/db/bin/oracle
> -rwxr-x--x. 1 oracle dba     10525 Aug 13 10:46 /home/oracle/Ora12c/db/bin/sqlplus
> -rwxr-x--x. 1 oracle dba    866455 Aug 13 10:46 /home/oracle/Ora12c/db/bin/tnslsnr
> 
> The real problem is the tnslsnr. It can service multiple instances. If I run those instances in separate cgroups, and the listener can only be a member of one cgroup, then the listener's children die if the listener process is disturbed. This means all DB sessions are cut when the listener is stopped.
> 
> It looks like systemd will force separate listeners for all Oracle instances, and the usual port number (1521) can't multiplex them (unless a single cgroup is used).
> 

Even in this case behavior is wrong. Currently stopping listener does
not affect existing database connections. Killing all client processes
on listener stop will be rather strong regression.

How ssh does it? It is something similar - master service that need to
spawn multiple independent children.


More information about the systemd-devel mailing list