2019年10月24日 星期四

Oracle DB - Creating Linux Services for DB auto-start auto-stop Oracle 19c On OEL7


創建 Linux Services - dbora
Create a new service to automatically start/stop an Oracle database. This assumes the Oracle database is not using Oracle Restart and the "start_all.sh" and "stop_all.sh" scripts are already present.

# vi /lib/systemd/system/dbora.service

[Unit]
Description=The Oracle Database Service
After=syslog.target network.target

[Service]
# systemd ignores PAM limits, so set any necessary limits in the service.
# Not really a bug, but a feature.
# https://bugzilla.redhat.com/show_bug.cgi?id=754285
LimitMEMLOCK=infinity
LimitNOFILE=65535

#Type=simple
# idle: similar to simple, the actual execution of the service binary is delayed
#       until all jobs are finished, which avoids mixing the status output with shell output of services.
RemainAfterExit=yes
User=oracle
Group=oinstall
Restart=no
ExecStart=/bin/bash -c '/home/oracle/scripts/start_all.sh'
ExecStop=/bin/bash -c '/home/oracle/scripts/stop_all.sh'

[Install]
WantedBy=multi-user.target


Reload systemd so it can see the new service.
# systemctl daemon-reload


Start the service and enable so it is automatically restarted on reboot.
# systemctl start dbora.service
# systemctl enable dbora.service
# systemctl status dbora.service

參考資訊:
Linux Services (systemd, systemctl)

沒有留言:

張貼留言