我在CentOS 5.5装的Oracle 10g RAC,2节点。
正常的用sqlplus连入时,会出现这样的情况:
- [oracle@rac1 ~]$ export ORACLE_SID=myrac1
-
[oracle@rac1 ~]$
-
[oracle@rac1 ~]$ sqlplus / as sysdba
-
-
SQL*Plus: Release 10.2.0.1.0 - Production on Wed Aug 17 11:09:35 2011
-
-
Copyright (c) 1982, 2005, Oracle. All rights reserved.
-
-
Connected to an idle instance.
-
-
SQL>
-
SQL>
-
SQL> exit
然而,如果我通过tns的方式连接:
- [oracle@rac1 ~]$ sqlplus system/oracle@myrac1
-
-
SQL*Plus: Release 10.2.0.1.0 - Production on Wed Aug 17 11:09:50 2011
-
-
Copyright (c) 1982, 2005, Oracle. All rights reserved.
-
-
-
Connected to:
-
Oracle Database 10g Enterprise Edition Release 10.2.0.1.0 - Production
-
With the Partitioning, Real Application Clusters, OLAP and Data Mining options
-
-
SQL>
-
SQL> select inst_id, instance_name, status from gv$instance;
-
-
INST_ID INSTANCE_NAME STATUS
-
---------- ---------------- ------------
-
1 myrac1 OPEN
-
2 myrac2 OPEN
结果却能正确显示出我两个节点实例的正确状态。
各个节点resource的状态都是ONLINE的:
- [oracle@rac1 ~]$ crs_stat -t
-
Name Type Target State Host
-
------------------------------------------------------------
-
ora.myrac.db application ONLINE ONLINE rac1
-
ora....c1.inst application ONLINE ONLINE rac1
-
ora....c2.inst application ONLINE ONLINE rac2
-
ora....SM1.asm application ONLINE ONLINE rac1
-
ora....C1.lsnr application ONLINE ONLINE rac1
-
ora.rac1.gsd application ONLINE ONLINE rac1
-
ora.rac1.ons application ONLINE ONLINE rac1
-
ora.rac1.vip application ONLINE ONLINE rac1
-
ora....SM2.asm application ONLINE ONLINE rac2
-
ora....C2.lsnr application ONLINE ONLINE rac2
-
ora.rac2.gsd application ONLINE ONLINE rac2
-
ora.rac2.ons application ONLINE ONLINE rac2
-
ora.rac2.vip application ONLINE ONLINE rac2
最后,google了下,发现了这篇文章:
问题其实在于环境变量中, ORACLE_HOME里多带了斜杠造成的。
- [oracle@rac1 ~]$ env
-
ORA_CRS_HOME=/opt/oracle//product/crs/
-
HOSTNAME=rac1
-
TERM=vt100
-
SHELL=/bin/bash
-
HISTSIZE=1000
-
TMPDIR=/tmp
-
SSH_CLIENT=192.168.0.98 3141 22
-
ORACLE_OWNER=oracle
-
SSH_TTY=/dev/pts/1
-
USER=oracle
-
LD_LIBRARY_PATH=/opt/oracle//product/10.2.0/db1/lib:
-
LS_COLORS=no=00:fi=00:di=01;34:ln=01;36:pi=40;33:so=01;35:bd=40;33;01:cd=40;33;01:or=01;05;37;41:mi=01;05;37;41:ex=01;32:*.cmd=01;32:*.exe=01;32:*.com=01;32:*.btm=01;32:*.bat=01;32:*.sh=01;32:*.csh=01;32:*.tar=01;31:*.tgz=01;31:*.arj=01;31:*.taz=01;31:*.lzh=01;31:*.zip=01;31:*.z=01;31:*.Z=01;31:*.gz=01;31:*.bz2=01;31:*.bz=01;31:*.tz=01;31:*.rpm=01;31:*.cpio=01;31:*.jpg=01;35:*.gif=01;35:*.bmp=01;35:*.xbm=01;35:*.xpm=01;35:*.png=01;35:*.tif=01;35:
-
ORACLE_SID=myrac1
-
ORACLE_BASE=/opt/oracle/
-
MAIL=/var/spool/mail/oracle
-
PATH=/opt/oracle//product/10.2.0/db1/bin:/opt/oracle//product/crs//bin:/opt/oracle//product/10.2.0/db1/bin:/usr/kerberos/bin:/usr/local/bin:/bin:/usr/bin:/home/oracle/bin
-
INPUTRC=/etc/inputrc
-
PWD=/home/oracle
-
LANG=en_US.UTF-8
-
SSH_ASKPASS=/usr/libexec/openssh/gnome-ssh-askpass
-
SHLVL=1
-
HOME=/home/oracle
-
TMP=/tmp
-
LOGNAME=oracle
-
CVS_RSH=ssh
-
SSH_CONNECTION=192.168.0.98 3141 192.168.0.31 22
-
LESSOPEN=|/usr/bin/lesspipe.sh %s
-
ORACLE_HOME=/opt/oracle//product/10.2.0/db1
-
G_BROKEN_FILENAMES=1
-
_=/bin/env
正是由于这个原因,产生了上面的问题:
以下是测试:
- [oracle@rac1 ~]$ export ORACLE_HOME=$ORACLE_BASE//product/10.2.0/db1
-
[oracle@rac1 ~]$ echo $ORACLE_HOME
-
/opt/oracle//product/10.2.0/db1
-
[oracle@rac1 ~]$
-
[oracle@rac1 ~]$
-
[oracle@rac1 ~]$
-
[oracle@rac1 ~]$ export ORACLE_SID=myrac1
-
[oracle@rac1 ~]$
-
[oracle@rac1 ~]$ sqlplus / as sysdba
-
-
SQL*Plus: Release 10.2.0.1.0 - Production on Wed Aug 17 13:04:46 2011
-
-
Copyright (c) 1982, 2005, Oracle. All rights reserved.
-
-
Connected to an idle instance.
-
-
SQL>
-
SQL>
-
SQL>
-
SQL> exit
-
Disconnected
-
[oracle@rac1 ~]$
-
[oracle@rac1 ~]$
-
[oracle@rac1 ~]$ export ORACLE_HOME=$ORACLE_BASE/product/10.2.0/db1
-
[oracle@rac1 ~]$
-
[oracle@rac1 ~]$
-
[oracle@rac1 ~]$ echo $ORACLE_HOME
-
/opt/oracle/product/10.2.0/db1
-
[oracle@rac1 ~]$
-
[oracle@rac1 ~]$
-
[oracle@rac1 ~]$
-
[oracle@rac1 ~]$
-
[oracle@rac1 ~]$ export ORACLE_SID=myrac1
-
[oracle@rac1 ~]$ sqlplus / as sysdba
-
-
SQL*Plus: Release 10.2.0.1.0 - Production on Wed Aug 17 13:05:27 2011
-
-
Copyright (c) 1982, 2005, Oracle. All rights reserved.
-
-
-
Connected to:
-
Oracle Database 10g Enterprise Edition Release 10.2.0.1.0 - Production
-
With the Partitioning, Real Application Clusters, OLAP and Data Mining options
-
-
SQL> select instance_name, status from gv$instance;
-
-
INSTANCE_NAME STATUS
-
---------------- ------------
-
myrac1 OPEN
-
myrac2 OPEN
-
-
SQL>
原来,认为多几个斜线对结果应该不会造成什么影响:
- [oracle@rac1 ~]$ pwd
-
/home/oracle
-
-
[oracle@rac1 ~]$ cd /opt/////////oracle
-
[oracle@rac1 oracle]$ pwd
-
/opt/oracle
-
[oracle@rac1 oracle]$
但是,应该是oracle进程在认环境不变量时,还是比较认死理。。。认为路径就是那个,多一个少一个斜杠不行。
这个问题比较有意思,一直猜想是bug,结果却是个小问题造成的。。。又长见识了。。。
阅读(1503) | 评论(0) | 转发(0) |