Linux设置Oracle开机自动启动--oracle12c

2025-12-01 20:05:23

1、在terminal中切换到root用户

Linux设置Oracle开机自动启动--oracle12c

2、查看/etc/oratab文件的内容,其内容如下

[root@golonglee ~]# cat /etc/oratab | grep -v ^$

#

# This file is used by ORACLE utilities.  It is created by root.sh

# and updated by the Database Configuration Assistant when creating

# a database.

# A colon, ':', is used as the field terminator.  A new line terminates

# the entry.  Lines beginning with a pound sign, '#', are comments.

#

# Entries are of the form:

#   $ORACLE_SID:$ORACLE_HOME:<N|Y>:

#

# The first and second fields are the system identifier and home

# directory of the database respectively.  The third filed indicates

# to the dbstart utility that the database should , "Y", or should not,

# "N", be brought up at system boot time.

#

# Multiple entries with the same $ORACLE_SID are not allowed.

#

#

oel63:/home/oracle/app/oracle/product/11.2.0/dbhome_1:N

Linux设置Oracle开机自动启动--oracle12c

3、使用命令vi /etc/oratab编辑文件/etc/oratab,在最后添加如下内容

##### what I have written is as following

oel63:/home/oracle/app/oracle/product/11.2.0/dbhome_1:Y

#####Finished wrote in 2015-12-24

说明:/home/oracle/app/oracle/product/11.2.0/dbhome_1为oracle的安装目录,要根据实际情况进行修改。

Linux设置Oracle开机自动启动--oracle12c

4、找到最后的内容

oel63:/home/oracle/app/oracle/product/11.2.0/dbhome_1:N

Linux设置Oracle开机自动启动--oracle12c

5、复制该行oel63:/home/oracle/app/oracle/product/11.2.0/dbhome_1:N并注释掉

Linux设置Oracle开机自动启动--oracle12c

6、粘贴该行,并将该行

oel63:/home/oracle/app/oracle/product/11.2.0/dbhome_1:N最后的N

改为Y

Linux设置Oracle开机自动启动--oracle12c

7、最后按2次ESC键,并输入:wq并按下enter保存,退出

Linux设置Oracle开机自动启动--oracle12c

8、使用命令vi /etc/rc.d/rc.local编辑rc.local文件,添加如下内容

##### what I have written is as following

su oracle -lc "/home/oracle/app/oracle/product/11.2.0/dbhome_1/bin/lsnrctl start"

su oracle -lc /home/oracle/app/oracle/product/11.2.0/dbhome_1/bin/dbstart

#####Finished wrote in 2015-12-24

说明:因为第一行命令中有空格所以用双引号(英文的双引号)

/home/oracle/app/oracle/product/11.2.0/dbhome_1为oracle的安装目录,要根据实际情况进行修改。

9、最后按2次ESC键,并输入:wq并按下enter保存,退出,重启机器,验证成功。

10、如果以上经验帮到您,麻烦在左下角给点个赞,谢谢!

Linux设置Oracle开机自动启动--oracle12c

声明:本网站引用、摘录或转载内容仅供网站访问者交流或参考,不代表本站立场,如存在版权或非法内容,请联系站长删除,联系邮箱:site.kefu@qq.com。
猜你喜欢