由于环境变量设置不当导致连接不上实例
Mar102014
今天在连接ASM的时候遇到个奇怪的问题,以前没有遇到过,通过ASMCMD命令连接ASM,提示连接空闲实例。操作系统版本是OEL5.4,数据库版本是11.2.0.3.0。
[oracle@test53 ~]$ asmcmd Connected to an idle instance.
具体环境是这样的,这是从10.2.0.4升级到11.2.0.3.0版本的RAC环境,GRID也是有ORACLE用户安装的,在PROFILE里面设置的环境变量基本都是ORACLE的,登录ASM实例时需要设置GRID的环境变量,我具体操作如下。
[oracle@test53 ~]$ env| grep ORA ORA_CRS_HOME=/u01/app/grid/11.2.0/grid ORACLE_SID=orcl2 ORACLE_BASE=/u01/app/oracle ORACLE_HOME=/u01/app/oracle/product/11.2.0/db_1 [oracle@test53 ~]$ export ORACLE_SID=+ASM2 [oracle@test53 ~]$ export ORACLE_HOME=/u01/app/grid/11.2.0/grid/ [oracle@test53 ~]$ export PATH=$PATH:/u01/app/grid/11.2.0/grid/bin [oracle@test53 ~]$ asmcmd Connected to an idle instance. ASMCMD> ls ASMCMD-8102: no connection to ASM; command requires ASM to run
纠结了半天,后来仔细查看发现设置ORACLE_HOME的时候使用TAB键补齐多补了个“/”,把这个“/”去掉就好了。
[oracle@test53 ~]$ env | grep ORA ORA_CRS_HOME=/u01/app/grid/11.2.0/grid ORACLE_SID=+ASM2 ORACLE_BASE=/u01/app/grid/ ORACLE_HOME=/u01/app/grid/11.2.0/grid/ [oracle@test53 ~]$ export ORACLE_HOME=/u01/app/grid/11.2.0/grid [oracle@test53 ~]$ asmcmd ASMCMD> ls CRS/ FRADG/ ORCLDG/ ASMCMD>
对于ORACLE实例,这也同样适用,以下实验来自另外一台服务器,在配置好的环境变量里登录数据库没有问题,如下:
[oracle@test49 ~]$ env | grep ORA ORACLE_SID=orcl1 ORACLE_BASE=/u01/app/oracle ORACLE_HOME=/u01/app/oracle/product/11.2.0/dbhome_1 [oracle@test49 ~]$ sqlplus / as sysdba SQL*Plus: Release 11.2.0.3.0 Production on Mon Mar 10 13:50:01 2014 Copyright (c) 1982, 2011, Oracle. All rights reserved. Connected to: Oracle Database 11g Enterprise Edition Release 11.2.0.3.0 - Production With the Partitioning, Real Application Clusters, Automatic Storage Management, OLAP, Data Mining and Real Application Testing options SQL> SQL> exit Disconnected
当把ORACLE_HOME设置多一个“/”后,就遇到和上面一样的问题了,提示连接空闲实例。
[oracle@test49 ~]$ export ORACLE_HOME=/u01/app/oracle/product/11.2.0/dbhome_1/ [oracle@test49 ~]$ sqlplus / as sysdba SQL*Plus: Release 11.2.0.3.0 Production on Mon Mar 10 13:49:48 2014 Copyright (c) 1982, 2011, Oracle. All rights reserved. Connected to an idle instance. SQL>
在设置环境变量时一定要注意,在打补丁的时候有时候也需要手动输入这样的变量,记得在变量的最后不要加这个“/”。
——————————————————end—————————————————–
【上一篇】ORA-16433 The database must be opened in read write mode故障解决
【下一篇】ORA-01618 redo thread 2 is not enabled – cannot mount故障解决
【下一篇】ORA-01618 redo thread 2 is not enabled – cannot mount故障解决