redhat enterprise 4下安装oracle10g.[oracle@localhost ~]$ vi .bash_profile# .bash_profile# Get the aliases and functions
if [ -f ~/.bashrc ]; then
  . ~/.bashrc
fi# User specific environment and startup programsPATH=$PATH:$HOME/product/10.2.0/db_1/bin
ORACLE_SID=orcl
ORACLE_BASE=/u01
ORACLE_HOME=$ORACLE_BASE/oracle
DISPLAY=192.168.153.1:0.0export PATH ORACLE_SID ORACLE_BASE ORACLE_HOME DISPLAY
unset USERNAME
~
~
~
保存退出之后,再次登陆oracle用户
env | grep ORA
还是空的
大侠们!求解!~~

解决方案 »

  1.   

    PATH=$PATH:$HOME/product/10.2.0/db_1/bin;export PATH
    ORACLE_SID=orcl;export ORACLE_SID
    ORACLE_BASE=/u01;EXPORT ORACLE_BASE
    ORACLE_HOME=$ORACLE_BASE/oracle;EXPORT ORACLE_HOME
    DISPLAY=192.168.153.1:0.0;EXPORT DISPLAY
    编辑该文件(.bash_profile)后,保存并重新编译一下该文件:source .bash_profile然后再用oracle用户登录数据库试试。
      

  2.   

    楼主是用这样的export的,不过我没有这样用过。
    export PATH ORACLE_SID ORACLE_BASE ORACLE_HOME DISPLAY
      

  3.   

    确实,我是这样export的,现在ORACLE_SID ORACLE_BASE ORACLE_HOME都有效,但是每次重新启动sqlplus的时候都提示command not found,用which sqlplus 看提示没有找到路径,然后我必须先source .bash_profile PATH下才会有$ORACLE_HOME/product/10.2.0/db_1/bin 在用sqlplus命令就可以。
    为什么path 没有正确啊?
      

  4.   

    就像这样
    [root@localhost ~]# su - oracle
    [oracle@localhost ~]$ sqlplus
    -bash: sqlplus: command not found
    [oracle@localhost ~]$ source .bash_profile
    [oracle@localhost ~]$ sqlplusSQL*Plus: Release 10.2.0.1.0 - Production on Sun Aug 22 13:09:39 2010Copyright (c) 1982, 2005, Oracle.  All rights reserved.Enter user-name:......看我的.bash_profile
    # .bash_profile# Get the aliases and functions
    if [ -f ~/.bashrc ]; then
            . ~/.bashrc
    fi# User specific environment and startup programsPATH=$PATH:$HOME/bin:$ORACLE_HOME/bin
    ORACLE_SID=orcl
    ORACLE_BASE=/u01
    ORACLE_HOME=$ORACLE_BASE/database/product/10.2.0/db_1
    DISPLAY=192.168.153.1:0.0
    export PATH ORACLE_SID ORACLE_BASE ORACLE_HOME DISPLAY
    unset USERNAME
    ~
    ~
    ~
    ~
    ~
    --ORACLE_HOME和昨天的不一样
      

  5.   


    说明一下linux下命令的区别:
    如果想从a用户切换到b用户下,有2中方式:
    1.在a用户命令窗口下执行:su - b,这样的话,当在切换到b用户下时,系统会自动执行b用户根目录下的.bash_profile文件,因此设置在该文件中的环境变量会生效。
    2.在a用户命令窗口下执行:su  b,这样的话,当在切换到b用户下时,系统不会自动执行b用户根目录下的.bash_profile文件,因此在.bash_profile文件中设置的环境变量不会生效.除非切换到b用户下执行一下
    source  .bash_profile,这样该文件中环境变量才会生效。