oracle 数据库开机自启动

2025-10-17 16:51:04

1、查看ORACLE_HOME是否设置

[oracle@oracle10g bin]$ echo $ORACLE_HOME

/u01/app/oracle/product/10.2.0/db_1

如果结果是空,需要编写/home/oracle/.bash_profile文件

oracle 数据库开机自启动

2、执行dbstart   数据库自带启动脚本

[oracle@oracle10g bin]$ dbstart

ORACLE_HOME_LISTNER is not SET, unable to auto-start Oracle Net Listener

Usage: /u01/app/oracle/product/10.2.0/db_1/bin/dbstart ORACLE_HOME

错误提示:ORACLE_HOME_LISTNER 没有设置

[oracle@oracle10g bin]$ cd /u01/app/oracle/product/10.2.0/db_1/bin/

[oracle@oracle10g bin]$ ll | grep dbs

-rwxr-x--- 1 oracle oinstall      6582 Jan  1  2000 dbshut

-rwxr-x--- 1 oracle oinstall     14088 Jan  1  2000 dbstart

编辑 dbstart,将ORACLE_HOME_LISTNER=$1修改成ORACLE_HOME_LISTNER=$ORACLE_HOME

前提是$ORACLE_HOME环境设置正确

oracle 数据库开机自启动

oracle 数据库开机自启动

3、编辑/etc/oratab文件

dbca建库时都会自动创建/etc/oratab文件

将orcl:/u01/app/oracle/product/10.2.0/db_1:N 修改成

orcl:/u01/app/oracle/product/10.2.0/db_1:Y

oracle 数据库开机自启动

4、编辑/etc/rc.d/rc.local启动文件,添加数据库启动脚本dbstart

该文件必须使用root用户编辑

[root@oracle10g ~]# vi  /etc/rc.d/rc.local

[root@oracle10g ~]# cat /etc/rc.d/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 /u01/app/oracle/product/10.2.0/db_1/bin/dbstart

su - oracle -lc "/u01/app/oracle/product/10.2.0/db_1/bin/lsnrctl start"

oracle 数据库开机自启动

5、重启主机,查看数据库和监听是自启动

刚开始重启一次可能不生效,再次重启查看下

oracle 数据库开机自启动

6、查看数据库是否处于open状态

最后的保证数据库是否处于可用状态

oracle 数据库开机自启动

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