On Tue, 28.10.14 15:08, Fisher, Charles J. (Top Echelon) (charles.fis...@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). -bash-4.2$ ps -ef | grep oracle root 1742 1 0 11:21 ? 00:00:00 login -- oracle oracle 1750 1742 0 11:21 tty2 00:00:00 -bash root 2285 1190 0 11:34 ? 00:00:00 sshd: oracle [priv] oracle 2301 2285 0 11:35 ? 00:00:00 sshd: oracle@pts/0 oracle 2302 2301 0 11:35 pts/0 00:00:00 -bash oracle 3379 2302 0 12:13 pts/0 00:00:00 ps -ef oracle 3380 2302 0 12:13 pts/0 00:00:00 grep --color=auto oracle -bash-4.2$ $ORACLE_HOME/bin/sqlplus /nolog SQL*Plus: Release 12.1.0.2.0 Production on Thu Oct 30 12:19:27 2014 Copyright (c) 1982, 2014, Oracle. All rights reserved. SQL> connect / as sysdba Connected to an idle instance. SQL> !ps -ef | grep oracle root 1742 1 0 11:21 ? 00:00:00 login -- oracle oracle 1750 1742 0 11:21 tty2 00:00:00 -bash root 2285 1190 0 11:34 ? 00:00:00 sshd: oracle [priv] oracle 2301 2285 0 11:35 ? 00:00:00 sshd: oracle@pts/0 oracle 2302 2301 0 11:35 pts/0 00:00:00 -bash oracle 3431 2302 0 12:19 pts/0 00:00:00 /home/oracle/Ora12c/db/bin/sqlplus oracle 3432 3431 0 12:19 ? 00:00:00 oracleorcl (DESCRIPTION=(LOCAL=YES)(ADDRESS=(PROTOCOL=beq))) oracle 3433 3431 0 12:19 pts/0 00:00:00 /bin/bash -c ps -ef | grep oracle oracle 3434 3433 0 12:19 pts/0 00:00:00 ps -ef oracle 3435 3433 0 12:19 pts/0 00:00:00 grep oracle SQL> startup ORACLE instance started. Total System Global Area 834666496 bytes Fixed Size 2929888 bytes Variable Size 603982624 bytes Database Buffers 222298112 bytes Redo Buffers 5455872 bytes Database mounted. Database opened. SQL> quit Disconnected from Oracle Database 12c Enterprise Edition Release 12.1.0.2.0 - 64bit Production With the Partitioning, OLAP, Advanced Analytics and Real Application Testing options ***the ora_ processes below are all actually the $ORACLE_HOME/bin/oracle binary -bash-4.2$ ps -ef | grep oracle root 1742 1 0 11:21 ? 00:00:00 login -- oracle oracle 1750 1742 0 11:21 tty2 00:00:00 -bash root 2285 1190 0 11:34 ? 00:00:00 sshd: oracle [priv] oracle 2301 2285 0 11:35 ? 00:00:00 sshd: oracle@pts/0 oracle 2302 2301 0 11:35 pts/0 00:00:00 -bash oracle 3439 1 0 12:19 ? 00:00:00 ora_pmon_orcl oracle 3441 1 0 12:19 ? 00:00:00 ora_psp0_orcl oracle 3443 1 1 12:19 ? 00:00:00 ora_vktm_orcl oracle 3447 1 0 12:19 ? 00:00:00 ora_gen0_orcl oracle 3449 1 0 12:19 ? 00:00:00 ora_mman_orcl oracle 3453 1 0 12:19 ? 00:00:00 ora_diag_orcl oracle 3455 1 0 12:19 ? 00:00:00 ora_dbrm_orcl oracle 3457 1 0 12:19 ? 00:00:00 ora_vkrm_orcl oracle 3459 1 0 12:19 ? 00:00:00 ora_dia0_orcl oracle 3461 1 0 12:19 ? 00:00:00 ora_dbw0_orcl oracle 3463 1 0 12:19 ? 00:00:00 ora_lgwr_orcl oracle 3465 1 0 12:19 ? 00:00:00 ora_ckpt_orcl oracle 3467 1 0 12:19 ? 00:00:00 ora_lg00_orcl oracle 3469 1 0 12:19 ? 00:00:00 ora_smon_orcl oracle 3471 1 0 12:19 ? 00:00:00 ora_lg01_orcl oracle 3473 1 0 12:19 ? 00:00:00 ora_reco_orcl oracle 3475 1 0 12:19 ? 00:00:00 ora_lreg_orcl oracle 3477 1 0 12:19 ? 00:00:00 ora_pxmn_orcl oracle 3479 1 9 12:19 ? 00:00:03 ora_mmon_orcl oracle 3481 1 0 12:19 ? 00:00:00 ora_mmnl_orcl oracle 3483 1 0 12:19 ? 00:00:00 ora_d000_orcl oracle 3485 1 0 12:19 ? 00:00:00 ora_s000_orcl oracle 3505 1 0 12:19 ? 00:00:00 ora_tmon_orcl oracle 3507 1 0 12:20 ? 00:00:00 ora_tt00_orcl oracle 3513 1 0 12:20 ? 00:00:00 ora_smco_orcl oracle 3515 1 0 12:20 ? 00:00:00 ora_w000_orcl oracle 3517 1 0 12:20 ? 00:00:00 ora_w001_orcl oracle 3519 1 0 12:20 ? 00:00:00 ora_aqpc_orcl oracle 3523 1 0 12:20 ? 00:00:00 ora_p000_orcl oracle 3525 1 0 12:20 ? 00:00:00 ora_p001_orcl oracle 3527 1 0 12:20 ? 00:00:00 ora_p002_orcl oracle 3529 1 0 12:20 ? 00:00:00 ora_p003_orcl oracle 3531 1 0 12:20 ? 00:00:00 ora_p004_orcl oracle 3533 1 0 12:20 ? 00:00:00 ora_p005_orcl oracle 3535 1 0 12:20 ? 00:00:00 ora_p006_orcl oracle 3537 1 0 12:20 ? 00:00:00 ora_p007_orcl oracle 3539 1 2 12:20 ? 00:00:00 ora_cjq0_orcl oracle 3541 1 1 12:20 ? 00:00:00 ora_j000_orcl oracle 3543 1 1 12:20 ? 00:00:00 ora_j001_orcl oracle 3545 1 0 12:20 ? 00:00:00 ora_j002_orcl oracle 3644 1 0 12:20 ? 00:00:00 ora_qm02_orcl oracle 3646 1 0 12:20 ? 00:00:00 ora_qm03_orcl oracle 3648 1 0 12:20 ? 00:00:00 ora_q002_orcl oracle 3650 1 0 12:20 ? 00:00:00 ora_q003_orcl oracle 3690 2302 0 12:20 pts/0 00:00:00 ps -ef oracle 3691 2302 0 12:20 pts/0 00:00:00 grep --color=auto oracle > If you have multiple instances, use systemd's unit instance concept: > http://0pointer.de/blog/projects/instances.html > As I don't really know Oracle I cannot really tell you how to start it > best, but I hope the hints above are useful. I will pay special attention. *** listener child - vulnerable below [root@localhost system]# psc | grep lsnr 8619 oracle 1:name=systemd:/system.slic /home/oracle/Ora12c/db/bin/tnslsnr LISTENER -inherit [root@localhost system]# ps xawf -eo args,cgroup | tail ... ora_q002_orcl 1:name=systemd:/system.slice/oracle-orcl.service ora_q003_orcl 1:name=systemd:/system.slice/oracle-orcl.service oracleorcl (LOCAL=NO) 1:name=systemd:/system.slice/oracle-listener.service ora_j000_orcl 1:name=systemd:/system.slice/oracle-orcl.service ora_j001_orcl 1:name=systemd:/system.slice/oracle-orcl.service _______________________________________________ systemd-devel mailing list systemd-devel@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/systemd-devel