Skip links

Configure Oracle GoldenGate’s ServiceManager as a Linux Service

rheodata configure servicemanager as a service

After installing Oracle GoldenGate with a manual ServiceManager, you realize that the ServiceManager will not come back up on a reboot. Although this can be annoying, Oracle GoldenGate is doing what it was asked to. Additionally, after the ServiceManager has been configured, there is no way to convert the ServiceManager to daemon process, unless they whole deployment is rebuilt.

I came up with a way to start Oracle GoldenGate’s ServiceManager through using the Linux SystemCTL process. By using systemctl, a manual ServiceManager can be turned into a rebootable service. Let’s look at how this is done.

Shell Script

The first thing that needs to be done is to produce a shell script that will call the startSM.sh script. The startSM.sh script is provide by Oracle to start the ServiceManager, but there are a few environment variables that must be set before it can be ran. By writing a wrapper script to call the startSM.sh script, all that can be done in a single pass.

The contents of the script is as follows:

File 1: startServiceManager.sh

#!/bin/bash
# Copyright (c) 2020 RheoData, LLC and/or its affiliates. All rights reserved.
#
# Since: March 2019
# Author: [email protected]
# Description: Start ServiceManager
#
# DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER.
#

export OGG_HOME=/opt/app/oracle/product/21.3.0/oggcore_21c
export DEPLOYMENT_HOME=/opt/app/oracle/gg_deployments/ServiceManager
export OGG_ETC_HOME=/opt/app/oracle/gg_deployments/ServiceManager/etc
export OGG_VAR_HOME=/opt/app/oracle/gg_deployments/ServiceManager/var

echo "Starting ServiceManager"

$DEPLOYMENT_HOME/bin/startSM.sh

echo "Done"

By looking at the startServiceManager.sh script, it clearly pointed out that the $OGG_HOME, $DEPLOYMENT_HOME, $OGG_ETC_HOME, and $OGG_VAR_HOME are defined. These are the environment variables that are needed to bring up the ServiceManager.

Service File

The next thing that needs to be configured is the service file. This file is used by systemd process to interact with the service. This file is broken down into three parts – Unit, Service, Install. The Unit section holds the description and other items that describe the service. The Service section is where we define the type, user, group and the shell script that will be executed. In this case, we are calling startServiceManage.sh.

File 2: ServiceManager.service

[Unit]
Description=Oracle GoldenGate 21c ServiceManager Control

[Service]
Type=forking
User=oracle
Group=oinstall
ExecStart=/bin/bash /home/oracle/scripts/startServiceManager.sh

[Install]
WantedBy=multi-user.target

Once this file is create, it needs to be save to /etc/systemd/system directory. This is the default location for all the services that are running on RHEL/OEL.

Create the Service

With the shell script and services file create, now is the time to create the service itself. This process is straight forward.

$sudo su –
$systemctl daemon-reload
$systemctl enable ServiceManager.service

Since this is a new service that is being created, the daemons must be reloaded. This pulls in the ServiceManager.service file to the systemd process. Then the enable call will create a symbolic link between the ServiceManager.service file in /etc/systemd/system/multi-user.target.wants and the same file in /etc/system/system.

After the service is enabled, we can force the ServiceManager down by simply killing the process. Don’t worry any associated deployments services and extract/replicat process will stay running.

With the ServiceManager down, start it back up with the new services; with:

$sudo su –
$systemctl start ServiceManager

Check the Service

If everything is working, the ServiceManager will be brought up and accessible. The status of the ServiceManager can then be checked using the status option of systemctl.

$sudo su – 
$systemctl status ServiceManager
$ systemctl status ServiceManager
● ServiceManager.service - Oracle GoldenGate 21c ServiceManager Control
Loaded: loaded (/etc/systemd/system/ServiceManager.service; enabled; vendor preset: disabled)
Active: active (running) since Tue 2023-01-31 17:21:34 GMT; 3h 15min ago
Main PID: 22414 (ServiceManager)
CGroup: /system.slice/ServiceManager.service
└─22414 /opt/app/oracle/product/21.3.0/oggcore_21c/bin/ServiceManager –quiet

This is how you convert a manual start ServiceManager into a ServiceManager that will be started on reboot.

Leave a comment