oracle linux自启动服务
启用/etc/oratab
# This file is used by ORACLE utilities.  It is created by root.sh
# and updated by either Database Configuration Assistant while creating
# a database or ASM Configuration Assistant while creating ASM instance.
# A colon, ':', is used as the field terminator.  A new line terminates
# the entry.  Lines beginning with a pound sign, '#', are comments.
#
# Entries are of the form:
#   $ORACLE_SID:$ORACLE_HOME:<N|Y>:
#
# The first and second fields are the system identifier and home
# directory of the database respectively.  The third filed indicates
# to the dbstart utility that the database should , "Y", or should not,
# "N", be brought up at system boot time.
#
# Multiple entries with the same $ORACLE_SID are not allowed.
#
#
hist3c:/home/oracle/app/oracle/product/11.2.0/dbhome_1:Y
/etc/systemd/system/oracle-rdbms.service
[Unit]
Description=Oracle Database(s) and Listener
Requires=network.target
[Service]
Type=forking
Restart=no
ExecStart=/home/oracle/app/oracle/product/11.2.0/dbhome_1/bin/dbstart /home/oracle/app/oracle/product/11.2.0/dbhome_1
ExecStop=/home/oracle/app/oracle/product/11.2.0/dbhome_1/bin/dbshut /home/oracle/app/oracle/product/11.2.0/dbhome_1
User=oracle
[Install]
WantedBy=multi-user.target
                              
enable oracle-rdbms.service
[root@FastDFS02:/root]#systemctl enable oracle-rdbms.service 
Created symlink from /etc/systemd/system/multi-user.target.wants/oracle-rdbms.service to /etc/systemd/system/oracle-rdbms.service.
``
### restart oracle-rdbms.service
[root@FastDFS02:/root]#systemctl restart oracle-rdbms.service
### status oracle-rdbms.service
[root@FastDFS02:/root]#systemctl status oracle-rdbms.service
 ● oracle-rdbms.service - Oracle Database(s) and Listener
 Loaded: loaded (/etc/systemd/system/oracle-rdbms.service; enabled; vendor preset: disabled)
 Active: active (running) since Thu 2023-06-15 15:16:17 CST; 14s ago
 Process: 9689 ExecStart=/home/oracle/app/oracle/product/11.2.0/dbhome_1/bin/dbstart /home/oracle/app/oracle/product/11.2.0/dbhome_1 (code=exited, status=0/SUCCESS)
 CGroup: /system.slice/oracle-rdbms.service
 ├─9790 ora_pmon_hist3c
 ├─9792 ora_psp0_hist3c
 ├─9794 ora_vktm_hist3c
 ├─9798 ora_gen0_hist3c
 ├─9800 ora_diag_hist3c
 ├─9802 ora_dbrm_hist3c
 ├─9804 ora_dia0_hist3c
 ├─9806 ora_mman_hist3c
 ├─9808 ora_dbw0_hist3c
 ├─9810 ora_dbw1_hist3c
 ├─9812 ora_dbw2_hist3c
 ├─9814 ora_dbw3_hist3c
 ├─9816 ora_dbw4_hist3c
 ├─9818 ora_dbw5_hist3c
 ├─9820 ora_dbw6_hist3c
 ├─9822 ora_dbw7_hist3c
 ├─9824 ora_lgwr_hist3c
 ├─9826 ora_ckpt_hist3c
 ├─9828 ora_smon_hist3c
 ├─9830 ora_reco_hist3c
 ├─9832 ora_mmon_hist3c
 ├─9834 ora_mmnl_hist3c
 ├─9836 ora_d000_hist3c
 ├─9838 ora_s000_hist3c
 ├─9846 ora_p000_hist3c
 ├─9848 ora_p001_hist3c
 ├─9850 ora_p002_hist3c
 ├─9852 ora_p003_hist3c
 ├─9854 ora_p004_hist3c
 ├─9856 ora_p005_hist3c
 ├─9858 ora_p006_hist3c
 ├─9860 ora_p007_hist3c
 ├─9862 ora_p008_hist3c
 ├─9864 ora_p009_hist3c
 ├─9866 ora_p010_hist3c
 ├─9868 ora_p011_hist3c
 ├─9870 ora_p012_hist3c
 ├─9872 ora_p013_hist3c
 ├─9874 ora_p014_hist3c
 ├─9876 ora_arc0_hist3c
 ├─9878 ora_arc1_hist3c
 ├─9880 ora_arc2_hist3c
 ├─9882 ora_arc3_hist3c
 ├─9886 ora_qmnc_hist3c
 ├─9964 ora_cjq0_hist3c
 ├─9967 ora_q000_hist3c
 └─9969 ora_q001_hist3c
Jun 15 15:16:06 FastDFS02 systemd[1]: Starting Oracle Database(s) and Listener…
 Jun 15 15:16:06 FastDFS02 dbstart[9689]: Processing Database instance “hist3c”: log file /home/oracle/app/oracle/product/11.2.0/dbhome_1/startup.log
 Jun 15 15:16:17 FastDFS02 systemd[1]: Started Oracle Database(s) and Listener.
### stop oracle-rdbms.service  
[root@FastDFS02:/root]#systemctl status oracle-rdbms.service
 ● oracle-rdbms.service - Oracle Database(s) and Listener
 Loaded: loaded (/etc/systemd/system/oracle-rdbms.service; enabled; vendor preset: disabled)
 Active: inactive (dead) since Thu 2023-06-15 15:30:43 CST; 17s ago
 Process: 10964 ExecStop=/home/oracle/app/oracle/product/11.2.0/dbhome_1/bin/dbshut /home/oracle/app/oracle/product/11.2.0/dbhome_1 (code=exited, status=0/SUCCESS)
 Process: 10123 ExecStart=/home/oracle/app/oracle/product/11.2.0/dbhome_1/bin/dbstart /home/oracle/app/oracle/product/11.2.0/dbhome_1 (code=exited, status=0/SUCCESS)
Jun 15 15:18:01 FastDFS02 systemd[1]: Starting Oracle Database(s) and Listener…
 Jun 15 15:18:01 FastDFS02 dbstart[10123]: Processing Database instance “hist3c”: log file /home/oracle/app/oracle/product/11.2.0/dbhome_1/startup.log
 Jun 15 15:18:09 FastDFS02 systemd[1]: Started Oracle Database(s) and Listener.
 Jun 15 15:30:33 FastDFS02 systemd[1]: Stopping Oracle Database(s) and Listener…
 Jun 15 15:30:33 FastDFS02 dbshut[10964]: Processing Database instance “hist3c”: log file /home/oracle/app/oracle/product/11.2.0/dbhome_1/shutdown.log
 Jun 15 15:30:43 FastDFS02 systemd[1]: Stopped Oracle Database(s) and Listener.










