Results 1 to 9 of 9
  1. #1
    Join Date
    Oct 2010
    Location
    Orlando, FL
    Posts
    311
    Provided Answers: 1

    Question Unanswered: Setting Env Variables [Linux]

    I'm currently installing Oracle Database 11g R2 (11.2.0.3.0) on Oracle Linux 6.2 & I'm confused with the documentation. I'm just a little confused because Oracle documentation has different revisions showing you how to do one process three different ways so it's overwhelming for this n00b.

    I'm trying to understand the correct / official / recommended Oracle way to simply set my 'oracle' users' environment variables for ORACLE_HOME, ORACLE_BASE, ORACLE_SID as suggested by:

    Oracle Database Preinstallation Requirements

    Enter commands similar to the following to set the ORACLE_BASE and ORACLE_SID environment variables:

    Bourne, Bash, or Korn shell:
    $ ORACLE_BASE=/u01/app/oracle
    $ ORACLE_SID=sales
    $ export ORACLE_BASE ORACLE_SID
    Now when I run the above command, it appears to work fine but only for this session. When the server is rebooted, the 'oracle' user loses all traces of the mentioned above. I'm guessing I need to manually edit their environment some how? I just don't know how to permanently store / configure the settings so they stick with the user after a reboot / power failure.

  2. #2
    Join Date
    Aug 2003
    Location
    Where the Surf Meets the Turf @Del Mar, CA
    Posts
    7,776
    Provided Answers: 1
    create a file as named below
    $HOME/.bash_profile
    that contains the lines below
    $ORACLE_BASE=/u01/app/oracle
    $ORACLE_SID=sales
    $ORACLE_HOME=<correct_path>
    $PATH=$ORACLE_HOME/bin
    $ export ORACLE_BASE ORACLE_SID ORACLE_HOME PATH

    NOTE: the file name above contains a period character to the right of the slash character
    You can lead some folks to knowledge, but you can not make them think.
    The average person thinks he's above average!
    For most folks, they don't know, what they don't know.
    Good judgement comes from experience. Experience comes from bad judgement.

  3. #3
    Join Date
    Aug 2003
    Location
    Where the Surf Meets the Turf @Del Mar, CA
    Posts
    7,776
    Provided Answers: 1
    bcm@bcm-laptop:~$ cat .bash_profile
    EDITOR=vi
    LD_LIBRARY_PATH=/usr/lib:/usr/lib32
    ORACLE_HOME=/u01/app/oracle/product/11.2.0/dbhome_1
    OH=$ORACLE_HOME
    ORACLE_BASE=/u01/app/oracle
    ORACLE_SID=v112
    PATH=$ORACLE_HOME/bin:$PATH:$HOME/android-sdks/tools:$HOME/android-sdks/platform-tools
    export EDITOR LD_LIBRARY_PATH ORACLE_HOME OH ORACLE_SID PATH ORACLE_BASE

    bcm@bcm-laptop:~$
    You can lead some folks to knowledge, but you can not make them think.
    The average person thinks he's above average!
    For most folks, they don't know, what they don't know.
    Good judgement comes from experience. Experience comes from bad judgement.

  4. #4
    Join Date
    Oct 2010
    Location
    Orlando, FL
    Posts
    311
    Provided Answers: 1
    Thank you all. Your instructions were detailed but I'm guessing you're both suggesting that I use a text editor like VIM or something and manually edit the existing /home/oracle/.bash_profile entry with the following lines, correct?

  5. #5
    Join Date
    Aug 2003
    Location
    Where the Surf Meets the Turf @Del Mar, CA
    Posts
    7,776
    Provided Answers: 1
    > manually edit the existing /home/oracle/.bash_profile entry with the following lines, correct?
    yes
    You can lead some folks to knowledge, but you can not make them think.
    The average person thinks he's above average!
    For most folks, they don't know, what they don't know.
    Good judgement comes from experience. Experience comes from bad judgement.

  6. #6
    Join Date
    Oct 2010
    Location
    Orlando, FL
    Posts
    311
    Provided Answers: 1
    Thanks. That would have been super easy to note in any part of their documentation rather than telling everyone to simply export their env. This is just a one time session from bash (or whatever you're using) and for someone who is extremely green, it's frustrating to omit something so simple.

    Thanks for the info!

  7. #7
    Join Date
    Oct 2010
    Location
    Orlando, FL
    Posts
    311
    Provided Answers: 1
    So just to make sure I didn't dork this up, my .bash_profile for my oracle user looks as follows:

    Code:
    # .bash_profile
    
    # Get the aliases and functions
    if [ -f ~/.bashrc ]; then
            . ~/.bashrc
    fi
    
    # User specific environment and startup programs
    
    $ORACLE_BASE=/oracle/u01/app/oracle
    $ORACLE_SID=zoo
    $ORACLE_HOME=/oracle/u01/app/oracle/product/11.2.0/db1/
    $PATH=$ORACLE_HOME/bin
    $ export ORACLE_BASE ORACLE_SID ORACLE_HOME PATH
    PATH=$PATH:$HOME/bin

  8. #8
    Join Date
    Oct 2010
    Location
    Orlando, FL
    Posts
    311
    Provided Answers: 1
    So when the following parameters are entered into my /home/oracle/.bash_profile & then logged in, I got a lot of strange errors in Bash. When I put the same I posted above in /home/oracle/.bashrc, I then cleared the errors and all my environment variables were staticly saved. So I put this in .bashrc rather than .bash_profile:

    Code:
    # .bashrc
    
    # Source global definitions
    if [ -f /etc/bashrc ]; then
    	. /etc/bashrc
    fi
    
    # User specific aliases and functions
    ORACLE_BASE=/oracle/u01/app/oracle
    ORACLE_HOME=$ORACLE_BASE/product/11.2.0/db1
    ORACLE_SID=zoo
    LD_LIBRARY_PATH=$LD_LIBRARY_PATH:$ORACLE_HOME/lib
    PATH=$PATH:$ORACLE_HOME/bin
    
    export ORACLE_BASE ORACLE_HOME ORACLE_SID LD_LIBRARY_PATH
    Can anyone please comment on if what I did was OK? Oracle doesn't really document how someone should or commonly would configure the enviornment variables. They simply show you how to export it temporarily for proof of function and nothing more.

    Thanks for helping this noob out.

  9. #9
    Join Date
    Aug 2003
    Location
    Where the Surf Meets the Turf @Del Mar, CA
    Posts
    7,776
    Provided Answers: 1
    >When I put the same I posted above in /home/oracle/.bashrc, I then cleared the errors

    The issue is not between file names, but actual file content.
    Both ORACLE_HOME & PATH values are different between the two files.
    It is the line differences which caused the errors; not the file name.

    Oracle assumed the reader had basic OS knowledge which include how to establish OS environmental variables.

    in principal what is difference between .bash_profile & .bashrc?
    in other words, when does each get invoked?
    You can lead some folks to knowledge, but you can not make them think.
    The average person thinks he's above average!
    For most folks, they don't know, what they don't know.
    Good judgement comes from experience. Experience comes from bad judgement.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •