AIX

AIX

Connect with fellow AIX users and experts to gain knowledge, share insights, and solve problems.


#Power
#Power
 View Only
  • 1.  bash_profile and .profile

    Posted Tue January 04, 2011 07:01 AM

    Originally posted by: big


    Hi,
    happy new year.
    on AIX 6.1 , for user oracle , there are two files :
    bash_profile and .profile

    I do not know which one is executed when login ? How to know ?
    More over in both of them we have :
    in .profile :

    ORACLE_HOME=/appli/oracle/product/10.2.0/db_1
    ORACLE_PATH=/appli/oracle/product/10.2.0/db_1/bin
    PATH=$PATH:$ORACLE_PATH
    set -o vi
    /usr/local/bin/bash
    ./appli/oracle/.bash_profile
    export ORACLE_HOME ORACLE_PATH PATH ORATEMP ORATMP TMP TEMP
    in bash_profile :
    export ORACLE_HOME=/appli/oracle/product/10.2.0/db_1
    But the ORACLE_HOME is not set :

    :/appli/oracle#sqlplus / as sysdba
    Error 6 initializing SQL*Plus
    Message file sp1<lang>.msb not found
    SP2-0750: You may need to set ORACLE_HOME to your Oracle software directory
    Any idea, any help ?
    Thank you.
    #AIX-Forum


  • 2.  Re: bash_profile and .profile

    Posted Tue January 04, 2011 08:53 AM

    Originally posted by: SystemAdmin


    excuse me but what a mess. the user runs a bash in his ksh .profile and exports important variables after the bash terminates?

    I suggest someone make a decision about which shell to use, read the manual, set the login shell for this user and start from zero.

    the bash startup is thoroughly documented:
    http://www.gnu.org/software/bash/manual/bashref.html#Bash-Startup-Files

    the ksh manual also has a link to .profile iirc

    keep in mind that the shells source different files depending on whether they are login shells.
    #AIX-Forum


  • 3.  Re: bash_profile and .profile

    Posted Tue January 04, 2011 10:18 AM

    Originally posted by: big


    Thank Delgado.
    Would you be so kind to say what should I realy do ? Clear steps to follow.
    #AIX-Forum


  • 4.  Re: bash_profile and .profile

    Posted Wed January 05, 2011 04:32 AM

    Originally posted by: lech77


    > Clear steps to follow.

    Delete these two lines...

    /usr/local/bin/bash
    ./appli/oracle/.bash_profile

    ...from ~/.profile and you should be (more or less) OK.
    #AIX-Forum


  • 5.  Re: bash_profile and .profile

    Posted Wed January 05, 2011 03:44 AM

    Originally posted by: lech77


    > in .profile :
    >
    > ORACLE_HOME=/appli/oracle/product/10.2.0/db_1
    > ORACLE_PATH=/appli/oracle/product/10.2.0/db_1/bin
    > PATH=$PATH:$ORACLE_PATH
    > set -o vi
    > /usr/local/bin/bash
    ^^^^^^^^^^^^^^^^^^^^^
    > ./appli/oracle/.bash_profile
    > export ORACLE_HOME ORACLE_PATH PATH ORATEMP ORATMP TMP TEMP

    I'm afraid it won't work this way. What this line does
    is it invokes bash as a non-login interactive shell,
    efectively stopping processing the rest of the ~/.profile
    until bash has finished running.

    So even if there was a blank separating leading dot from
    the slash on the next line .bash_profile would be sourced
    by (I assume) ksh right after the completion of bash execution.

    > in bash_profile :
    >
    > export ORACLE_HOME=/appli/oracle/product/10.2.0/db_1

    Even if this file is named "~/.bash_profile" it would never
    be read by a bash unless it is invoked as a login shell.

    > :/appli/oracle#sqlplus / as sysdba
    > Error 6 initializing SQL*Plus
    > Message file sp1<lang>.msb not found
    > SP2-0750: You may need to set ORACLE_HOME to your Oracle software directory

    I'm afraid sqlplus execution was attempted in bash
    (executed from .profile, as seen above). Since
    ORACLE_HOME set in the .profile was not exported
    yet (exports come after the invocation of bash)
    there's no env var named ORACLE_HOME in bash.
    #AIX-Forum


  • 6.  Re: bash_profile and .profile

    Posted Wed January 05, 2011 07:34 PM

    Originally posted by: SystemAdmin


    Hi,

    From the Korn shell, you are starting a Bash shell via the .profile. When I tried this the Korn shell environment variables were passed through to the Bash shell, so the ORACLE_HOME variable should still be active.

    Out of interest, comment out the two bash lines in your .profile, login as oracle, and run:

    env > env.ksh

    Uncomment the lines in the .profile, login as oracle and run:

    env > env.bash

    Compare. I suspect the line: ./appli/oracle/.bash_profile
    should have a space between the dot and the /appli/oracle/.bash_profile
    e.g.

    . /appli/oracle/.bash_profile

    See how that goes.
    #AIX-Forum


  • 7.  Re: bash_profile and .profile

    Posted Sat January 08, 2011 08:37 AM

    Originally posted by: Kosala


    Since you're so eager to use BASH, why not change the shell for the oracle user to BASH. chuser shell=/usr/bin/bash oracle will do the job. You might need to add bash to /etc/shells.

    Kosala
    #AIX-Forum