We're here to help!

Auto start/stop using systemd for standby v8

Follow

Read our docs When using RHEL 7 or OEL 7 you may want to enable the use of systemd to automatically start or stop Dbvnet and Dbvserver on system restart.  

Problem Details

Problem Statement

Enable Dbvnet and Dbvserver auto start/stop using systemd for standby v8

Applicable Error Code

N/A

Affected Versions

Standby Version 8.0

Affected Platforms

RHEL 7 or OEL 7

 

Description

When using RHEL 7 or OEL 7 you may want to enable the use of systemd to automatically start or stop Dbvnet and Dbvserver on system restart.  

This document will provide you with the sample configuration files and commands which you can use to enable this.

The assumption of this document is that you are familiar with systemd.

Solution

Dbvnet:

Create a file in /usr/lib/systemd/system called dbvnet.service

Copy the text below to the dbvnet.service file.  You might need to adjust the path where Dbvisit Standby is installed - in the example below /usr/dbvisit is the DBVISIT_BASE location:

 

# /usr/lib/systemd/system/dbvnet.service
#
# Dbvisit Standby - Dbvnet systemd unit file:
# description: Dbvisit network infrastructure daemon. 

[Unit]
Description=Dbvisit Standby - Dbvnet
After=syslog.target network.target

[Service]
Type=simple
RemainAfterExit=yes
User=oracle
Group=oinstall
ExecStart=/usr/dbvisit/dbvnet/dbvnet -d start
ExecStop=/usr/dbvisit/dbvnet/dbvnet -d stop

[Install]
WantedBy=multi-user.target

To enable the service: 

# ln -s /lib/systemd/system/dbvnet.service /etc/systemd/system/dbvnet.service
# systemctl daemon-reload
# systemctl enable dbvnet.service

Then to start and stop you can use:

# systemctl start dbvnet.service
# systemctl stop dbvnet.service

Dbvagent:

Create a file in /usr/lib/systemd/system called dbvagent.service

Copy the text below to the dbvagent.service file.  You might need to adjust the path where Dbvisit Standby is installed - in the example below /usr/dbvisit is the DBVISIT_BASE location: 


# /usr/lib/systemd/system/dbvagent.service # # Dbvisit Standby - Dbvagent systemd unit file: # description: Dbvisit agent daemon. # [Unit] Description=Dbvisit Standby - Dbvagent After=syslog.target network.target [Service] Type=simple RemainAfterExit=yes User=oracle Group=oinstall ExecStart=/usr/dbvisit/dbvagent/dbvagent -d start ExecStop=/usr/dbvisit/dbvagent/dbvagent -d stop [Install] WantedBy=multi-user.target


To enable the service:

# ln -s /lib/systemd/system/dbvagent.service /etc/systemd/system/dbvagent.service
# systemctl daemon-reload
# systemctl enable dbvagent.service

Then to start and stop you can use:

# systemctl start dbvagent.service
# systemctl stop dbvagent.service

 

Dbvctl database start/stop:

Create a file in /usr/lib/systemd/system called dbvctl-<ddc_name>.service

Copy the text below to the dbvctl-<ddc_name>.service file. Be aware you need to set a correct name of DDC file (DBVTWO). It's an example only your one will be different. You might need to adjust the path where Dbvisit Standby is installed - in the example below /usr/dbvisit is the DBVISIT_BASE location: 


#
# Dbvisit Standby - Dbvctl database start/stop systemd unit file:
# description: Dbvisit database start/stop daemon
#

[Unit]
Description=Dbvisit Standby - Dbvctl database service
After=syslog.target network.target



[Service]
Type=simple
RemainAfterExit=yes
User=oracle
Group=oinstall
ExecStart=/usr/dbvisit/standby/dbvctl -d DBVTWO -o start
ExecStop=/usr/dbvisit/standby/dbvctl -d DBVTWO -o stop

[Install]
WantedBy=multi-user.target


To enable the service:

# ln -s /lib/systemd/system/dbvctl.service /etc/systemd/system/dbvctl.service
# systemctl daemon-reload
# systemctl enable dbvctl-dbvtwo.service

Then to start and stop you can use:

# systemctl start dbvctl-dbvtwo.service
# systemctl stop dbvctl-dbvtwo.service

 

Dbvctl DDC daemon (optional):

It will start dbvctl DDC daemon. The database instance must be already started so there is a dependency on dbvctl-dbvtwo.service.

Create a file in /usr/lib/systemd/system called dbvctl-<ddc_name>-daemon.service

Copy the text below to the dbvctl-<ddc_name>-daemon.service file. Be aware you need to set a correct name of DDC file (DBVTWO). It's an example only your one will be different. You might need to adjust the path where Dbvisit Standby is installed - in the example below /usr/dbvisit is the DBVISIT_BASE location: 


# /usr/lib/systemd/system/dbvctl-dbvtwo-daemon.service
#
# Dbvisit Standby - Dbvctl DDC daemon start/stop systemd unit file:
# description: Dbvisit DDC daemon start/stop daemon
#

[Unit]
Description=Dbvisit Standby - Dbvctl DDC daemon service
After=dbvctl-dbvtwo.service



[Service]
Type=simple
RemainAfterExit=yes
User=oracle
Group=oinstall
ExecStart=/usr/dbvisit/standby/dbvctl -d DBVTWO -D start
ExecStop=/usr/dbvisit/standby/dbvctl -d DBVTWO -D stop

[Install]
WantedBy=multi-user.target

To enable the service:

# ln -s /lib/systemd/system/dbvctl.service /etc/systemd/system/dbvctl.service
# systemctl daemon-reload
# systemctl enable dbvctl-dbvtwo-deamon.service

Then to start and stop you can use:

# systemctl start dbvctl-dbvtwo-daemon.service
# systemctl stop dbvctl-dbvtwo-daemon.service

 

 

Dbvserver:

Create a file in /usr/lib/systemd/system called dbvserver.service

Copy the text below to the dbvserver.service file.  You might need to adjust the path where Dbvisit Standby is installed - in the example below /usr/dbvisit is the DBVISIT_BASE location: 


# /usr/lib/systemd/system/dbvserver.service # # Dbvisit Standby - Dbvserver systemd unit file: # description: Dbvisit webserver daemon. # [Unit] Description=Dbvisit Standby - Dbvserver After=syslog.target network.target [Service] Type=simple RemainAfterExit=yes User=oracle Group=oinstall ExecStart=/usr/dbvisit/dbvserver/dbvserver -d start ExecStop=/usr/dbvisit/dbvserver/dbvserver -d stop [Install] WantedBy=multi-user.target

To enable the service:

# ln -s /lib/systemd/system/dbvserver.service /etc/systemd/system/dbvserver.service
# systemctl daemon-reload
# systemctl enable dbvserver.service

Then to start and stop you can use:

# systemctl start dbvserver.service
# systemctl stop dbvserver.service

 

It also possible to start Oracle listener as systemd service. You have to set the right ORACLE_HOME and listener name. Copy the text below to the dbvlistener.service file

 
# /usr/lib/systemd/system/dbvlistener.service
#
# Dbvisit Standby - Dbvlistener systemd unit file:
# description: Dbvisit listener daemon.
#

[Unit]
Description=Dbvisit Standby - Dbvlistener
After=syslog.target network.target


[Service]
Type=simple
RemainAfterExit=yes
User=oracle
Group=oinstall
Environment="ORACLE_HOME=/u01/app/oracle/product/12.1.0.2/dbhome_1"
ExecStart=/u01/app/oracle/product/12.1.0.2/dbhome_1/bin/lsnrctl start
ExecStop=/u01/app/oracle/product/12.1.0.2/dbhome_1/bin/lsnrctl stop

[Install]
WantedBy=multi-user.target

To enable the service:

# ln -s /lib/systemd/system/dbvserver.service /etc/systemd/system/dbvserver.service
# systemctl daemon-reload
# systemctl enable dbvlistener.service

Then to start and stop you can use:

# systemctl start dbvlistener.service
# systemctl stop dbvlistener.service

 

It is recommended that you test these steps in your development or test environment prior to implementing in production as some adjustments might be required to meet your environment.

 

 

Have more questions? Submit a request

Comments