New Oracle Home

How do I set ORACLE_HOME location?

When I type echo $$ORACLE_HOME it gives me

/u01/app/oracle//product/10.2.0/dbhome_1

which has been deleted.
I just installed Oracle 11g and this is supposed to be a new oracle home

/u01/app/oracle/product/11.2.0/dbhome_1

Any help from the community will be highly appreciated.

set PATH="/u01/app/oracle/product/11.2.0/dbhome_1"

If you have access, set it in /etc/profile
Else, set it in your .profile / .bashrc file

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

Well I did what I was told but same thing
echo $ORACLE_HOME gives me the same location.

---------- Post updated at 12:05 PM ---------- Previous update was at 12:03 PM ----------

I don't see much in my /etc/profile
and I don't know how to find .profile / .bashrc file.

FYI-I am very new to Solaris and I also have a root access.

If you have a home directory on that server

cd ~
echo "export ORACLE_HOME=\"/u01/app/oracle/product/11.2.0/dbhome_1\"" >> .profile
. .profile
echo $ORACLE_HOME

Thanks for your help but when I cd ~ it says "doesn't exist"

Do you have a home directory on that server?
f so, go to that path, skip the 'cd ~' and run the rest of the commands

Previous suggestion only works if the user's login shell is bash (or ksh).
The following also works if the user's login shell is /bin/sh or /sbin/sh:

cd
echo "export ORACLE_HOME; ORACLE_HOME=/u01/app/oracle/product/11.2.0/dbhome_1" >> .profile
. .profile
echo $ORACLE_HOME

. .profile
.profile not found

---------- Post updated 04-24-14 at 09:08 AM ---------- Previous update was 04-23-14 at 02:34 PM ----------

This is what I did. I logged in as Oracle and changed the .profile which was under some directory.
This is what I have now.
When do I echo $ORACLE_BASE or $ORACLE_HOME, it's working fine but when I log in as root it gives me another location for ORACLE_BASE and ORACLE_HOME. I wonder why is that? Any help?:confused:

Either you change your profile file and run it or run the below every time you login

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

Which profile should I change?
I already changed 1 profile when I logged in as Oracle.
Do all the users have different profile which needs to be updated with the Oracle Base and Oracle Home?

(I don't why oracle is not as easy as Microsoft. Installation takes half an hour which includes server installation+DB creation+users creation+assigning port+make an inbound rule in firewall etc+if someone wants to implement encryption on the DB)

Even here its easy if you have access to change /etc/profile file so that any user logging in will have the changes unless he explicitly modifies

What do you mean you don't see much ?

As already suggested, you just need to set the variable here and every user using sh, ksh or bash will inherit the setting:

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

If there are csh users, you'll also need to add this line in /etc/.login:

setenv ORACLE_HOME /u01/app/oracle/product/11.2.0/dbhome_1

This is what I have in my /etc/profile: I have no idea what I am doing or what I need to do: I do appreciate the fact that you guys are trying to help me out so much.
This is my Oracle home: /space/u01/app/oracle/product/11.2.0/dbhome_1

I am logged in as root:
cat /etc/profile (This is what I have)

#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

#       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
PATH=/usr/java/bin:/usr/java/jre/bin:$PATH
Export ORACLE_HOME="/space/u01/app/oracle/product/11.2.0/dbhome_1"

The Export in the last line should be changed to export . UNIX is case sensitive.
And also check if the path is correct.
you have provided us /u01/app/oracle/product/11.2.0/dbhome_1 where as the /etc/profile file has /space/u01/app/oracle/product/11.2.0/dbhome_1

As said before:
replace

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

by

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

because only the latter work with Bourne shell (/bin/sh, /sbin/sh).

This is what it looks like now:

#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

#       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
PATH=/usr/java/bin:/usr/java/jre/bin:$PATH
export PATH
export ORACLE_HOME
ORACLE_HOME=/space/u01/app/oracle/product/11.2.0/dbhome_1

---------- Post updated at 09:27 AM ---------- Previous update was at 09:20 AM ----------

I was able to change the profile.
This is what the problem is:
When I logged in as oracle, I see this:

echo $ORACLE_HOME
/space/u01/app/oracle/product/11.2.0/dbhome_1

When I log in as root, I see this:

echo $ORACLE_HOME
/space/home/oracle/database/product/10.2.0/Db_1

When I do env, it gives me something totally different:

BMC_SLM_JAVA_HOME=/usr/java
CATALINA_HOME=/space/home/apache-tomcat-5.5.23/apache-tomcat-5.5.23
DISPLAY=localhost:10.0
EDITOR=vi
HOME=/
JAVA_HOME=/usr/java
LD_LIBRARY_PATH=/space/home/oracle/database/product/10.2.0/Db_1:/usr/ar/idmux01/eaton/api/lib:/usr/java/bin:/usr/java/lib:/usr/java/jre:/space/home/apache-tomcat-5.5.23/apache-tomcat-5.5.23/webapps/arsys/WEB-INF/lib:/usr/openwin/lib
LOGNAME=root
MAIL=/var/mail//root
MANPATH=:/usr/man:/usr/share/man:/opt/SUNWvts/man
OPENWINHOME=/usr/openwin
ORACLE_BASE=/space/home/oracle
ORACLE_HOME=/space/home/oracle/database/product/10.2.0/Db_1
ORACLE_SID=eaton
PATH=/space/home/oracle/database/product/10.2.0/Db_1/bin:/usr/java/bin:/usr/java/bin:/usr/java/jre/bin:/usr/sbin:/usr/bin:/usr/ccs/bin:/usr/openwin/bin:/usr/dt/bin:/usr/platform/SUNW,Sun-Fire-V210/sbin:/opt/sun/bin:/opt/SUNWvts/bin
PS1=root@idmux01 #
PS2=root@idmux01 >
SHELL=/sbin/sh
SSH_CLIENT=*************
SSH_CONNECTION=**********************
SSH_TTY=/dev/pts/4
TERM=xterm
TWO_TASK=
TZ=America/Menominee
USER=root

How would I change environment variables setting?

give us the output for below commands

awk '$0 ~ /^root/' /etc/passwd
cat /.profile

awk '$0 ~ /^root/' /etc/passwd
root:x:0:0:Super-User:/:/sbin/sh

cat /.profile
#
# Initial EIS settings for user root
# This file is set up by the setup-standard script.
#
# In the unlikely event that the EIS profile settings are not
# required, comment out the few lines below.
#
# Version 14MAY04
#

#
#       Source the EIS settings if present
#
if [ -f $HOME/.profile-EIS ]
then
    echo "Sourcing $HOME/.profile-EIS....."
    . $HOME/.profile-EIS
fi

#
#       Remove #NOHEAD from next section for cluster node or domain
#
#NOHEAD if [ "`tty`" = "/dev/console" ]
#NOHEAD then
#NOHEAD     TERM=vt100
#NOHEAD     export TERM
#NOHEAD     echo ""
#NOHEAD     echo "TERM=$TERM"
#NOHEAD     echo ""
#NOHEAD else
#NOHEAD     LOGINFROM=`who am i | cut -f2 -d"(" | cut -f1 -d")"`
#NOHEAD     DISPLAY=${LOGINFROM}:0.0
#NOHEAD     export LOGINFROM DISPLAY
#NOHEAD     echo ""
#NOHEAD     echo "DISPLAY=$DISPLAY"
#NOHEAD     echo ""
#NOHEAD fi

JAVA_HOME=/usr/java
PATH=$JAVA_HOME/bin:$PATH
ORACLE_BASE=/space/home/oracle
export JAVA_HOME PATH

LD_LIBRARY_PATH=/usr/ar/idmux01/eaton/api/lib:/usr/java/bin:/usr/java/lib:/usr/j           ava/jre:/space/home/apache-tomcat-5.5.23/apache-tomcat-5.5.23/webapps/arsys/WEB-           INF/lib:$LD_LIBRARY_PATH
export LD_LIBRARY_PATH

CATALINA_HOME=/space/home/apache-tomcat-5.5.23/apache-tomcat-5.5.23
export CATALINA_HOME

ORA_INVENTORY=$ORACLE_BASE/oraInventory
ORACLE_HOME=$ORACLE_BASE/database/product/10.2.0/Db_1
ORACLE_SID=eaton
TWO_TASK=eaton
LD_LIBRARY_PATH=$ORACLE_HOME:$LD_LIBRARY_PATH
PATH=$ORACLE_HOME/bin:$PATH
export ORACLE_BASE ORACLE_HOME LD_LIBRARY_PATH PATH
export ORACLE_SID TWO_TASK
BMC_SLM_JAVA_HOME=/usr/java
export BMC_SLM_JAVA_HOME
echo "ORACLE_HOME=/u01/app/oracle/product/11.2.0/dbhome_1
export ORACLE_HOME;" >> /.profile

---------- Post updated at 11:01 AM ---------- Previous update was at 11:00 AM ----------

Logout and login after you run the above commands

1 Like