How do I get a value from the windows registry to set a variable 2005-10-12 - By Radoulov, Dimitre
:o) I choose this variable name (CURR_OH) to demonstrate that this is new variable, not the ORALCLE_HOME that you already have in your environment. If you want to use it with the ORACLE_HOME you have to change it(script test.bat)
@(protected) OFF set ORACLE_HOME= echo The current ORACLE_HOME is %ORACLE_HOME% :: delims is a TAB followed by a space FOR /F "tokens=3* delims= " %%A IN ('reg query HKLM\SOFTWARE\ORACLE\ /v ORACLE _HOME') DO SET ORACLE_HOME=%%A ECHO The NEW Oracle Home is %ORACLE_HOME%
D:\Downloads>test The current ORACLE_HOME is The NEW Oracle Home is C:\oracle\ora92 D:\Downloads>sqlplus /nolog
SQL*Plus: Release 9.2.0.7.0 - Production on Wed Oct 12 11:03:16 2005
Copyright (c) 1982, 2002, Oracle Corporation. All rights reserved.
SQL>
Regards, Dimitre
-- -- Original Message -- -- From: Niall Litchfield To: cichomitiko@(protected) Cc: Juan Carlos Reyes Pacheco ; oracle-l@(protected) Sent: Wednesday, October 12, 2005 10:55 AM Subject: Re: How do I get a value from the windows registry to set a variable
I'm guessing you don't have 10g and 9i installed with 10g as the home. oh.bat is your script.
C:\Scripts>oh Oracle home is C:\oracle\ora92 C:\Scripts>sqlplus /
SQL*Plus: Release 10.1.0.4.0 - Production on Wed Oct 12 09:54:16 2005
Copyright (c) 1982, 2005, Oracle. All rights reserved.
ERROR: ORA-12560 (See ORA-12560.ora-code.com): TNS:protocol adapter error
Enter user-name: ERROR: ORA-12560 (See ORA-12560.ora-code.com): TNS:protocol adapter error
Enter user-name: ERROR: ORA-12560 (See ORA-12560.ora-code.com): TNS:protocol adapter error
SP2-0157: unable to CONNECT to ORACLE after 3 attempts, exiting SQL*Plus
On 10/12/05, Dimitar Radoulov <cichomitiko@(protected)> wrote: Works on my PC, may be with copy/paste the delims are changing, try to adjust the value to TAB followed by a space.
Regards, Dimitre
On 10/11/05, Juan Carlos Reyes Pacheco < juancarlosreyesp@(protected)> wrote: Thanks a lot Dimitre, copying and pasting directly from the email don't work precisely, but the solution is there :) On 10/11/05, Radoulov, Dimitre <cichomitiko@(protected)> wrote: > Excuse me, the correct syntax is with tokens=3*(by using the asterisk we > make sure that not only the third word is used but everything following it > as well) and you have to set %%A (not %%B). > > > @(protected) OFF > :: delims is a TAB followed by a space > FOR /F "tokens=3* delims= " %%A IN ('reg query HKLM\SOFTWARE\ORACLE\ /v > ORACLE_HOME') DO SET > CURR_OH=%%A > ECHO Oracle home is %CURR_OH% > > > > > Dimitre Radoulov > >
-- Oracle Certified Profesional 9i 10g Orace Certified Professional Developer 6i
8 years of experience in Oracle 7,8i,9i,10g and developer 6i
-- Niall Litchfield Oracle DBA http://www.niall.litchfield.dial.pipex.com <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN"> <HTML><HEAD> <META http-equiv=Content-Type content="text/html; charset=iso-8859-1"> <META content="MSHTML 6.00.2900.2769" name=GENERATOR> <STYLE></STYLE> </HEAD> <BODY bgColor=#ffffff> <DIV><FONT face=Arial size=2>:o) I choose this variable name (CURR_OH) to demonstrate that this is new variable, not the ORALCLE_HOME that you already have in your environment. If you want to use it with the ORACLE_HOME you have to change it(script test.bat)</FONT></DIV> <DIV><FONT face=Arial size=2></FONT> </DIV> <DIV><FONT face=Arial size=2>@(protected) OFF<BR>set ORACLE_HOME=<BR>echo The current ORACLE_HOME is %ORACLE_HOME%<BR>:: delims is a TAB followed by a space<BR>FOR /F "tokens=3* delims= " %%A IN ('reg query HKLM\SOFTWARE\ORACLE\ /v ORACLE_HOME') DO SET ORACLE_HOME=%%A<BR>ECHO The NEW Oracle Home is %ORACLE_HOME%</FONT></DIV> <DIV><FONT face=Arial size=2></FONT> </DIV> <DIV><FONT face=Arial size=2></FONT> </DIV> <DIV><FONT face=Arial size=2>D:\Downloads>test<BR>The current ORACLE_HOME is<BR>The NEW Oracle Home is C:\oracle\ora92<BR>D:\Downloads>sqlplus /nolog</FONT></DIV> <DIV> </DIV> <DIV><FONT face=Arial size=2>SQL*Plus: Release 9.2.0.7.0 - Production on Wed Oct 12 11:03:16 2005</FONT></DIV> <DIV> </DIV> <DIV><FONT face=Arial size=2>Copyright (c) 1982, 2002, Oracle Corporation.  ; All rights reserved.</FONT></DIV> <DIV> </DIV> <DIV><FONT face=Arial size=2>SQL></FONT></DIV> <DIV><FONT face=Arial size=2></FONT> </DIV> <DIV><FONT face=Arial size=2></FONT> </DIV> <DIV><FONT face=Arial size=2></FONT> </DIV> <DIV><FONT face=Arial size=2></FONT> </DIV> <DIV><FONT face=Arial size=2>Regards,</FONT><BR>Dimitre </DIV> <DIV> </DIV> <DIV> </DIV> <BLOCKQUOTE style="PADDING-RIGHT: 0px; PADDING-LEFT: 5px; MARGIN-LEFT: 5px; BORDER-LEFT: #000000 2px solid; MARGIN-RIGHT: 0px"> <DIV style="FONT: 10pt arial">-- -- Original Message -- -- </DIV> <DIV style="BACKGROUND: #e4e4e4; FONT: 10pt arial; font-color: black"><B>From:</B> <A title=niall.litchfield@(protected) href="mailto:niall.litchfield@(protected)">Niall Litchfield</A> </DIV> <DIV style="FONT: 10pt arial"><B>To:</B> <A title=cichomitiko@(protected) href="mailto:cichomitiko@(protected)">cichomitiko@(protected)</A> </DIV> <DIV style="FONT: 10pt arial"><B>Cc:</B> <A title=juancarlosreyesp@(protected) href="mailto:juancarlosreyesp@(protected)">Juan Carlos Reyes Pacheco</A> ; <A title=oracle-l@(protected) href="mailto:oracle-l@(protected)">oracle-l@(protected)</A> </DIV> <DIV style="FONT: 10pt arial"><B>Sent:</B> Wednesday, October 12, 2005 10:55 AM</DIV> <DIV style="FONT: 10pt arial"><B>Subject:</B> Re: How do I get a value from the windows registry to set a variable</DIV> <DIV><BR></DIV> <DIV>I'm guessing you don't have 10g and 9i installed with 10g as the home. oh.bat is your script.</DIV> <DIV> </DIV> <DIV> <P>C:\Scripts>oh<BR>Oracle home is C:\oracle\ora92<BR>C:\Scripts> ;sqlplus /</P> <P>SQL*Plus: Release 10.1.0.4.0 - Production on Wed Oct 12 09:54:16 2005</P> <P>Copyright (c) 1982, 2005, Oracle. All rights reserved.</P> <P>ERROR:<BR>ORA-12560 (See ORA-12560.ora-code.com): TNS:protocol adapter error</P> <P><BR>Enter user-name:<BR>ERROR:<BR>ORA-12560 (See ORA-12560.ora-code.com): TNS:protocol adapter error</P> <P><BR>Enter user-name:<BR>ERROR:<BR>ORA-12560 (See ORA-12560.ora-code.com): TNS:protocol adapter error</P> <P><BR>SP2-0157: unable to CONNECT to ORACLE after 3 attempts, exiting SQL*Plus</P><BR><BR> </DIV> <DIV><SPAN class=gmail_quote>On 10/12/05, <B class=gmail_sendername>Dimitar Radoulov</B> <<A href="mailto:cichomitiko@(protected)">cichomitiko@(protected)</A>> wrote:</SPAN> <BLOCKQUOTE class=gmail_quote style="PADDING-LEFT: 1ex; MARGIN: 0px 0px 0px 0.8ex; BORDER-LEFT: #ccc 1px solid"> <DIV>Works on my PC, may be with copy/paste the delims are changing, try to adjust the value to TAB followed by a space.</DIV> <DIV> </DIV> <DIV> </DIV> <DIV>Regards,</DIV><SPAN class=sg> <DIV>Dimitre<BR><BR> </DIV></SPAN> <DIV><SPAN class=q><SPAN class=gmail_quote>On 10/11/05, <B class=gmail_sendername>Juan Carlos Reyes Pacheco</B> <<A onclick="return top.js.OpenExtLink(window,event,this)" href="mailto:juancarlosreyesp@(protected)" target=_blank> juancarlosreyesp@(protected)</A>> wrote:</SPAN> </SPAN> <DIV><SPAN class=e id=q_106e37b3219cc4bc_4> <BLOCKQUOTE class=gmail_quote style="PADDING-LEFT: 1ex; MARGIN: 0px 0px 0px 0.8ex; BORDER-LEFT: #ccc 1px solid">Thanks a lot Dimitre, copying and pasting directly from the email<BR>don't work precisely, but the solution is there :) <BR>On 10/11/05, Radoulov, Dimitre <<A onclick="return top.js.OpenExtLink(window,event,this)" href="mailto:cichomitiko@(protected)" target=_blank>cichomitiko@(protected)</A>> wrote:<BR>> Excuse me, the correct syntax is with tokens=3*(by using the asterisk we <BR>> make sure that not only the third word is used but everything following it <BR>> as well) and you have to set %%A (not %%B).<BR>><BR>><BR>> @(protected) OFF<BR>> :: delims is a TAB followed by a space<BR>> FOR /F "tokens=3* delims= " %%A IN ('reg query HKLM\SOFTWARE\ORACLE\ /v <BR>> ORACLE_HOME') DO SET<BR>> ; CURR_OH=%%A<BR>> ECHO Oracle home is %CURR_OH%<BR>><BR>><BR>><BR>><BR>> Dimitre Radoulov <BR>><BR>><BR><BR><BR>--<BR>Oracle Certified Profesional 9i 10g<BR>Orace Certified Professional Developer 6i <BR><BR>8 years of experience in Oracle 7,8i,9i,10g and developer 6i<BR></BLOCKQUOTE></SPAN></DIV></DIV><BR></BLOCKQUOTE></DIV><BR><BR clear=all><BR>-- <BR>Niall Litchfield<BR>Oracle DBA<BR><A href="http://www.niall.litchfield.dial.pipex.com">http://www.niall.litchfield .dial.pipex.com</A> </BLOCKQUOTE></BODY></HTML>
|
|