RedHat下开机启动oracle数据库

资料来源: 如何查看Oracle的启动状态

Linux 下 Oracle 开机自启动配置

一、修改/etc/oratab的值为Y

[oracle@HSDB ~]# cat /etc/oratab orcl为自动启动实例

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

二、修改dbstart的ORACLE_HOME_LISTNER,使其指向$ORACLE_HOME

[oracle@HS-DB ~]$ echo $ORACLE_HOME
/u01/app/oracle/product/10.2.0/db_1
[oracle@HSDB ~]$ cd $ORACLE_HOME/bin
[oracle@HSDB bin]$ nano dbstart

然后在nano编辑器下,使用Ctrl+w命令找到非注释的“ORACLE_HOME_LISTNER”(按四次pagedown应该就可以看到了):

# 将下面

# Set ORACLE_HOME_LISTNER
ORACLE_HOME_LISTNER=/ade/vikrkuma_new/oracle

# 改成

# Set this to bring up Oracle Net Listener ORACLE_HOME_LISTNER=$ORACLE_HOME

Ctrl+o保存,然后退出;

三、 用root用户登录,修改在rc.local,添加如下内容:

[oracle@HSDB ~]# nano /etc/rc.local        
# 在后面添加下面的内容
su - oracle -c 'dbstart'
# su - oracle -c 'agentctl start'
su - oracle -c 'lsnrctl start'

重启!

重启后,使用sqlplus命令登录,执行命令查看数据库是否启动:

select status from v$instance;

如果结果是:

STATUS
------------
OPEN

则说明数据库已经自动启动!

然后查看数据库实例启动情况:

#直接敲下列命令
[oracle@HSDB ~]$ lsnrctl status

就可以查看数据库实例的启动结果:

LSNRCTL for Linux: Version 10.2.0.1.0 - Production on 22-APR-2015 14:37:07

Copyright (c) 1991, 2005, Oracle.  All rights reserved.

Connecting to (ADDRESS=(PROTOCOL=tcp)(HOST=)(PORT=1521))
STATUS of the LISTENER
------------------------
Alias                     LISTENER
Version                   TNSLSNR for Linux: Version 10.2.0.1.0 - Production
Start Date                22-APR-2015 14:10:17
Uptime                    0 days 0 hr. 26 min. 50 sec
Trace Level               off
Security                  ON: Local OS Authentication
SNMP                      OFF
Listener Parameter File   /u01/app/oracle/product/10.2.0/db_1/network/admin/listener.ora
Listener Log File         /u01/app/oracle/product/10.2.0/db_1/network/log/listener.log
Listening Endpoints Summary...
  (DESCRIPTION=(ADDRESS=(PROTOCOL=tcp)(HOST=HSDB)(PORT=1521)))
Services Summary...
Service "HS2008" has 1 instance(s).
  Instance "HS2008", status READY, has 1 handler(s) for this service...
Service "HS2008XDB" has 1 instance(s).
  Instance "HS2008", status READY, has 1 handler(s) for this service...
Service "HS2008_XPT" has 1 instance(s).
  Instance "HS2008", status READY, has 1 handler(s) for this service...
The command completed successfully

 

posted @ 2015-04-22 15:26  SchrodingerCat  阅读(767)  评论(0编辑  收藏  举报