12 Replies Latest reply: Nov 19, 2012 5:32 PM by user5716448 RSS

    Dynamic ORACLE_HOME in env variable PATH  not working

    user5716448
      Hi,

      We have an issue whereby we want the PATH to be dyanmic with respect to the ORACLE_HOME.

      Have implemented the solution in 'ORA-12557: TNS:Protocol Adapter Not Loadable' While Running OUI [ID 735400.1 but not working.

      We have Windows 2008 R2 server with Oracle 11.2.0.3 client installed.

      First when did set to check environment varibales, fouND no env. variable for ORACLE_HOME even though in registry so have set ORACLE_HOME as user env variable.

      Have changed system env variable PATH to have  %ORACLE_HOME%\bin; at very start

      when do PATH to check value shows

      literally as %ORACLE_HOME%\bin at start rather than translating to the real physical location as it does with other logical variables.

      How can we ensure translates the ORACLE_HOME correctly so PATH is O.K.                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                       
        • 1. Re: Dynamic ORACLE_HOME in env variable PATH  not working
          sb92075
          user5716448 wrote:
          Hi,

          We have an issue whereby we want the PATH to be dyanmic with respect to the ORACLE_HOME.

          Have implemented the solution in 'ORA-12557: TNS:Protocol Adapter Not Loadable' While Running OUI [ID 735400.1 but not working.

          We have Windows 2008 R2 server with Oracle 11.2.0.3 client installed.

          First when did set to check environment varibales, fouND no env. variable for ORACLE_HOME even though in registry so have set ORACLE_HOME as user env variable.

          Have changed system env variable PATH to have  %ORACLE_HOME%\bin; at very start

          when do PATH to check value shows

          literally as %ORACLE_HOME%\bin at start rather than translating to the real physical location as it does with other logical variables.

          How can we ensure translates the ORACLE_HOME correctly so PATH is O.K. open Command Window & issue command belowecho %ORACLE_HOME%COPY  the results, then PASTE all back here                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                   
          • 2. Re: Dynamic ORACLE_HOME in env variable PATH  not working
            Osama_Mustafa
            Check My blog Please for this error
            http://osamamustafa.blogspot.com/2012/07/ora-12557-tnsprotocol-adapter-not.html
            • 3. Re: Dynamic ORACLE_HOME in env variable PATH  not working
              user5716448
              Hi,

              doesn't seem to allow image paste in these forums but resolves as follows:

              If no ORACLE_HOME env variable explicitly set then spaces i.e. not find.

              If set ORACLE_HOME env variable via env variables button
              then resolves as below.

              c:\oracle11_64\product\11.2.0\client_1


              but still path resolves as %ORACLE_HOME%\bin... remainder of path cannot pcik up oracle_home dynamically.

              Thanks
              • 4. Re: Dynamic ORACLE_HOME in env variable PATH  not working
                user5716448
                Thanks - but trying to avoid (if posisble) hardcoding oarcle_home path within the PATH env variable.
                • 5. Re: Dynamic ORACLE_HOME in env variable PATH  not working
                  Osama_Mustafa
                  If you want to upload image you have to look for external free hosting server .

                  Did you check my blog ?
                  • 6. Re: Dynamic ORACLE_HOME in env variable PATH  not working
                    user5716448
                    Hi,

                    Thanks

                    Yes - useful ifno.
                    • 7. Re: Dynamic ORACLE_HOME in env variable PATH  not working
                      Osama_Mustafa
                      I think its easy solution nothing happened , don't worry
                      • 8. Re: Dynamic ORACLE_HOME in env variable PATH  not working
                        EdStevens
                        user5716448 wrote:
                        Hi,

                        doesn't seem to allow image paste in these forums but resolves as follows:
                        Who said anything about an image paste?
                        Open a command prompt.
                        Issue your commands
                        click the little command pompt icon in the upper left corner. See where the drop-down says 'edit'? Follow that up. See where it says 'mark/copy/paste'?
                        You can copy TEXT (not image) and paste it here. people do it all the time.


                        As for how PATH is resolved ... any environment variables in it are resolved when the OS session is started, and apply to that session.
                        If no ORACLE_HOME env variable explicitly set then spaces i.e. not find.
                        Then oracle will get it from the registry when oracle needs it.

                        "Registry -- one more reason to hate Windows".

                        If set ORACLE_HOME env variable via env variables button
                        then resolves as below.

                        c:\oracle11_64\product\11.2.0\client_1


                        but still path resolves as %ORACLE_HOME%\bin... remainder of path cannot pcik up oracle_home dynamically.
                        You would need to make sure the sequence is that ORACLE_HOME gets set and resolved before it gets referenced in setting the PATH.
                        Thanks
                        • 9. Re: Dynamic ORACLE_HOME in env variable PATH  not working
                          user5716448
                          Thanks for reponse.


                          You would need to make sure the sequence is that ORACLE_HOME gets set and resolved before it gets referenced in setting the PATH.

                          How do you do this in Widows environment.

                          If unix would just put order the variables in the .profile but not sure how can achieve this in Windows.
                          • 10. Re: Dynamic ORACLE_HOME in env variable PATH  not working
                            EdStevens
                            user5716448 wrote:
                            Thanks for reponse.


                            You would need to make sure the sequence is that ORACLE_HOME gets set and resolved before it gets referenced in setting the PATH.

                            How do you do this in Widows environment.

                            If unix would just put order the variables in the .profile but not sure how can achieve this in Windows.
                            You've just addressed one of the many reasons why so many of us dislike windows and avoid it every chance we get.
                            And why -- in Windows -- I don't use one environment variable (like ORACLE_HOME) to supply a value for another (like PATH). I just hard-code it all.

                            I'd hope someone would have an answer on how windows sequences the resolution of environment variables, but I've never seen it.
                            • 11. Re: Dynamic ORACLE_HOME in env variable PATH  not working
                              jgarry
                              EdStevens wrote:
                              user5716448 wrote:
                              Thanks for reponse.


                              You would need to make sure the sequence is that ORACLE_HOME gets set and resolved before it gets referenced in setting the PATH.

                              How do you do this in Widows environment.

                              If unix would just put order the variables in the .profile but not sure how can achieve this in Windows.
                              You've just addressed one of the many reasons why so many of us dislike windows and avoid it every chance we get.
                              And why -- in Windows -- I don't use one environment variable (like ORACLE_HOME) to supply a value for another (like PATH). I just hard-code it all.

                              I'd hope someone would have an answer on how windows sequences the resolution of environment variables, but I've never seen it.
                              http://best-windows.vlaurie.com/environment-variables.html

                              http://www.oracle.com/technetwork/products/globalization/nls-lang-099431.html look for the word precedence.

                              To the OP:
                              So what one normally sees is the OH set explicitly as a system variable, at the beginning of PATH. Nothing stops you from using .bat files to play with it, or setting your own variables to whatever you want. MOS Multiple Oracle_Homes on MS Windows Platforms (Home Selector) [ID 460054.1] mentions you can either use the installer, or bat files. In olden days, Oracle would just prepend the latest home to the path, but that has to be a recipe for failure.

                              I note there are files named like %ORACLE_HOME%\bin\selecthome.bat.* which seem to be playing with stuff.