3 Replies Latest reply: Nov 20, 2012 2:08 PM by Catch_22 RSS

    Help Set Oracle Users Env

    895327
      I have Oracle Linux 6.3 running and created an 'oracle' user who is the owner of the Oracle Database 11g R2 software installed on this particular server. I am unable to get this particular 'oracle' users path to include the binaries for commonly used scripts for the database software. For example, the Oracle user should be able to call out 'sqlplus' utility at anytime but it's not in the path for some reason. I've tried adding it to the .bash_profile but for some reason it wont see it. The path I'm trying to import to my environment is:

      $ORACLE_HOME/bin

      or

      /u01/app/oracle/product/11.2/db1/bin

      Can someone please explain to me how I can add this into my .bash_profile (I am using Bash) for my 'oracle' user? Below is what I see when I type 'env' command as well as the .bash_profile file:
      [oracle@zombie ~]$ env
      HOSTNAME=zombie.ideorlando.org
      TERM=xterm
      SHELL=/bin/bash
      HISTSIZE=1000
      SSH_CLIENT=10.1.10.204 58344 22
      SSH_TTY=/dev/pts/0
      USER=oracle
      ORACLE_SID=ide
      ORACLE_BASE=/u01/app/oracle
      PATH=/usr/local/bin:/bin:/usr/bin:/usr/local/sbin:/usr/sbin:/sbin:/bin
      PWD=/home/oracle
      LANG=en_US.UTF-8
      HISTCONTROL=ignoredups
      SHLVL=1
      HOME=/home/oracle
      LOGNAME=oracle
      LESSOPEN=|/usr/bin/lesspipe.sh %s
      ORACLE_HOME=/u01/app/oracle/product/11.2/db1
      G_BROKEN_FILENAMES=1
      _=/bin/env
      # .bash_profile
      
      # Get the aliases and functions
      if [ -f ~/.bashrc ]; then
              . ~/.bashrc
      fi
      
      # User specific environment and startup programs
      
      PATH=/u01/app/oracle/product/11.2/db1/bin
      ORACLE_BASE=/u01/app/oracle
      ORACLE_HOME=$ORACLE_BASE/product/11.2/db1
      ORACLE_SID=ide
      
      export PATH ORACLE_BASE ORACLE_HOME ORACLE_SID
        • 1. Re: Help Set Oracle Users Env
          898553
          What happens if you type 'export PATH=$PATH:/u01/app/oracle/product/11.2/db1/bin' and then echo $PATH?
          • 2. Re: Help Set Oracle Users Env
            895327
            theanswriz42 wrote:
            What happens if you type 'export PATH=$PATH:/u01/app/oracle/product/11.2/db1/bin' and then echo $PATH?
            [oracle@zombie ~]$ whoami
            oracle
            [oracle@zombie ~]$ export PATH=$PATH:/u01/app/oracle/product/11.2/db1/bin
            [oracle@zombie ~]$ echo $PATH
            /usr/local/bin:/bin:/usr/bin:/usr/local/sbin:/usr/sbin:/sbin:/bin:/u01/app/oracle/product/11.2/db1/bin
            • 3. Re: Help Set Oracle Users Env
              Catch_22
              The problem is that ORACLE_HOME/bin is not in your PATH environment, which the OS uses to find applications. So after you defined ORACLE_HOME, use export PATH=$ORACLE_HOME/bin:$PATH

              Oracle under Unix provides the "oraenv" utility, which exists at least since Oracle 8i. It is by default installed in /usr/local/bin.

              The utility will scan your /etc/oratab and set up the appropriate Oracle environment. You can use it in interactive and non-interactive mode. Note that you need to source execute the script. For instance:

              <pre>
              . oraenv
              </pre>
              Then follow the screen

              Or interactive in startup provile or crontask:
              <pre>
              ORACLE_SID=orcl
              ORAENV_ASK=NO
              . oraenv -s
              </pre>