Program
BIOVIA Direct
Operating System
Red Hat Enterprise Linux (RHEL) & Oracle Linux, versions 7 & 8
Background
As of version 2017, BIOVIA Direct requires a separate Oracle listener to start the External Procedure Agent that loads the Direct library and provides its functionality to Oracle. Due to the nature of the Direct listener, it is not started automatically along with the Oracle database. On the Windows platform Oracle listeners run as Windows services which can be easily configured to start automatically. On the Linux platform, there is no standard procedure to start these Direct listeners.
The Oracle documentation suggests a procedure and example script 'dbora' to start or stop Oracle databases at system start or shutdown, respectively. That example script 'dbora' can be easily extended with a line to start or stop the Direct listener(s). The procedure and the dbora script provided by Oracle still work in RHEL and Oracle Linux versions 7 and 8, however, they are based on concepts of the old SysVinit init-system which was replaced with the systemd init-system in these current RHEL and Oracle Linux versions.
This post describes the general steps to implement a systemd unit that handles the start and stop of a BIOVIA Direct Oracle listener, including a restart if it crashes. Please note that the unit file is very basic, so you might need to make adjustments to it according to your company policies or best practices.
Solution
This example implementation assumes the following environment:
- The Oracle server is running RHEL or Oracle Linux versions 7 or 8, as supported by Direct 2022.
- Oracle 19c is installed into /opt/oracle/product/19c (\$ORACLE_HOME)
- BIOVIA Direct 2022 is installed and up and running according to the BIOVIA Direct 2022 Installation Guide for Linux. Accordingly, the Direct listener name is DIRECT2022. The BIOVIA Direct installation directory is /opt/BIOVIA/direct2022.
- The BIOVIA Direct files are owned by the operating system user 'biovia' with the primary group 'biovia'.
- The BIOVIA Direct listener is configured as a 'secure listener' as recommended by BIOVIA. Accordingly, it runs from the same 'biovia' user rather than the standard 'oracle' user that runs the database and other listeners. The separate listener.ora file that defines the Direct 2022 listener is located in the directory set by the TNS_ADMIN variable in the unit. See the BIOVIA Direct 2022 Installation Guide for Linux and this post for more details on the secure listener setup.
Steps
1) Login to Linux as biovia, i.e. the account that runs the secure DIRECT2022 listener. Make sure that the listener is not running, or shut it down if it is running.
[biovia@myserver ~]\$ lsnrctl status DIRECT2022 [biovia@myserver ~]\$ lsnrctl stop DIRECT2022
2) Login to Linux as root, or as an account with sudo permissions.
3) Navigate to /etc/systemd/system. Create an new file like 'oracle-listener-DIRECT2022.service', and open it in an editor.
4) Add the following lines to the file.
[Unit] Description=This service unit handles the start & stop of the BIOVIA Direct 2022 extproc listener After=syslog.target network.target # unit restart parameters for systemd versions 230 and higher only (RHEL & Oracle Linux 8) # StartLimitIntervalSec=20 # StartLimitBurst=5 [Service] Type=forking User=biovia Group=biovia # unit restart parameters for systemd versions 229 and older (RHEL & Oracle Linux 7). These should work as well with systemd versions 230 and higher. StartLimitInterval=20 StartLimitBurst=5 # this 'Restart' option tells systemd to restarts the listener when its original process died. Consequently, it will also restart it if it is shutdown intentionally from the BIOVIA account, e.g. for editing. You therefore might want to change this option to on-abnormal which however might not recognize all crashes then. Restart=on-failure RestartSec=3 Environment=ORACLE_HOME=/opt/oracle/product/19c Environment=ORACLE_BASE=/opt/oracle/base Environment=ORACLE_SID=BIOVIA Environment=TNS_ADMIN=/home/biovia/BIOVIA/direct_secure_listener/configuration ExecStart=/bin/bash -c '/opt/oracle/product/19c/bin/lsnrctl start DIRECT2022' ExecStop=/bin/bash -c '/opt/oracle/product/19c/bin/lsnrctl stop DIRECT2022' [Install] WantedBy=multi-user.target
Save the file.
5) Reload the unit configuration files so that the new unit file 'oracle-listener-DIRECT2022.service' is recognized.
[root@myserver ~]\$ systemctl daemon-reload
6) Start the unit.
[root@myserver ~]\$ systemctl start oracle-listener-DIRECT2022.service
7) Check that the unit has started correctly.
[root@myserver ~]\$ systemctl status oracle-listener-DIRECT2022.service [root@myserver ~]\$ journalctl -xe
8) Stop the unit.
[root@myserver ~]\$ systemctl stop oracle-listener-DIRECT2022.service
9) Check that the unit has stopped correctly.
[root@myserver ~]\$ systemctl status oracle-listener-DIRECT2022.service [root@myserver ~]\$ journalctl -xe
10) Enable the unit so that it is executed at system startup.
[root@myserver ~]\$ systemctl enable oracle-listener-DIRECT2022.service