9 Replies Latest reply: Jul 13, 2013 9:57 AM by Dude! RSS

    message upon switching to a  particular user

    NickRobheart

      Hi

      I recently installed Oracle 10g version on Oracle Virtual box with platform being OEL 5.5.

      I created user named oracle where the database is created in it and when I switch from root user to oracle user using the command su -  oracle

      It gives message as -bash: i# command not found but it will connect anyway and I can work on the database fine.

      This doesn't happen when i switch back to root user though. Is it some sort of error in installation ?

       

      I have used the .bash_profile as

      export ORACLE_HOME=/u01/app/oracle/product/11.2.0/dbhome_1

      export PATH=$ORACLE_HOME/bin:$PATH:.

      export ORACLE_SID=orcl

      export CLASS_PATH=$ORACLE_HOME/jlib

      export LD_LIBRARY_PATH=$ORACLE_HOME/lib

       

      and saved it and execution was also successful.

      Then why was this message showing upon switching to oracle user?

      Any ideas?

       

       

      Thanks

      Nick

        • 1. Re: message upon switching to a  particular user
          EdStevens

          NickRobheart wrote:

           

          Hi

          I recently installed Oracle 10g version on Oracle Virtual box with platform being OEL 5.5.

          I created user named oracle where the database is created in it and when I switch from root user to oracle user using the command su -  oracle

          It gives message as -bash: i# command not found but it will connect anyway and I can work on the database fine.

          This doesn't happen when i switch back to root user though. Is it some sort of error in installation ?

           

          I have used the .bash_profile as

          export ORACLE_HOME=/u01/app/oracle/product/11.2.0/dbhome_1

          export PATH=$ORACLE_HOME/bin:$PATH:.

          export ORACLE_SID=orcl

          export CLASS_PATH=$ORACLE_HOME/jlib

          export LD_LIBRARY_PATH=$ORACLE_HOME/lib

           

          and saved it and execution was also successful.

          Then why was this message showing upon switching to oracle user?

          Any ideas?

           

           

          Thanks

          Nick

          What happens if you -- as you really, really should -- log on directly as oracle instead of logging on first as root then 'su' to oracle?

          the error message occurs because you have a command in your (oracle's) .bash_profile that is not in the PATH.  Are those export commands the only thing in oracle's .bash_profile?  How about .bash_rc?

          • 2. Re: message upon switching to a  particular user
            NickRobheart

            EdStevens wrote:

             

            NickRobheart wrote:

             

            Hi

            I recently installed Oracle 10g version on Oracle Virtual box with platform being OEL 5.5.

            I created user named oracle where the database is created in it and when I switch from root user to oracle user using the command su -  oracle

            It gives message as -bash: i# command not found but it will connect anyway and I can work on the database fine.

            This doesn't happen when i switch back to root user though. Is it some sort of error in installation ?

             

            I have used the .bash_profile as

            export ORACLE_HOME=/u01/app/oracle/product/11.2.0/dbhome_1

            export PATH=$ORACLE_HOME/bin:$PATH:.

            export ORACLE_SID=orcl

            export CLASS_PATH=$ORACLE_HOME/jlib

            export LD_LIBRARY_PATH=$ORACLE_HOME/lib

             

            and saved it and execution was also successful.

            Then why was this message showing upon switching to oracle user?

            Any ideas?

             

             

            Thanks

            Nick

            What happens if you -- as you really, really should -- log on directly as oracle instead of logging on first as root then 'su' to oracle?

            the error message occurs because you have a command in your (oracle's) .bash_profile that is not in the PATH.  Are those export commands the only thing in oracle's .bash_profile?  How about .bash_rc?

            That I haven't tried because this message only occurs when Im logging in through TUI interface and I'm sure it will give no error as such when I log in directly into the OS using GUI interface.

            I wouldn't also say that its an error msg. Just a message that shows and anyhow it connects. Yes, those are the only export commands and I haven't created or saved any .bash_rc file .

            • 3. Re: message upon switching to a  particular user
              EdStevens

              NickRobheart wrote:

               

              EdStevens wrote:

               

              NickRobheart wrote:

               

              Hi

              I recently installed Oracle 10g version on Oracle Virtual box with platform being OEL 5.5.

              I created user named oracle where the database is created in it and when I switch from root user to oracle user using the command su -  oracle

              It gives message as -bash: i# command not found but it will connect anyway and I can work on the database fine.

              This doesn't happen when i switch back to root user though. Is it some sort of error in installation ?

               

              I have used the .bash_profile as

              export ORACLE_HOME=/u01/app/oracle/product/11.2.0/dbhome_1

              export PATH=$ORACLE_HOME/bin:$PATH:.

              export ORACLE_SID=orcl

              export CLASS_PATH=$ORACLE_HOME/jlib

              export LD_LIBRARY_PATH=$ORACLE_HOME/lib

               

              and saved it and execution was also successful.

              Then why was this message showing upon switching to oracle user?

              Any ideas?

               

               

              Thanks

              Nick

              What happens if you -- as you really, really should -- log on directly as oracle instead of logging on first as root then 'su' to oracle?

              the error message occurs because you have a command in your (oracle's) .bash_profile that is not in the PATH.  Are those export commands the only thing in oracle's .bash_profile?  How about .bash_rc?

              That I haven't tried because this message only occurs when Im logging in through TUI interface

               

              What is a TUI?  Terminal User Interface?   Never heard the term. 

               

              and I'm sure it will give no error as such when I log in directly into the OS using GUI interface.

              You're sure because you tried it, or because you just assumed?

               

              Personally, I don't use a GUI to deal with my Linux servers, real or virtual.

               

              I wouldn't also say that its an error msg. Just a message that shows and anyhow it connects.

              But it is an error message.  It's just not an error that is fatal to your ability to connect.

              And very clearly, one of the scripts that is being executed as part of your log on contains a command that is not found in the PATH that is active at the time said command is being processed.

               

               

              Yes, those are the only export commands and I haven't created or saved any .bash_rc file .

              Ok, maybe YOU haven't created or saved one, but that doesn't mean there isn't one.  What to you get from "ls -la /home/oracle".

               

              And there are also some scripts that are processed before your .bash_rc and .bash_profile

               

              But we are clearly off-topic for this forum  The question has everything to do with linux basics and zero to do with installing Oracle products.

              • 4. Re: message upon switching to a  particular user
                NickRobheart

                I don't have the access right now so I have assumed that it wouldn't do it in GUI. I'll go and try and let you know with the .bash_rc file .

                Well, you could say its more or less off track for this forum but I haven't seen people being active on Linux forums compared to here so wanted to post and get my answers quickly

                 

                I do have another question here with in regards to creating of listener file. I have created a listener.ora file in $ORACLE_HOME/network/admin folder  using netca (Network configuration assistant).

                Also created tnsnames.ora file by specifying the net service name as orcl and then it was successful with the status, reload and start and files were also seen physically.

                My question is, along with those files tnsnames.ora and listener.ora there are another 2 files which got created namely listener$1252445614.bak and tnsnames$545146843.bak

                Is this supposed to happen. I'm not sure what are files with extension .bak mean by the way?

                • 5. Re: message upon switching to a  particular user
                  EdStevens

                  NickRobheart wrote:

                   

                  I don't have the access right now so I have assumed that it wouldn't do it in GUI. I'll go and try and let you know with the .bash_rc file .

                  Well, you could say its more or less off track for this forum but I haven't seen people being active on Linux forums compared to here so wanted to post and get my answers quickly

                   

                  I do have another question here with in regards to creating of listener file. I have created a listener.ora file in $ORACLE_HOME/network/admin folder  using netca (Network configuration assistant).

                  Also created tnsnames.ora file by specifying the net service name as orcl and then it was successful with the status, reload and start and files were also seen physically.

                  My question is, along with those files tnsnames.ora and listener.ora there are another 2 files which got created namely listener$1252445614.bak and tnsnames$545146843.bak

                  Is this supposed to happen. I'm not sure what are files with extension .bak mean by the way?

                  Uh, usually when a file appears with an extension of '.bak', it was created as a 'backup' of a previous version of that file ...

                  And for sure, netca creates a backup of any files it is modifying.

                   

                  Which Linux forums have you been 'watching'?  The ones at OTN seem to be not getting much traffic since the conversion, but there is a whole world of linux support forums outside of OTN.  I get good help at http://www.unix.com/

                  • 6. Re: message upon switching to a  particular user
                    Dude!

                    I would try the following:

                     

                    # su - oracle

                    $ bash -lx

                     

                    Then check the output to see where the error message occurs.

                    • 7. Re: message upon switching to a  particular user
                      NickRobheart

                      Dude wrote:

                       

                      I would try the following:

                       

                      # su - oracle

                      $ bash -lx

                       

                      Then check the output to see where the error message occurs.

                      The out put as follows

                       

                      -x /usr/bin/id ']'

                      + '[' 54321 = 0 ']'

                      + ulimit -S -c 0

                      + '[' -x /usr/bin/id ']'

                      ++ id -un

                      + USER=oracle

                      + LOGNAME=oracle

                      + MAIL=/var/spool/mail/oracle

                      ++ /bin/hostname

                      + HOSTNAME=localhost.localdomain

                      + HISTSIZE=1000

                      + '[' -z /etc/inputrc -a '!' -f /home/oracle/.inputrc ']'

                      + export PATH USER LOGNAME MAIL HOSTNAME HISTSIZE INPUTRC

                      + for i in '/etc/profile.d/*.sh'

                      + '[' -r /etc/profile.d/colorls.sh ']'

                      + '[' '\s-\v\$ ' ']'

                      + . /etc/profile.d/colorls.sh

                      ++ alias 'll=ls -l'

                      ++ alias 'l.=ls -d .*'

                      ++ COLORS=/etc/DIR_COLORS

                      ++ '[' -e /etc/DIR_COLORS.xterm ']'

                      ++ COLORS=/etc/DIR_COLORS.xterm

                      ++ '[' -e /home/oracle/.dircolors ']'

                      ++ '[' -e /home/oracle/.dir_colors ']'

                      ++ '[' -e /home/oracle/.dircolors.xterm ']'

                      ++ '[' -e /home/oracle/.dir_colors.xterm ']'

                      ++ '[' -e /etc/DIR_COLORS.xterm ']'

                      +++ dircolors --sh /etc/DIR_COLORS.xterm

                      ++ eval 'LS_COLORS='\''no=00:fi=00:di=00;34:ln=00;36:pi=40;33:so=00;35:bd=40;33;01:cd=40;33;01:or=01;05;37;41:mi=01;05;37;41:ex=00;32:*.cmd=00;32:*.exe=00;32:*.com=00;32:*.btm=00;32:*.bat=00;32:*.sh=00;32:*.csh=00;32:*.tar=00;31:*.tgz=00;31:*.arj=00;31:*.taz=00;31:*.lzh=00;31:*.zip=00;31:*.z=00;31:*.Z=00;31:*.gz=00;31:*.bz2=00;31:*.bz=00;31:*.tz=00;31:*.rpm=00;31:*.cpio=00;31:*.jpg=00;35:*.gif=00;35:*.bmp=00;35:*.xbm=00;35:*.xpm=00;35:*.png=00;35:*.tif=00;35:'\'';' export LS_COLORS

                      +++ LS_COLORS='no=00:fi=00:di=00;34:ln=00;36:pi=40;33:so=00;35:bd=40;33;01:cd=40;33;01:or=01;05;37;41:mi=01;05;37;41:ex=00;32:*.cmd=00;32:*.exe=00;32:*.com=00;32:*.btm=00;32:*.bat=00;32:*.sh=00;32:*.csh=00;32:*.tar=00;31:*.tgz=00;31:*.arj=00;31:*.taz=00;31:*.lzh=00;31:*.zip=00;31:*.z=00;31:*.Z=00;31:*.gz=00;31:*.bz2=00;31:*.bz=00;31:*.tz=00;31:*.rpm=00;31:*.cpio=00;31:*.jpg=00;35:*.gif=00;35:*.bmp=00;35:*.xbm=00;35:*.xpm=00;35:*.png=00;35:*.tif=00;35:'

                      +++ export LS_COLORS

                      ++ '[' -z 'no=00:fi=00:di=00;34:ln=00;36:pi=40;33:so=00;35:bd=40;33;01:cd=40;33;01:or=01;05;37;41:mi=01;05;37;41:ex=00;32:*.cmd=00;32:*.exe=00;32:*.com=00;32:*.btm=00;32:*.bat=00;32:*.sh=00;32:*.csh=00;32:*.tar=00;31:*.tgz=00;31:*.arj=00;31:*.taz=00;31:*.lzh=00;31:*.zip=00;31:*.z=00;31:*.Z=00;31:*.gz=00;31:*.bz2=00;31:*.bz=00;31:*.tz=00;31:*.rpm=00;31:*.cpio=00;31:*.jpg=00;35:*.gif=00;35:*.bmp=00;35:*.xbm=00;35:*.xpm=00;35:*.png=00;35:*.tif=00;35:' ']'

                      ++ egrep -qi '^COLOR.*none' /etc/DIR_COLORS.xterm

                      ++ alias 'll=ls -l --color=tty'

                      ++ alias 'l.=ls -d .* --color=tty'

                      ++ alias 'ls=ls --color=tty'

                      + for i in '/etc/profile.d/*.sh'

                      + '[' -r /etc/profile.d/cvs.sh ']'

                      + '[' '\s-\v\$ ' ']'

                      + . /etc/profile.d/cvs.sh

                      ++ export CVS_RSH=ssh

                      ++ CVS_RSH=ssh

                      + for i in '/etc/profile.d/*.sh'

                      + '[' -r /etc/profile.d/glib2.sh ']'

                      + '[' '\s-\v\$ ' ']'

                      + . /etc/profile.d/glib2.sh

                      ++ export G_BROKEN_FILENAMES=1

                      ++ G_BROKEN_FILENAMES=1

                      + for i in '/etc/profile.d/*.sh'

                      + '[' -r /etc/profile.d/gnome-ssh-askpass.sh ']'

                      + '[' '\s-\v\$ ' ']'

                      + . /etc/profile.d/gnome-ssh-askpass.sh

                      ++ SSH_ASKPASS=/usr/libexec/openssh/gnome-ssh-askpass

                      ++ export SSH_ASKPASS

                      + for i in '/etc/profile.d/*.sh'

                      + '[' -r /etc/profile.d/kde.sh ']'

                      + '[' '\s-\v\$ ' ']'

                      + . /etc/profile.d/kde.sh

                      ++ '[' -f /etc/sysconfig/prelink ']'

                      ++ . /etc/sysconfig/prelink

                      +++ PRELINKING=yes

                      +++ PRELINK_OPTS=-mR

                      +++ PRELINK_FULL_TIME_INTERVAL=14

                      +++ PRELINK_NONRPM_CHECK_INTERVAL=7

                      ++ '[' yes = yes ']'

                      ++ '[' -z 1 ']'

                      ++ '[' -z 1 ']'

                      ++ export KDE_NO_IPV6

                      ++ '[' -z /usr ']'

                      ++ export KDEDIR

                      + for i in '/etc/profile.d/*.sh'

                      + '[' -r /etc/profile.d/krb5-devel.sh ']'

                      + '[' '\s-\v\$ ' ']'

                      + . /etc/profile.d/krb5-devel.sh

                      ++ echo /u01/app/oracle/product/11.2.0/dbhome_1/bin:/usr/kerberos/bin:/usr/local/bin:/bin:/usr/bin:.

                      ++ /bin/grep -q /usr/kerberos/bin

                      ++ echo /u01/app/oracle/product/11.2.0/dbhome_1/bin:/usr/kerberos/bin:/usr/local/bin:/bin:/usr/bin:.

                      ++ /bin/grep -q /usr/kerberos/sbin

                      +++ /usr/bin/id -u

                      ++ '[' 54321 = 0 ']'

                      + for i in '/etc/profile.d/*.sh'

                      + '[' -r /etc/profile.d/krb5-workstation.sh ']'

                      + '[' '\s-\v\$ ' ']'

                      + . /etc/profile.d/krb5-workstation.sh

                      ++ echo /u01/app/oracle/product/11.2.0/dbhome_1/bin:/usr/kerberos/bin:/usr/local/bin:/bin:/usr/bin:.

                      ++ /bin/grep -q /usr/kerberos/bin

                      ++ echo /u01/app/oracle/product/11.2.0/dbhome_1/bin:/usr/kerberos/bin:/usr/local/bin:/bin:/usr/bin:.

                      ++ /bin/grep -q /usr/kerberos/sbin

                      +++ /usr/bin/id -u

                      ++ '[' 54321 = 0 ']'

                      + for i in '/etc/profile.d/*.sh'

                      + '[' -r /etc/profile.d/lang.sh ']'

                      + '[' '\s-\v\$ ' ']'

                      + . /etc/profile.d/lang.sh

                      ++ sourced=0

                      ++ for langfile in /etc/sysconfig/i18n '$HOME/.i18n'

                      ++ '[' -f /etc/sysconfig/i18n ']'

                      ++ . /etc/sysconfig/i18n

                      +++ LANG=en_US.UTF-8

                      +++ SYSFONT=latarcyrheb-sun16

                      ++ sourced=1

                      ++ for langfile in /etc/sysconfig/i18n '$HOME/.i18n'

                      ++ '[' -f /home/oracle/.i18n ']'

                      ++ '[' -n '' ']'

                      ++ '[' 1 = 1 ']'

                      ++ '[' -n en_US.UTF-8 ']'

                      ++ export LANG

                      ++ '[' -n '' ']'

                      ++ unset LC_ADDRESS

                      ++ '[' -n '' ']'

                      ++ unset LC_CTYPE

                      ++ '[' -n '' ']'

                      ++ unset LC_COLLATE

                      ++ '[' -n '' ']'

                      ++ unset LC_IDENTIFICATION

                      ++ '[' -n '' ']'

                      ++ unset LC_MEASUREMENT

                      ++ '[' -n '' ']'

                      ++ unset LC_MESSAGES

                      ++ '[' -n '' ']'

                      ++ unset LC_MONETARY

                      ++ '[' -n '' ']'

                      ++ unset LC_NAME

                      ++ '[' -n '' ']'

                      ++ unset LC_NUMERIC

                      ++ '[' -n '' ']'

                      ++ unset LC_PAPER

                      ++ '[' -n '' ']'

                      ++ unset LC_TELEPHONE

                      ++ '[' -n '' ']'

                      ++ unset LC_TIME

                      ++ '[' -n '' ']'

                      ++ unset LC_ALL

                      ++ '[' -n '' ']'

                      ++ unset LANGUAGE

                      ++ '[' -n '' ']'

                      ++ unset LINGUAS

                      ++ '[' -n '' ']'

                      ++ unset _XKB_CHARSET

                      ++ consoletype=

                      ++ '[' -z '' ']'

                      +++ /sbin/consoletype stdout

                      ++ consoletype=pty

                      ++ '[' -n '' ']'

                      ++ '[' -n '' ']'

                      ++ '[' -n en_US.UTF-8 ']'

                      ++ case $LANG in

                      ++ '[' xterm = linux ']'

                      ++ unset SYSFONTACM SYSFONT

                      ++ unset sourced

                      ++ unset langfile

                      + for i in '/etc/profile.d/*.sh'

                      + '[' -r /etc/profile.d/less.sh ']'

                      + '[' '\s-\v\$ ' ']'

                      + . /etc/profile.d/less.sh

                      ++ '[' -x /usr/bin/lesspipe.sh ']'

                      ++ export 'LESSOPEN=|/usr/bin/lesspipe.sh %s'

                      ++ LESSOPEN='|/usr/bin/lesspipe.sh %s'

                      + for i in '/etc/profile.d/*.sh'

                      + '[' -r /etc/profile.d/mc.sh ']'

                      + '[' '\s-\v\$ ' ']'

                      + . /etc/profile.d/mc.sh

                      ++ alias 'mc=. /usr/share/mc/bin/mc-wrapper.sh'

                      + for i in '/etc/profile.d/*.sh'

                      + '[' -r /etc/profile.d/mpi-selector.sh ']'

                      + '[' '\s-\v\$ ' ']'

                      + . /etc/profile.d/mpi-selector.sh

                      ++ mpi_selector_dir=/var/lib/mpi-selector/data

                      ++ mpi_selector_homefile=/home/oracle/.mpi-selector

                      ++ mpi_selector_sysfile=/etc/sysconfig/mpi-selector

                      ++ mpi_selection=

                      ++ test -f /home/oracle/.mpi-selector

                      ++ test -f /etc/sysconfig/mpi-selector

                      ++ test '' '!=' '' -a -f /var/lib/mpi-selector/data/.sh

                      + for i in '/etc/profile.d/*.sh'

                      + '[' -r /etc/profile.d/vim.sh ']'

                      + '[' '\s-\v\$ ' ']'

                      + . /etc/profile.d/vim.sh

                      ++ '[' -n '3.2.25(1)-release' -o -n '' -o -n '' ']'

                      ++ '[' -x /usr/bin/id ']'

                      +++ /usr/bin/id -u

                      ++ tmpid=54321

                      ++ '[' 54321 = '' ']'

                      ++ '[' 54321 -le 100 ']'

                      ++ alias vi

                      ++ alias vi=vim

                      + for i in '/etc/profile.d/*.sh'

                      + '[' -r /etc/profile.d/which-2.sh ']'

                      + '[' '\s-\v\$ ' ']'

                      + . /etc/profile.d/which-2.sh

                      ++ alias 'which=alias | /usr/bin/which --tty-only --read-alias --show-dot --show-tilde'

                      + unset i

                      + unset pathmunge

                      + i# .bash_profile

                      bash: i#: command not found

                      + '[' -f /home/oracle/.bashrc ']'

                      + . /home/oracle/.bashrc

                      ++ '[' -f /etc/bashrc ']'

                      ++ . /etc/bashrc

                      +++ '[' 54321 -gt 99 ']'

                      ++++ id -gn

                      ++++ id -un

                      +++ '[' oinstall = oracle ']'

                      +++ umask 022

                      +++ '[' '\s-\v\$ ' ']'

                      +++ case $TERM in

                      +++ '[' -e /etc/sysconfig/bash-prompt-xterm ']'

                      +++ PROMPT_COMMAND='echo -ne "\033]0;${USER}@${HOSTNAME%%.*}:${PWD/#$HOME/~}"; echo -ne "\007"'

                      +++ shopt -s checkwinsize

                      +++ '[' '\s-\v\$ ' = '\s-\v\$ ' ']'

                      +++ PS1='[\u@\h \W]\$ '

                      +++ shopt -q login_shell

                      + export ORACLE_HOME=/u01/app/oracle/product/11.2.0

                      + ORACLE_HOME=/u01/app/oracle/product/11.2.0

                      + export ORACLE_HOME=/u01/app/oracle/product/11.2.0/dbhome_1

                      + ORACLE_HOME=/u01/app/oracle/product/11.2.0/dbhome_1

                      + export PATH=/u01/app/oracle/product/11.2.0/dbhome_1/bin:/u01/app/oracle/product/11.2.0/dbhome_1/bin:/usr/kerberos/bin:/usr/local/bin:/bin:/usr/bin:.:.

                      + PATH=/u01/app/oracle/product/11.2.0/dbhome_1/bin:/u01/app/oracle/product/11.2.0/dbhome_1/bin:/usr/kerberos/bin:/usr/local/bin:/bin:/usr/bin:.:.

                      + export ORACLE_SID=orcl

                      + ORACLE_SID=orcl

                      + export CLASS_PATH=/u01/app/oracle/product/11.2.0/dbhome_1/jlib

                      + CLASS_PATH=/u01/app/oracle/product/11.2.0/dbhome_1/jlib

                      + export SD_LIBRARY_PATH=/u01/app/oracle/product/11.2.0/dbhome_1/lib

                      + SD_LIBRARY_PATH=/u01/app/oracle/product/11.2.0/dbhome_1/lib

                      ++ echo -ne '\033]0;oracle@localhost:~

                       

                       

                       

                      I don't see any error in the output. Reply me If im wrong.

                       

                      • 8. Re: message upon switching to a  particular user
                        Dude!

                        Yes, it's there:

                         

                        + i# .bash_profile

                        bash: i#: command not found

                         

                        It looks like an "i" that was added to a comment line (#), probably by mistake when using the vi editor and pressing "i" to insert text. I'm not sure which file it is, but you might want to check your .bash_profile file, probably the top line to see if there was an "i" inserted by accident.

                        • 9. Re: message upon switching to a  particular user
                          Dude!

                          Btw, I would not set the Oracle environment in the bash login profile. Oracle under Unlix/Linux, unlike Windows provides a special procedure that asks for the Oracle SID and sets the Oracle environment accordingly:

                           

                          . oraenv

                           

                          It will prompt for oracle SID.

                           

                          Note the space after the dot, which is necessary to source execute the procedure, so the command in the script execute in the current shell and not sub shell, which would loose all information upon exit. You can also use it without prompting:

                           

                          ORACLE_SID='orcl'

                          ORAENV_ASK=NO

                          . oraenv -s

                           

                          It's especially useful when scripting Oracle SQL script in Cron. For example:

                           

                          #!/bin/sh

                          # Filename: /home/oracle/scripts/sqlplus_sample.sh

                          # Author: dude

                          PATH=/usr/local/bin:$PATH

                          export $PATH

                           

                          ORACLE_SID='orcl'

                          ORAENV_ASK=NO

                          . oraenv -s

                          #

                          oradate=`sqlplus -s /nolog <<-EOF

                            set pages 0 feed off

                            connect / as sysdba

                            select sysdate from dual;

                          exit

                          EOF

                          `

                          echo"`date`: Oracle $oradate" >> /tmp/sqlplus_sample.output