.profile file on each terminal

Hello All,

I create an oracle user, on my Solaris OS.
i modified my .profile file on the oracle home.
the problem that each time i want my variables to work, ORACLE_HOME, ORACLE_BASE ...
i have to run the .profile file (. ./.profile) and each time i exit the terminal i have to run again so my environment variables take place.

How can i save the settings?

Regards,

you have an " exit " command in your .profile ??

below is my .profile file.

#ident    "@(#)profile    1.19    01/03/13 SMI"    /* SVr4.0 1.3    */

# The profile that all logins get before using their own .profile.

trap ""  2 3
export LOGNAME PATH

if [ "$TERM" = "" ]
then
    if /bin/i386
    then
        TERM=sun-color
    else
        TERM=sun
    fi
    export TERM
fi


ORACLE_BASE=/data/oracle/ora11g
ORACLE_HOME=/data/oracle/ora11g/product/11.2.0/dbhome_1
ORACLE_DOC=${ORACLE_HOME}/doc
ORA_NLS33=${ORACLE_HOME}/ocommon/nls/admin/data
PATH=$PATH:${ORACLE_HOME}/bin:/usr/ccs/bin:/usr/bin:/usr/sbin:/etc:/usr/lbin:/usr/openwin/bin:/usr/ucb:/sbin
export ORACLE_BASE
export ORACLE_HOME
export ORACLE_DOC
export ORA_NLS33
export PATH
LD_LIBRARY_PATH=/data/oracle/ora11g/product/11.2.0/dbhome_1/lib32
export LD_LIBRARY_PATH
LIBPATH=/data/oracle/ora11g/product/11.2.0/dbhome_1/lib32
export LIBPATH


#    Login and -su shells get /etc/profile services.
#    -rsh is given its environment in its .profile.

case "$0" in
-sh | -ksh | -jsh | -bash)

    if [ ! -f .hushlogin ]
    then
        /usr/sbin/quota
        #    Allow the user to break the Message-Of-The-Day only.
        trap "trap '' 2"  2
        /bin/cat -s /etc/motd
        trap "" 2

        /bin/mail -E
        case $? in
        0) 
            echo "You have new mail."
              ;;
        2) 
            echo "You have mail."
               ;;
        esac
    fi
esac

umask 022
trap  2 3

don't you miss a ;; between the 2 lines :

fi
esac

i copied the file from /etc
and just i add it the ORACLE part to it

Not sure about that, but maybe if the /etc/profile is found it is executed and the other .profile are not.

  1. What shell are you using?
  2. When you exit the terminal are you still logged in as oracle user? Do you log out at all?

The .profile file is only read at login. If you don't log out it won't be read automatically.

If you are using bash it may not read the .profile file at all, especially if you have a .bash_profile file.

Andrew

I would suggest dropping the .profile in oracle's home directory and starting again. Generally speaking, /etc/profile should be relatively simple. I have come across too many systems where /etc/profile has been used to code up all sorts of wonderful things that make sense to one person and cause a nightmare elsewhere. The way we get around that is to add the following code ONLY to the default /etc/profile:-

if [ -r /usr/loca/bin/`id -gn`.startup ]
then
   . /usr/local/bin/`id -gn`.startup
fi

Basically it determines if there is a startup file for your primary group and you can use that to set some general things for that group there. You can also then add in a few lines to a personal .profile, such as:-

#!/bin/ksh
set -o vi
umask 002

ORACLE_BASE=/data/oracle/ora11g
ORACLE_HOME=${ORACLE_BASE}/product/11.2.0/dbhome_1
ORACLE_DOC=${ORACLE_HOME}/doc
ORA_NLS33=${ORACLE_HOME}/ocommon/nls/admin/data

PATH=$PATH:${ORACLE_HOME}/bin:/usr/ccs/bin:/usr/bin:/usr/sbin:/etc:/usr/lbin:/usr/openwin/bin:/usr/ucb:/sbin
LIBPATH=${ORACLE_HOME}/lib32

export PATH ORACLE_BASE ORACLE_HOME ORACLE_DOC ORA_NLS33 LIBPATH LD_LIBRARY_PATH=$LIBPATH

Does this help at all? If it runs through normally, then each login (assuming you are using ksh (or a varient that also reads the .profile) should get it all set up. It might be worth putting in a quick echo "Hello!" somewhere in .profile to make sure it really is being called at all.

It's always better to enable segragation of environments with relative variable names rather that have to some how unpick it all later. I'm having that trouble myself with an inherited set of Cobol applications all on the one server with the "Development/Production support/Test/DR/anything else" environement all blended on the other server. We onely have the two HP-UX server, so we're a bit limited on how to split them up for a Cobol & Informix upgrade project, especially as the software is not used together and we want to separate the upgrades to production. :wall:

Robin
Liverpool/Blackburn
UK