Chinaunix首页 | 论坛 | 博客
  • 博客访问: 94734
  • 博文数量: 42
  • 博客积分: 2510
  • 博客等级: 少校
  • 技术积分: 480
  • 用 户 组: 普通用户
  • 注册时间: 2009-03-16 13:39
文章分类

全部博文(42)

文章存档

2011年(1)

2010年(6)

2009年(35)

我的朋友

分类: Oracle

2009-03-22 13:18:43

前段时间在贵州做项目,发现ORACLE在开机后无法自动起来,以下是处理过程
 
Oracle无法开机自启动
 

产品类:Oracle+9.2.0.4

故障现象:服务器开机后Oracle数据库无法自动起来
:~> ps -ef|grep ora
oracle    8764     1  0 Jan08 ?        00:03:00 /opt/oracle/product/9.2.0/bin/tnslsnr LISTENER -inherit
告警信息:使用ps –ef|grep ora命令无法查看到进程起来,而只能看到有监听
:~> ps -ef|grep ora
oracle    8764     1  0 Jan08 ?        00:03:00 /opt/oracle/product/9.2.0/bin/tnslsnr LISTENER -inherit
原因分析:
1、首先为确认数据库本身没有问题,使用系统自身用户尝试连接并开启数据库发现能够成功
   :~> sqlplus "/as sysdba"
 
SQL*Plus: Release 9.2.0.8.0 - Production on Sun Jan 11 15:00:54 2009
 
Copyright (c) 1982, 2002, Oracle Corporation.  All rights reserved.
 
 
Connected to:
Oracle9i Enterprise Edition Release 9.2.0.8.0 - Production
With the Partitioning, OLAP and Oracle Data Mining options
JServer Release 9.2.0.8.0 - Production
 
SQL> startup
ORACLE instance started.
 
Total System Global Area  235999648 bytes
Fixed Size                   450976 bytes
Variable Size             201326592 bytes
Database Buffers           33554432 bytes
Redo Buffers                 667648 bytes
Database mounted.
Database opened.
SQL>
:~> ps -ef|grep ora
oracle    8764     1  0 Jan08 ?        00:03:00 /opt/oracle/product/9.2.0/bin/tnslsnr LISTENER -inherit
oracle    9595     1  0 Jan08 ?        00:00:07 ora_pmon_vissdb
oracle    9597     1  0 Jan08 ?        00:00:10 ora_dbw0_vissdb
oracle    9599     1  0 Jan08 ?        00:01:42 ora_lgwr_vissdb
oracle    9601     1  0 Jan08 ?        00:00:10 ora_ckpt_vissdb
oracle    9603     1  0 Jan08 ?        00:00:04 ora_smon_vissdb
oracle    9605     1  0 Jan08 ?        00:00:00 ora_reco_vissdb
oracle    9607     1  0 Jan08 ?        00:00:00 ora_cjq0_vissdb
oracle    9611     1  0 Jan08 ?        00:00:00 ora_s000_vissdb
oracle    9613     1  0 Jan08 ?        00:00:00 ora_d000_vissdb
oracle    9619     1  0 Jan08 ?        00:00:55 ora_qmn0_vissdb
2、既然这样的话那么很有可能是某个设置上出了问题,先检查/etc/oratab文件,发现有两个“Y”,若改后理论上是可以解决问题的,但为了保证一次性解决,于是继续往下分析
>#
># Multiple entries with the same $ORACLE_SID are not allowed.
>#
>#
># *:/opt/oracle/product/9.2.0:N
>vissdb:/opt/oracle/product/9.2.0:Y
>*:/opt/oracle/product/9.2.0:Y       ----这个是可以注释掉的,要么将其改为N
>oracle@linux:~>
3、检查公司给予的脚本oracle的链接设置情况,发现都是对的,问题不可能出在这
 
linux:/etc/init.d/rc5.d # ls -l *oracle*
lrwxrwxrwx  1 root root 9 Nov 25 10:30 K24oracle -> ../oracle
lrwxrwxrwx  1 root root 9 Nov 25 10:30 S22oracle -> ../oracle
linux:/etc/init.d/rc5.d #
4、检查/etc/sysconfig/oracle中的文件设置发现也是对的
#
START_ORACLE_DB="yes"
 
## Path:        Productivity/Databases/Tools/Oracle/DB
## Type:        yesno
## Default:     no
#
# Enable clients on other computers to connect to the database
#
START_ORACLE_DB_LISTENER="yes"
5、通过上网查询资料,发现若需要开机自启动的话,应该首先要测试ORACLE自带的一个dbstart来验证,若通过的话,基本上是没问题的
> ./dbstart
 
Can't find init file for Database "vissdb".
Database "vissdb" NOT started.
 
SQL*Plus: Release 9.2.0.8.0 - Production on Mon Jan 12 10:26:13 2009
 
Copyright (c) 1982, 2002, Oracle Corporation.  All rights reserved.
 
SQL> ERROR:
ORA-12162: TNS:service name is incorrectly specified
 
 
SQL> ORA-12162: TNS:service name is incorrectly specified
SQL>
Database "" warm started.
>
    根据推断,连这个都无法验证通过,那可能问题就出在这里:找不到vissdb这个启动文件,而这个vissdb应该是刚装数据库的时候建立的,由于该现场数据库重新装过一遍,很有可能就是那次忘了建立这个文件
6、 向公司专家请教,了解到该文件一般都是在数据库安装目录的dbs下于是去其他现场的数据库安装目录下检查并和我这现场的数据库进行对比,发现:
    六枝现场:
    > ls
initdw.ora  initems21.ora  init.ora  lkEMS21  orapwems21  spfileems21.ora
>
    我的现场
    >  ls
initdw.ora  init.ora  lkVISSDB  orapwvissdb  spfilevissdb.ora
>  
对比后我的现场明显少了个类似的init$ORA-SID.ora的文件
 7、再次向公司专家询问,了解到只需要将/opt/oracle/admin/vissdb/spfile下的那个文件拷贝到/opt/oracle/product/9.2.0/dbs目录下并改名为initvissdb.ora即可
 

解决方法
1、首先保证/etc/oratab文件中只有一个“Y”
> #
># Multiple entries with the same $ORACLE_SID are not allowed.
>#
>#
># *:/opt/oracle/product/9.2.0:N
>vissdb:/opt/oracle/product/9.2.0:Y
>#*:/opt/oracle/product/9.2.0:Y       ----把这个给注释掉
>oracle@linux:~>
2、将/opt/oracle/admin/vissdb/spfile下的那个文件拷贝到/opt/oracle/product/9.2.0/dbs目录下并改名为initvissdb.ora即可

3、进入到/opt/oracle/product/9.2.0/bin目录,使用dbstart进行测试验证,看能否起来,若可以的话,只要保证前面的脚本链接正确以及/etc/sysconfig/oracle中的设置如下,开机自启动基本就可以成功
   START_ORACLE_DB="yes"
   START_ORACLE_DB_LISTENER="yes"
4、可以断掉电源或直接敲入reboot命令重启动后会发现ORACLE数据库已经起来
 
 
 
 

 
阅读(1077) | 评论(0) | 转发(0) |
给主人留下些什么吧!~~