oracle 开机自启
oracle没用docker部署,原生部署在centos7上,添加开机自启动
下面介绍两种开机自启方法
1.1 方法一
1.1.1 修改/etc/oratab文件
[oracle@localhost ~]$ vim /etc/oratab
slnngk:/u01/app/oracle/product/11.2.0.4/db_1:N
修改为
//这个路径跟安装路径有关,$ORACLE_SID:$ORACLE_HOME:<N|Y>
slnngk:/u01/app/oracle/product/11.2.0.4/db_1:Y
1.1.2 把lsnrctl start和dbstart添加到rc.local文件中
chmod 755 /etc/rc.d/rc.local; vim /etc/rc.d/rc.local
//下面两条和自己安装的数据库路径有关系,可以在root目录下调整测试没问题后再写
//开机启动数据库监听服务
su - oracle -lc "/u01/app/oracle/product/11.2.0.4/db_1/bin/lsnrctl start"
//开机启动数据库
su - oracle -lc "/u01/app/oracle/product/11.2.0.4/db_1/bin/dbstart"
1.1.3 验证
//重启机器
reboot
//机器启动后
lsnrctl status
ps –ef | grep oracle
2.1 方式二
[root@localhost system]# cat /usr/lib/systemd/system/oracle.service
[Unit]
Description=Oracle Database 12c Startup/Shutdown Service
After=syslog.target network.target
[Service]
LimitMEMLOCK=infinity
LimitNOFILE=65535
Type=oneshot
RemainAfterExit=yes
User=oracle
Environment="ORACLE_HOME=/u01/app/oracle/product/11.2.0.4/db_1"
ExecStart=/u01/app/oracle/product/11.2.0.4/db_1/bin/dbstart $ORACLE_HOME >> 2>&1 &
ExecStop=/u01/app/oracle/product/11.2.0.4/db_1/bin/dbshut $ORACLE_HOME 2>&1 &
[Install]
WantedBy=multi-user.target
//加入开机自启
systemctl enable oracle
systemctl start oracle
标签:app,db,0.4,11.2,开机,自启,oracle,u01
From: https://www.cnblogs.com/liwenchao1995/p/16612192.html