1 2 3 Previous Next 39 Replies Latest reply: Mar 9, 2011 1:25 PM by sybrand_b RSS

    ORAENV file to be disabled

    poorna
      Hi,

      Oracle Version:10.2.0.3
      Operating system: Linux

      Here i have a doubt .I was unable to connect to database with oracle OS user until i run the oraenv file .

      How can i disable oraenv file in order to connect to the database with out running the oraenv file.

      Please help me.

      Thanks & Regards,
      Poorna Prasad.S
        • 1. Re: ORAENV file to be disabled
          Kamran Agayev A.
          SIDDABATHUNI wrote:
          Hi,

          Oracle Version:10.2.0.3
          Operating system: Linux

          Here i have a doubt .I was unable to connect to database with oracle OS user until i run the oraenv file .

          How can i disable oraenv file in order to connect to the database with out running the oraenv file.

          Please help me.

          Thanks & Regards,
          Poorna Prasad.S
          In order to connect to an Oracle instance in LInux OS, you need to set environment variables :

          ORACLE_SID
          ORACLE_HOME
          PATH

          edit .bashrc file and set them as I explained in the following blog post:
          http://kamranagayev.wordpress.com/2009/05/01/step-by-step-installing-oracle-database-10g-release-2-on-linux-centos-and-automate-the-installation-using-linux-shell-script/
          • 2. Re: ORAENV file to be disabled
            poorna
            Hi Kamran Agayev,

            We set all those parameters in .bach_profile file it is one of our production database server.

            Here what my doubt is I was able to connect to the database with another OS user with out running the . oraenv file but when i connect to the oracle OS user and when trying to connect to the database it is showing that command not found .But when i run . oraenv file with Oracle user loggin and giving the SID details then i was able to connect to database.

            But i want oracle user also be able to connect to the database with out running the . oraenv file .

            Thanks & Regards,
            Poorna Prasad.S
            • 3. Re: ORAENV file to be disabled
              Kamran Agayev A.
              SIDDABATHUNI wrote:
              Hi Kamran Agayev,

              We set all those parameters in .bach_profile file it is one of our production database server.

              Here what my doubt is I was able to connect to the database with another OS user with out running the . oraenv file but when i connect to the oracle OS user and when trying to connect to the database it is showing that command not found .But when i run . oraenv file with Oracle user loggin and giving the SID details then i was able to connect to database.

              But i want oracle user also be able to connect to the database with out running the . oraenv file .

              Thanks & Regards,
              Poorna Prasad.S
              Please connect with oracle user and post the output of the following commands:
              su - oracle
              echo $ORACLE_SID
              echo $ORACLE_HOME
              echo $PATH
              • 4. Re: ORAENV file to be disabled
                12cdb
                The connectivity with the database is nothing to do with the oraenv file.

                As mentioned by others, .oraenv file sets all the required environment variables for an oracle before you can connect to it.

                It is a very good tool and helps a lot when you have several instances of database running on the same machine.
                How can i disable oraenv file in order to connect to the database with out running the oraenv file.
                I do not think you can disable it, but certainly can rename/delete, BUT DO NOT DO THIS.
                • 5. Re: ORAENV file to be disabled
                  poorna
                  Hi,

                  Below is the output for your statements.
                  $ echo $ORACLE_SID
                  pavs
                  oracle@virqts1ora001{Primary}:pavs:/home/oracle
                  $ echo $ORACLE_HOME
                  
                  oracle@virqts1ora001{Primary}:pavs:/home/oracle
                  $ echo $PATH
                  /usr/kerberos/bin:/usr/local/bin:/bin:/usr/bin:/usr/X11R6/bin:/home/oracle/bin:/usr/bin
                  oracle@virqts1ora001{Primary}:pavs:/home/oracle
                  Here is the output for the echo $ORACLE_HOME after running . oraenv file.
                  $ . oraenv
                  ORACLE_SID = [pavs] ? pavs
                  oracle@virqts1ora001{Primary}:pavs:/home/oracle
                  $ echo $ORACLE_HOME
                  /home/oracle/oracle/product/10.2.0/db_1
                  oracle@virqts1ora001{Primary}:pavs:/home/oracle
                  $ echo $PATH
                  /usr/kerberos/bin:/usr/local/bin:/bin:/usr/bin:/usr/X11R6/bin:/home/oracle/bin:/usr/bin:/home/oracle/oracle/product/10.2.0/db_1/bin
                  oracle@virqts1ora001{Primary}:pavs:/home/oracle
                  $ echo $ORACLE_SID
                  pavs
                  oracle@virqts1ora001{Primary}:pavs:/home/oracle
                  $
                  Thanks & Regards,
                  Poorna Prasad.S
                  • 6. Re: ORAENV file to be disabled
                    Kamran Agayev A.
                    You get "command not found" because you didn't set PATH environment variable correcetly. Add the following line to the .bashrc file and try again (or do it from Terminal window)
                    export PATH=/home/oracle/oracle/product/10.2.0/db_1/bin:$PATH
                    Now connect to the database and post result:
                    sqlplus / as sysdba
                    • 7. Re: ORAENV file to be disabled
                      poorna
                      Hi,

                      Here is the output for my .bashrc file in oracle user account.
                      $ cat .bashrc
                      # .bashrc
                      
                      # User specific aliases and functions
                      
                      # Source global definitions
                      if [ -f /etc/bashrc ]; then
                              . /etc/bashrc
                      fi
                      but here is the another user utpala .bashrc file output .
                      [utpala@virqts1ora001 ~]$ cat .bashrc
                      # .bashrc
                      
                      # User specific aliases and functions
                      
                      # Source global definitions
                      if [ -f /etc/bashrc ]; then
                              . /etc/bashrc
                      fi
                      utpala@virqts1ora001 ~]$ echo $ORACLE_HOME
                      /home/oracle/oracle/product/10.2.0/db_1/
                      [utpala@virqts1ora001 ~]$ echo $ORACLE_SID
                      
                      [utpala@virqts1ora001 ~]$ echo $PATH
                      /usr/kerberos/bin:/usr/local/bin:/bin:/usr/bin:/usr/X11R6/bin:/home/utpala/bin:/home/oracle/oracle/product/10.2.0/db_1/bin
                      [utpala@virqts1ora001 ~]$
                      Here why i am able to connect to the database with out running . oraenv file .But i can connect to the database as
                      [utpala@virqts1ora001 ~]$ sqlplus sys as sysdba
                      
                      SQL*Plus: Release 10.2.0.3.0 - Production on Mon Mar 7 07:29:35 2011
                      
                      Copyright (c) 1982, 2006, Oracle.  All Rights Reserved.
                      
                      Enter password:per$9@PQVS
                      Connected to:
                      Oracle Database 10g Release 10.2.0.3.0 - Production
                      
                      SQL> exit
                      Disconnected from Oracle Database 10g Release 10.2.0.3.0 - Production
                      [utpala@virqts1ora001 ~]$
                      Here i am connection to the daabase by calling the alias name .

                      Thanks & Regards,
                      Poorna Prasad.S
                      • 8. Re: ORAENV file to be disabled
                        Kamran Agayev A.
                        Then it's written in .bash_profile file. CHeck it please
                        • 9. Re: ORAENV file to be disabled
                          poorna
                          Hi,

                          Here is the output for my .batch_profile for oracle user
                          oracle@virqts1ora001{Primary}:pavs:/home/oracle
                          $ cat .bash_profile
                          # .bash_profile
                          
                          # Get the aliases and functions
                          if [ -f ~/.bashrc ]; then
                                  . ~/.bashrc
                          fi
                          
                          # User specific environment and startup programs
                          
                          PATH=$PATH:$HOME/bin:/usr/bin
                          
                          export PATH
                          unset USERNAME
                          
                          export ORACLE_BASE=/home/oracle/oracle
                          
                          ORACLE_SID=pavs
                          
                          PS1=`whoami`@`uname -n |awk -F. '{print $1"{Primary}"}'`':${ORACLE_SID}:${PWD}
                          $ '
                          # <--  Alias  -->
                          alias sysdba='sqlplus "/ as sysdba"'
                          alias cdump='cd $ORACLE_BASE/admin/$ORACLE_SID/cdump'
                          alias dpdump='cd $ORACLE_BASE/admin/$ORACLE_SID/dpdump'
                          alias scripts='cd $ORACLE_BASE/$ORACLE_SID/scripts'
                          alias pfile='cd $ORACLE_BASE/admin/$ORACLE_SID/pfile'
                          alias udump='cd $ORACLE_BASE/admin/$ORACLE_SID/udump'
                          alias adump='cd $ORACLE_BASE/admin/$ORACLE_SID/adump'
                          alias bdump='cd $ORACLE_BASE/admin/$ORACLE_SID/bdump'
                          alias standby='cd $ORACLE_BASE/admin/$ORACLE_SID/standby'
                          alias monitor='cd /home/oracle/rdbae/bbc4.30-bbpe'
                          alias archive='cd /u02/arch/PAVS'
                          echo '***************************************** '
                          echo '***            List of alias          *** '
                          echo '***************************************** '
                          alias
                          and here is the output for UTPALA user .batch_profile .
                          oracle@virqts1ora001{Primary}:pavs:/home/oracle
                          $ su - utpala
                          Password:
                          [utpala@virqts1ora001 ~]$ cat .bash_profile
                          # .bash_profile
                          
                          # Get the aliases and functions
                          if [ -f ~/.bashrc ]; then
                                  . ~/.bashrc
                          fi
                          
                          # User specific environment and startup programs
                          
                          PATH=$PATH:$HOME/bin:/home/oracle/oracle/product/10.2.0/db_1/bin
                          ORACLE_HOME=/home/oracle/oracle/product/10.2.0/db_1/
                          
                          export ORACLE_HOME
                          export PATH
                          unset USERNAME
                          [utpala@virqts1ora001 ~]$
                          Thanks & Regards,
                          Poorna Prasad.S
                          • 10. Re: ORAENV file to be disabled
                            Kamran Agayev A.
                            Add the following lines that are written at UTPALA's bash_profile file, login to the system with your username and try again
                            PATH=$PATH:$HOME/bin:/home/oracle/oracle/product/10.2.0/db_1/bin
                            ORACLE_HOME=/home/oracle/oracle/product/10.2.0/db_1/ 
                             
                            export ORACLE_HOME
                            export PATH
                            • 11. Re: ORAENV file to be disabled
                              EdStevens
                              SIDDABATHUNI wrote:
                              Hi,

                              Here is the output for my .batch_profile for oracle user
                              At first I thought it a typo, but you keep repeating it, so I'm beginning to think it's part of your problem.

                              The file name is ".bash_profile", not ".batch_profile".
                              <snip>
                              And please note that every OS user account has their own copy of .bash_profile, located in their own home directory, and that said file is sourced at logon time.
                              • 12. Re: ORAENV file to be disabled
                                Kamran Agayev A.
                                EdStevens wrote:
                                SIDDABATHUNI wrote:
                                Hi,

                                Here is the output for my .batch_profile for oracle user
                                At first I thought it a typo, but you keep repeating it, so I'm beginning to think it's part of your problem.

                                The file name is ".bash_profile", not ".batch_profile".
                                <snip>
                                And please note that every OS user account has their own copy of .bash_profile, located in their own home directory, and that said file is sourced at logon time.
                                But the OP opens the correct bash file each time :)
                                cat .bash_profile
                                • 13. Re: ORAENV file to be disabled
                                  EdStevens
                                  Kamran Agayev A. wrote:
                                  EdStevens wrote:
                                  SIDDABATHUNI wrote:
                                  Hi,

                                  Here is the output for my .batch_profile for oracle user
                                  At first I thought it a typo, but you keep repeating it, so I'm beginning to think it's part of your problem.

                                  The file name is ".bash_profile", not ".batch_profile".
                                  <snip>
                                  And please note that every OS user account has their own copy of .bash_profile, located in their own home directory, and that said file is sourced at logon time.
                                  But the OP opens the correct bash file each time :)
                                  cat .bash_profile
                                  I haven't had my second cup of coffee yet .... :-)
                                  • 14. Re: ORAENV file to be disabled
                                    poorna
                                    Hi,

                                    Can you please look in to below steps 1 and 2 .I think for my oracle user the configure in interactive method and your please help me how to make it in to non-interactive method login for my oracle user i tried in google but could not find it any where .
                                    Oracle provides a script called oraenv that can be used to change the environmental variables $ORACLE_HOME, $ORACLE_SID, and $PATHto allow a user to connect to a given database instance (a database instance is often referred to as a “SID” or Oracle System Identifier). It can then be used again to switch to a different SID easily, even if the ORACLE_HOME for the new SID is different.
                                    
                                    Step:1 
                                    
                                    There are two methods for using the oraenv script. The first method is interactive, with the script asking the user to type in the SID. To make oraenv export the variables to the shell environment, it must be preceded with a period and a space as seen in Figure 6.5. 
                                    
                                    Step:2
                                    The second method for using oraenv is non-interactive. This is done by setting the variables $ORAENV_ASK=NO and $ORACLE_SID=<sid> and then running the script with a period and space before it. This time, oraenv will not ask for the SID. It will use the one it finds in the variable $ORACLE_SID.  This non-interactive method is useful when calling oraenv from a script.
                                    
                                    Figure 6.5 demonstrates using oraenv. The which command attempts to find the path to the dbca program. This command cannot find dbca in any of the directories identified by the $PATHvariable, and it reports the error. After running the oraenv script using * for the SID, the $PATH environmental variable is set properly and dbca is found.
                                    Thanks & Regards,
                                    Poorna Prasad.S
                                    1 2 3 Previous Next