This discussion is archived
9 Replies Latest reply: Jan 23, 2013 4:22 AM by Osama_Mustafa RSS

how to set a ORACLE_HOME once

Gajananh999 Newbie
Currently Being Moderated
Dear Everyone,

I am using a amazon ec2 machine which is 64 bit. and i have installed oracle 11g in that. once i set the path and login to database and then when i restarted the machine again it was gone and it was saying me to set it again it was not allowing me to enter in to the database.

Can anyone please tell me where to set the oracle_home and oracle_sid once

thanks and regrads,

Gajanan Hiroji.
  • 1. Re: how to set a ORACLE_HOME once
    Girish Sharma Guru
    Currently Being Moderated
    I have set oracle_home in my windows xp box like this :

    Right Click My Computer--Properties--Advanced--Environment Variables--Under System Variables--New--Variable name--oracle_home and then variable_value <your path of oracle home> and ok.

    Regards
    Girish Sharma
  • 2. Re: how to set a ORACLE_HOME once
    Azar Pro
    Currently Being Moderated
    If your OS is Linux, set appropriate path in .bash_profile

    If your OS is windows, set appropriate path in Enviornmental variables in my computer properties and edit path

    Edited by: Azar on Jan 22, 2013 5:18 AM
  • 3. Re: how to set a ORACLE_HOME once
    Gajananh999 Newbie
    Currently Being Moderated
    Dear Azar,

    I m using redhat linux machine 5.4
  • 4. Re: how to set a ORACLE_HOME once
    Girish Sharma Guru
    Currently Being Moderated
    http://www.orafaq.com/forum/t/124420/2/
  • 5. Re: how to set a ORACLE_HOME once
    Azar Pro
    Currently Being Moderated
    login as oracle user
    [root@siebel ~]# su - oracle

    edit bash_profile and save it like below

    here ORACLE_SID=test ( test is your database sid) and also set the appropriate oracle home path

    [oracle@siebel ~]$ vi .bash_profile

    #Oracle Settings
    TMP=/tmp; export TMP
    TEMPDIR=$TMP; export TEMPDIR

    ORACLE_SID=test; export ORACLE_SID
    ORACLE_BASE=/u01/app/oracle; export ORACLE_BASE
    ORACLE_HOME=/u01/app/oracle/product/11.2.0/dbhome_1; export ORACLE_HOME
    PATH=/usr/sbin:$PATH; export PATH
    PATH=$ORACLE_HOME/bin:$PATH; export PATH
    LD_LIBRARY_PATH=$ORACLE_HOME/lib:/usr/lib; export LD_LIBRARY_PATH
    CLASSPATH=$ORACLE_HOME/JRE:$ORACLE_HOME/jlib:$ORACLE_HOME/rdbms/jlib; export CLASSPATH

    if [ $USER = "oracle" ]; then
    if [ $SHELL = "/bin/ksh" ]; then
    ulimit -p 16384
    ulimit -n 65536
    else
    ulimit -u 16384 -n 65536
    fi
    fi
  • 6. Re: how to set a ORACLE_HOME once
    Osama_Mustafa Oracle ACE
    Currently Being Moderated
    Gajananh999 wrote:
    Dear Azar,

    I m using redhat linux machine 5.4
    http://www.mike-devlin.com/oracle/bash_profile_sample.htm
  • 7. Re: how to set a ORACLE_HOME once
    Gajananh999 Newbie
    Currently Being Moderated
    Dear Osama,

    i have wrote this in my bash_profile

    ORACLE_SID='SA'
    export ORACLE_SID
    export ORACLE_HOME=/u01/app/oracle/product/11.2.0/db_1/bin
    export PATH=$ORACLE_HOME:$PATH


    now oracle_home is set

    when i restart machine ORACLE_HOME and ORACLE_SID is set for root user

    but when i do
    su - oracle
    the if a print echo $ORACLE_SID it will not anything
  • 8. Re: how to set a ORACLE_HOME once
    Fran Guru
    Currently Being Moderated
    Dear Osama,
    
    i have wrote this in my bash_profile 
    
    ORACLE_SID='SA'
    export ORACLE_SID
    export ORACLE_HOME=/u01/app/oracle/product/11.2.0/db_1/bin
    export PATH=$ORACLE_HOME:$PATH
    now oracle_home is set
    
    when i restart machine ORACLE_HOME and ORACLE_SID is set for root user
    
    but when i do 
    su - oracle
    the if a print echo $ORACLE_SID it will not anything
    Never use ROOT, you must write it on oracle's bash_profile.

    It must show something like this:
    [oracle@XXXX ~] cat .bash_profile
    # .bash_profile
    
    #Get the aliases and functions
    if [ -f ~/.bashrc ]; then
               . ~/bashrc
    fi
    
    #oracle
    ORACLE_SID=SA
    export ORACLE_SID
    ORACLE_BASE=/u01/app/oracle
    export ORACLE_BASE
    ORACLE_HOME=$ORACLE_BASE/product/11.2.0/db_1/bin
    export ORACLE_HOME
    editor=vi
    export EDITOR
    
    # User specific environment and startup programs
    
    PATH=$ORACLE_HOME/bin:$PATH:$HOME/bin
    *when you edit vi, remember exit with--> :wq! to save changes                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                       
  • 9. Re: how to set a ORACLE_HOME once
    Osama_Mustafa Oracle ACE
    Currently Being Moderated
    Are you set Oracle environment as root User ? If yes ... Don't ever to do that ...


    su - oracle
    cd /home/oracle
    and set bash_profile as Oracle user no root user.

Legend

  • Correct Answers - 10 points
  • Helpful Answers - 5 points