文章目录
一、修改/etc/oratab
sql
实例名:/opt/oracle/product/19c/dbhome_1:N
修改为
实例名:/opt/oracle/product/19c/dbhome_1:Y
二、创建启动脚本并授权
sql
vi /usr/bin/oracle19c.sh
######添加以下内容(注意修改路径)######
#!/bin/bash
/u01/app/oracle/product/19c/dbhome_1/bin/lsnrctl start
/u01/app/oracle/product/19c/dbhome_1/bin/dbstart /opt/oracle/product/19c/dbhome_1
######赋执行权限######
chmod +x /usr/bin/oracle19c.sh
三、创建service服务
sql
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=/u01/app/oracle/product/19c/dbhome_1"
ExecStart=/usr/bin/oracle19c.sh
[Install]
WantedBy=multi-user.target
四、设置开机自启并进行测试
shell
systemctl enable oracle19c
# 查看服务状态
systemctl status oracle19c
# 启动
systemctl start oracle19c
# 停止
systemctl stop oracle19c
# 重启
systemctl restart oracle19c
reboot 重启验证: