1。现象
在11g的环境下执行 sqlplus / as sysdba 报错
2。分析
(1)在同一个AIX机器上装完10g后又装了个11g的环境
11g的环境变量配置如下(注意红色部分)
export ORACLE_BASE=/opt/oracle
export ORACLE_HOME=/oracle/product/11.2.0/
export ORA_DB=/oracle/product/11.2.0/dbs
export ORACLE_SID=ora11g
export ORACLE_TERM=vt100
export ORA_NLS33=/oracle/product/11.2.0/ocommon/nls/admin/data
export PATH=$PATH:$HOME/bin:$ORACLE_HOME/bin:.
export ORACLE_HOME=/oracle/product/11.2.0
export BRARY_PATH=$ORACLE_HOME/lib:$LD_LIBRARY_PATH
(2)怀疑在执行sqlplus时调用的仍然是调用10g的,导致10g的sqlplus与11g的其他组件不兼容
$ echo $PATH
/usr/bin:/etc:/usr/sbin:/usr/ucb:/usr/bin/X11:/sbin:/usr/java5/jre/bin:/usr/java5/bin:/home/oracle/bin:/opt/oracle/product/10.1.0//bin:/home/oracle/bin:/oracle/product/11.2.0//bin:.:/home/oracle/bin:/oracle/product/11.2.0//bin:.
果然,11g的bin在10g之后。更改PATH的值,将$ORACLE_HOME/bin提前
export PATH=$ORACLE_HOME/bin:$PATH:$HOME/bin:.
$ echo $PATH
/oracle/product/11.2.0//bin:/usr/bin:/etc:/usr/sbin:/usr/ucb:/usr/bin/X11:/sbin:/usr/java5/jre/bin:/usr/java5/bin:/home/oracle/bin:/opt/oracle/product/10.1.0//bin:/home/oracle/bin:/oracle/product/11.2.0//bin:.:/home/oracle/bin:.
3。验证通过
$ sqlplus / as sysdba
SQL*Plus: Release 11.2.0.1.0 Production on Fri May 24 16:27:29 2013
Copyright (c) 1982, 2009, Oracle. All rights reserved.
Connected to:
Oracle Database 11g Enterprise Edition Release 11.2.0.1.0 - 64bit Production
With the Partitioning, OLAP, Data Mining and Real Application Testing options
SQL>