Gen 8.6 Linux CSE automatic Oracle DB and iefmd startup
search cancel

Gen 8.6 Linux CSE automatic Oracle DB and iefmd startup

book

Article ID: 268252

calendar_today

Updated On:

Products

Gen - Host Encyclopedia Gen - Run Time Distributed Gen - Workstation Toolset Gen

Issue/Introduction

The purpose of this article is to document how to enable automatic startup of the Oracle DB and Gen 8.6 Client Server Encyclopedia (CSE) iefmd on Linux at system restart.
This document will cover creating the required Linux systemd services to enable that.
NOTE: These services have only been developed & tested by Gen L1 Support and therefore are not officially supported, so should be used at the user's own risk.

Environment

Red Hat Enterprise Linux release 8.7 with no GUI interface i.e. no "graphical.target".

Oracle 19c is installed in the directory /opt/oracle/product/19c/dbhome_1 which is the ORACLE_HOME.

Oracle database used is named DBCSE which is the ORACLE_SID.

The Oracle user is oracle whose main group is oinstall but also belongs to other groups like dba.

The CSE is installed in directory /opt/Gen/CSE for user gen86 who is in group users.

Resolution

Configuration

1. Enable automatic start flag for Oracle DB.
Edit/create file /etc/oratab and add 1 line:
=====
DBCSE:/opt/oracle/product/19c/dbhome_1:Y
=====

2. Create Oracle DB service named oracledb.
a. Create file /usr/lib/systemd/system/oracledb.service as follows:
=====
[Unit]
Description=The Oracle Database Service
After=syslog.target network.target local-fs.target remote-fs.target

[Service]
Type=forking
EnvironmentFile=/etc/sysconfig/oracledb
ExecStart=/opt/oracle/product/19c/dbhome_1/bin/dbstart /opt/oracle/product/19c/dbhome_1
ExecStop=/opt/oracle/product/19c/dbhome_1/bin/dbshut /opt/oracle/product/19c/dbhome_1
RemainAfterExit=yes
User=oracle
Group=oinstall
Restart=no

[Install]
WantedBy=multi-user.target
=====
(The Oracle TNS listener should also be automatically started by dbstart, although not actually necessary for the CSE iefmd connection to a local Oracle DB).

b. Create environment file /etc/sysconfig/oracledb used in above. *** NOTE: Ensure ORACLE_HOME has no trailing / ***
=====
ORACLE_HOME=/opt/oracle/product/19c/dbhome_1
ORACLE_SID=DBCSE
=====

3. Create CSE iefmd service named iefmd.
a. Create file /usr/lib/systemd/system/iefmd.service as follows:
=====
[Unit]
Description=The CSE iefmd Service
After=syslog.target network.target local-fs.target remote-fs.target oracledb.service
Requires=oracledb.service

[Service]
Type=forking
EnvironmentFile=/etc/sysconfig/iefmd
ExecStart=/opt/Gen/CSE/cse/cfg/startmd.sh
ExecStop=/opt/Gen/CSE/cse/bin/stopmd
RemainAfterExit=yes
User=gen86
Group=users
Restart=no

[Install]
WantedBy=multi-user.target
=====
NOTE: The After and Requires dependencies on the oracledb service to ensure that the Oracle DB is started before the iefmd starts.

b. Create environment file /etc/sysconfig/iefmd used in the above with required CSE environment variables:
=====
IEFCSGEN=/opt/Gen/CSE/cse/bin
IEFGXTP=/opt/Gen/CSE/cse/translat/
IEF_CONFIGDIR=/opt/Gen/CSE/cse/cfg
IEF_DIRGROUP=DIR
IEF_ENCYGROUP=ENCY
IEF_MDNAME=server_hostname/2500
IEF_RDSNODE=server_hostname/2501
IEF_WORKINGDIR=/opt/Gen/CSE/cse/logs
LD_LIBRARY_PATH=/opt/Gen/CSE/cse/bin:/opt/oracle/product/19c/dbhome_1/lib:/opt/CA/SharedComponents/lib
ORACLE_HOME=/opt/oracle/product/19c/dbhome_1
ORACLE_SID=DBCSE
NLS_LANG=AMERICAN_AMERICA.AL32UTF8
=====

c. Create script /opt/Gen/CSE/cse/cfg/startmd.sh to start the iefmd. It contains the lines:
=====
#!/bin/bash
# Check iefmd is not already running.
if pgrep -x "iefmd" > /dev/null
then
  echo $(date +"%b%d-%Y-%H%M%S") > /opt/Gen/CSE/cse/cfg/startmd.err
  echo "The CSE iefmd is already running" >> /opt/Gen/CSE/cse/cfg/startmd.err
  exit
else
  # Assuming it already exists backup the directory IEF_WORKINGDIR to keep a backup copy of log files and recreate it.
  if [ -d "$IEF_WORKINGDIR" ]; then
    mv $IEF_WORKINGDIR "$IEF_WORKINGDIR"_$(date +"%b%d-%Y-%H%M%S")
  fi
  mkdir $IEF_WORKINGDIR
  # Also need to cd to the IEF_WORKINGDIR directory to ensure each user directory (e.g. ENCYADMN) is created there.
  # Otherwise whatever is the current directory when iefmd is executed will end up being where the user directory is created.
  cd $IEF_WORKINGDIR
  $IEFCSGEN/iefmd /mdini=$IEF_CONFIGDIR/iefmd.ini /mderr=$IEF_WORKINGDIR/iefmd.log &
fi
=====


4. Update Linux to enable both services.
systemctl enable oracledb.service
Created symlink /etc/systemd/system/multi-user.target.wants/oracledb.service → /usr/lib/systemd/system/oracledb.service.
systemctl enable iefmd.service
Created symlink /etc/systemd/system/multi-user.target.wants/iefmd.service → /usr/lib/systemd/system/iefmd.service.

 

Testing 

1.     Test starting services manually:
systemctl start oracledb
systemctl start iefmd
The way the iefmd.service is configured with the Requires means that just starting it will ensure the oracledb service is started if not already started.
Verify expected processes are running:
ps –fuoracle

UID          PID    PPID  C STIME TTY          TIME CMD

oracle      1219       1  0 04:43 ?        00:00:00 /opt/oracle/product/19c/dbhome_1/bin/tnslsnr LISTENER -inherit

oracle      2236       1  0 04:43 ?        00:00:00 ora_pmon_DBCSE

oracle      2238       1  0 04:43 ?        00:00:00 ora_clmn_DBCSE

oracle      2240       1  0 04:43 ?        00:00:00 ora_psp0_DBCSE

oracle      2352       1  0 04:43 ?        00:00:00 ora_vktm_DBCSE

oracle      2365       1  0 04:43 ?        00:00:00 ora_gen0_DBCSE

oracle      2368       1  0 04:43 ?        00:00:00 ora_mman_DBCSE

oracle      2372       1  0 04:43 ?        00:00:00 ora_gen1_DBCSE

oracle      2379       1  0 04:43 ?        00:00:00 ora_diag_DBCSE

oracle      2381       1  0 04:43 ?        00:00:00 ora_ofsd_DBCSE

oracle      2384       1  0 04:43 ?        00:00:00 ora_dbrm_DBCSE

oracle      2386       1  0 04:43 ?        00:00:00 ora_vkrm_DBCSE

oracle      2389       1  0 04:43 ?        00:00:00 ora_svcb_DBCSE

oracle      2391       1  0 04:43 ?        00:00:00 ora_pman_DBCSE

oracle      2393       1  0 04:43 ?        00:00:00 ora_dia0_DBCSE

oracle      2396       1  0 04:43 ?        00:00:00 ora_dbw0_DBCSE

oracle      2398       1  0 04:43 ?        00:00:00 ora_lgwr_DBCSE

oracle      2400       1  0 04:43 ?        00:00:00 ora_ckpt_DBCSE

oracle      2402       1  0 04:43 ?        00:00:00 ora_lg00_DBCSE

oracle      2407       1  0 04:43 ?        00:00:00 ora_smon_DBCSE

oracle      2416       1  0 04:43 ?        00:00:00 ora_lg01_DBCSE

oracle      2419       1  0 04:43 ?        00:00:00 ora_smco_DBCSE

oracle      2421       1  0 04:43 ?        00:00:00 ora_reco_DBCSE

oracle      2424       1  0 04:43 ?        00:00:00 ora_w000_DBCSE

oracle      2428       1  0 04:43 ?        00:00:00 ora_lreg_DBCSE

oracle      2430       1  0 04:43 ?        00:00:00 ora_w001_DBCSE

oracle      2432       1  0 04:43 ?        00:00:00 ora_pxmn_DBCSE

oracle      2436       1  1 04:43 ?        00:00:01 ora_mmon_DBCSE

oracle      2438       1  0 04:43 ?        00:00:00 ora_mmnl_DBCSE

oracle      2440       1  0 04:43 ?        00:00:00 ora_d000_DBCSE

oracle      2442       1  0 04:43 ?        00:00:00 ora_s000_DBCSE

oracle      2444       1  0 04:43 ?        00:00:00 ora_tmon_DBCSE

oracle      2456       1  0 04:43 ?        00:00:00 ora_m000_DBCSE

oracle      2479       1  0 04:43 ?        00:00:00 ora_tt00_DBCSE

oracle      2481       1  0 04:43 ?        00:00:00 ora_tt01_DBCSE

oracle      2483       1  0 04:43 ?        00:00:00 ora_tt02_DBCSE

oracle      2497       1  0 04:43 ?        00:00:00 ora_w002_DBCSE

oracle      2499       1  0 04:43 ?        00:00:00 ora_aqpc_DBCSE

oracle      2501       1  0 04:43 ?        00:00:00 ora_qm02_DBCSE

oracle      2503       1  0 04:43 ?        00:00:00 ora_qm03_DBCSE

oracle      2505       1  0 04:43 ?        00:00:00 ora_q002_DBCSE

oracle      2507       1  0 04:43 ?        00:00:00 ora_q003_DBCSE

oracle      2509       1  0 04:43 ?        00:00:00 ora_q004_DBCSE

oracle      2511       1  0 04:43 ?        00:00:00 ora_q005_DBCSE

oracle      2513       1  0 04:43 ?        00:00:00 ora_q006_DBCSE

oracle      2515       1  0 04:43 ?        00:00:00 ora_q007_DBCSE

oracle      2517       1  0 04:43 ?        00:00:00 ora_q008_DBCSE

oracle      2519       1  0 04:43 ?        00:00:00 ora_q009_DBCSE

oracle      2521       1  0 04:43 ?        00:00:00 ora_q00a_DBCSE

oracle      2523       1  0 04:43 ?        00:00:00 ora_q00b_DBCSE

oracle      2525       1  0 04:43 ?        00:00:00 ora_q00c_DBCSE

oracle      2527       1  0 04:43 ?        00:00:00 ora_q00d_DBCSE

oracle      2532       1  0 04:43 ?        00:00:00 ora_p000_DBCSE

oracle      2534       1  0 04:43 ?        00:00:00 ora_p001_DBCSE

oracle      2536       1  0 04:43 ?        00:00:00 ora_p002_DBCSE

oracle      2538       1  0 04:43 ?        00:00:00 ora_p003_DBCSE

oracle      2540       1  0 04:43 ?        00:00:00 ora_p004_DBCSE

oracle      2542       1  0 04:43 ?        00:00:00 ora_p005_DBCSE

oracle      2544       1  0 04:43 ?        00:00:00 ora_p006_DBCSE

oracle      2546       1  0 04:43 ?        00:00:00 ora_p007_DBCSE

oracle      2548       1  0 04:43 ?        00:00:00 ora_w003_DBCSE

oracle      2557       1  0 04:43 ?        00:00:00 ora_cjq0_DBCSE

oracle      2799       1  0 04:43 ?        00:00:00 oracleDBCSE (DESCRIPTION=(LOCAL=YES)(ADDRESS=(PROTOCOL=beq)))

oracle      2807       1  0 04:43 ?        00:00:00 oracleDBCSE (DESCRIPTION=(LOCAL=YES)(ADDRESS=(PROTOCOL=beq)))

oracle      2811       1  0 04:43 ?        00:00:00 ora_w004_DBCSE

oracle      2817       1  0 04:43 ?        00:00:00 oracleDBCSE (DESCRIPTION=(LOCAL=YES)(ADDRESS=(PROTOCOL=beq)))

oracle      2823       1  0 04:43 ?        00:00:00 oracleDBCSE (DESCRIPTION=(LOCAL=YES)(ADDRESS=(PROTOCOL=beq)))

oracle      2831       1  0 04:43 ?        00:00:00 oracleDBCSE (DESCRIPTION=(LOCAL=YES)(ADDRESS=(PROTOCOL=beq)))

oracle      2837       1  0 04:43 ?        00:00:00 oracleDBCSE (DESCRIPTION=(LOCAL=YES)(ADDRESS=(PROTOCOL=beq)))

oracle      2980       1  0 04:44 ?        00:00:00 ora_m001_DBCSE

oracle      2982       1  0 04:44 ?        00:00:00 ora_m002_DBCSE

oracle      2984       1  0 04:44 ?        00:00:00 ora_m003_DBCSE

oracle      3008       1  0 04:44 ?        00:00:00 ora_m004_DBCSE

oracle      3010       1  0 04:44 ?        00:00:00 ora_q00e_DBCSE

oracle      3012       1  0 04:44 ?        00:00:00 ora_q00f_DBCSE

oracle      3014       1  0 04:44 ?        00:00:00 ora_q00g_DBCSE

oracle      3016       1  0 04:44 ?        00:00:00 ora_q00h_DBCSE

oracle      3018       1  0 04:44 ?        00:00:00 ora_q00i_DBCSE

oracle      3020       1  0 04:44 ?        00:00:00 ora_q00j_DBCSE

oracle      3022       1  0 04:44 ?        00:00:00 ora_q00k_DBCSE

oracle      3024       1  0 04:44 ?        00:00:00 ora_q00l_DBCSE

oracle      3026       1  0 04:44 ?        00:00:00 ora_q00m_DBCSE


ps –fugen86

UID          PID    PPID  C STIME TTY          TIME CMD

gen86       2691       1  0 02:55 ?        00:00:00 /opt/Gen/CSE/cse/bin/iefmd

gen86       2702    2691  0 02:55 ?        00:00:00 /opt/Gen/CSE/cse/bin/srvcoord

gen86       2796    2691  0 02:55 ?        00:00:00 /opt/Gen/CSE/cse/bin/srvid

gen86       2802    2691  0 02:55 ?        00:00:00 /opt/Gen/CSE/cse/bin/srvlock

gen86       2804    2691  0 02:55 ?        00:00:00 /opt/Gen/CSE/cse/bin/srvuga

gen86       2811    2691  0 02:55 ?        00:00:00 /opt/Gen/CSE/cse/bin/srvms

gen86       2817    2691  0 02:55 ?        00:00:00 /opt/Gen/CSE/cse/bin/srvcons

gen86       2823    2691  0 02:55 ?        00:00:00 /opt/Gen/CSE/cse/bin/srvvc

 

2. Restart server to check automatic starting of services is successful.

Additional Information

Related knowledge hub article: Gen 8.6 Linux CSE knowledge hub