今天同事说有台机器由于假期停电,重启机器后,用PLSQL登录报:

ORA-01034: ORACLE not available
ORA-27101: shared memory realm does not exist
Linux_x86_64 Error: 2: No such file or directory

的错误。


网上也有很多对这个报错的说法:

启动的Oracle的时侯; 
试图创建数据库的时侯; 
试图对数据库进行连接的时侯; 
在客户端正在运行SQL/PL/SQL的时侯; 
备份/恢复数据库的时侯; 
其它一些情况下

会报这样的错误。


原因呢包括:

Unix核心参数设置不当 
Oracle执行文件权限不正确/环境变量问题 
客户端通信不能正确处理 
数据库服务器崩溃/操作系统崩溃/进程被kill 
Oracle 内部错误 
特定SQL、PL/SQL引起的错误 
空间不够 
防火墙的问题 
其它原因


从ORA-1034的错误介绍:

01034, 00000, "ORACLE not available"
// *Cause: Oracle was not started up. Possible causes include the following:
//         - The SGA requires more space than was allocated for it.
//         - The operating-system variable pointing to the instance is
//           improperly defined.
// *Action: Refer to accompanying messages for possible causes and correct
//          the problem mentioned in the other messages. 
//          If Oracle has been initialized, then on some operating systems,
//          verify that Oracle was linked correctly. See the platform
//          specific Oracle documentation.

也可以看出原因是:“Oracle was not started up”,至于为什么没启动,可能就是上述描述的若干原因之一。

但其实针对这次的问题,原因就是Oracle未启动,机器启动并未配置自动启动Oracle服务,sqlplus登录后处于idle状态。。。


往往问题看似复杂,但原因可能很简单,当然这只是一个特例,至少教会我们,出现这类问题时,首先看下Oracle是否执行过启动命令,若是,可以继续查看,例如打开alert日志等,需要具体问题具体分析了。