不言不语

您现在的位置是: 首页 >  PHP

PHP

Linux下设置Oracle开机自动启动

2022-06-05PHP
在Linux系统中,安装好Oracle数据库服务后默认情况下并会随时系统的启动自动启动。需要用户去手动进行配置,才能实现Oracle开机自动启动的。下面详细的讲解下Linux下如何设置Oracle开机自动启动。

1、测试Oracle dbstart和dbstut启动

1
2
3

[oracle@oracle ~]$ /oracle/app/oracle/product/11.2.0/dbhome_1/bin/dbstart
ORACLE_HOME_LISTNER is not SET, unable to auto-start Oracle Net Listener
Usage: /oracle/app/oracle/product/11.2.0/dbhome_1/bin/dbstart ORACLE_HOME

有报错信息,提示ORACLE_HOME_LISTNER is not SET,则需要修改Oracle dbstart和dbshut文件,如果没有dbshut文件则可以直接忽略。

2、修改Oracle dbstart和dbstut启动文件

1
2
3
4

[oracle@oracle ~]$ vi /oracle/app/oracle/product/11.2.0/dbhome_1/bin/dbstart
//修改ORACLE_HOME_LISTNER为ORACLE_HOME
//ORACLE_HOME_LISTNER =$1
ORACLE_HOME_LISTNER=$ORACLE_HOME

1
2
3
4

[oracle@oracle ~]$ vi /oracle/app/oracle/product/11.2.0/dbhome_1/bin/dbshut
//修改ORACLE_HOME_LISTNER为ORACLE_HOME
//ORACLE_HOME_LISTNER =$1
ORACLE_HOME_LISTNER=$ORACLE_HOME

3、在oratab文件中设置Oracle开机自启动,需要root权限

1
2
3

[root@oracle ~]# vi /etc/oratab
//设置自启动
powerdes:/oracle/app/oracle/product/11.2.0/dbhome_1:Y

4、在Linux系统rc.local里面设置开机自启动,需要root权限

1
2
3
4
5
6
7
8
9

[root@oracle bin]# vi /etc/rc.local
#!/bin/sh
#
# This script will be executed *after* all the other init scripts.
# You can put your own initialization stuff in here if you don't
# want to do the full Sys V style init stuff.
touch /var/lock/subsys/local
su - oracle -lc "/oracle/app/oracle/product/11.2.0/dbhome_1/bin/lsnrctl start"
su - oracle -c "/oracle/app/oracle/product/11.2.0/dbhome_1/bin/dbstart"


文章评论