1:vi /etc/oratab
colystdb:/opt/app/oracle/product/19.3.0:Y
2:vim /usr/bin/oracle.sh
#! /bin/bash
# script For oracle19c.service
/opt/app/oracle/product/19.3.0/dbhome_1/bin/lsnrctl start
/opt/app/oracle/product/19.3.0/dbhome_1/bin/dbstart /opt/app/oracle/product/19.3.0/dbhome_1
3:chmod 777 /usr/bin/oracle.sh
4:vi /etc/systemd/system/oracle19c.service
[Unit]
Description=Oracle19c
After=syslog.target network.target
[Service]
LimitMEMLOCK=infinity
LimitNOFILE=65535
Type=oneshot
RemainAfterExit=yes
User=oracle
Environment="ORACLE_HOME=/opt/app/oracle/product/19.3.0/dbhome_1"
ExecStart=/usr/bin/oracle.sh
[Install]
WantedBy=multi-user.target
5:systemctl enable oracle19c
6:systemctl is-enabled oracle19c.service #查看服务是否是开机自启动