备忘录

记录点滴技术

  博客园 :: 首页 :: 新随笔 :: 联系 :: 订阅 :: 管理 ::

centos7.9配置oracle 11.2.0.4开机自启动

1、‌修改 /etc/oratab‌,将对应实例行末尾 N 改为 Y(允许 dbstart 自动拉起)

2、创建 /etc/systemd/system/oracle.service文件,内容大致如下:

[Unit]
Description=Oracle Database 11g
After=network.target

[Service]
Type=forking
User=wen
Environment="ORACLE_HOME=/home/wen/app/wen/product/11.2.0/dbhome_2"
Environment="ORACLE_SID=orcl"
ExecStart=/home/wen/app/wen/product/11.2.0/dbhome_2/bin/dbstart $ORACLE_HOME
ExecStop=/home/wen/app/wen/product/11.2.0/dbhome_2/bin/dbshut $ORACLE_HOME
TimeoutSec=300
RemainAfterExit=yes

[Install]
WantedBy=multi-user.target

红色部分要根据实际情况设置,user设置为安装oracle时的用户,如果不设置user,会提示ORA-01031: insufficient privileges,数据库无法启动

3、启动并验证

sudo systemctl daemon-reload
sudo systemctl enable oracle
sudo systemctl start oracle
systemctl status oracle

 

posted on 2026-08-30 17:10  goding  阅读(15)  评论(0)    收藏  举报