Oracle FAQ | Your Portal to the Oracle Knowledge Grid |
Home -> Community -> Mailing Lists -> Oracle-L -> RE: Hiding passwords
How about:
setlocal & pushd
@echo off
call oraenv stats
@for /f %%I in ('pwc.pl') do (
set MY_PASSWORD=%%I
)
@sqlplus scott/%MY_PASSWORD% @test.sql
popd & endlocal
I don't have the password server configured, so my pwc.pl simply is hardcoded to return tiger:
#!c:\perl\bin\perl.exe -w
print "tiger";
and test.sql is just "select user from dual;"
C:\tmp>test
C:\tmp>setlocal & pushd
Environment variable oracle_home not defined
SQL*Plus: Release 8.1.7.0.0 - Production on Tue Sep 23 18:32:24 2003
(c) Copyright 2000 Oracle Corporation. All rights reserved.
Connected to:
Oracle8i Enterprise Edition Release 8.1.7.4.1 - Production
With the Partitioning option
JServer Release 8.1.7.4.1 - Production
scott September 23, 2003define "&" (hex 26)
USER
Disconnected from Oracle8i Enterprise Edition Release 8.1.7.4.1 - Production
With the Partitioning option
JServer Release 8.1.7.4.1 - Production
C:\tmp>
granted, it is not quite as elegant as "MY_PASSWORD=$(pwc.pl ..." but it gets the job done.
And it does not work in Windows (95/98) Dos, but in NT and W2K, which you need to run Oracle server anyways.
At 03:44 PM 9/23/2003 -0800, you wrote:
>there is no command.com equivalent for this: MY_PASSWORD=$(pwc.pl
>-instance dv01 -username scott)
>
>Simple in ksh, impossible in un-enhanced Windohs.
>
>That previous bit is something I use in several cron jobs for retrieving
>passwords,
>as well as command line logins to several databases as many different users.
>
>To do this in Windohs, you must embed the entire job in Perl.
>
>HTH
>
>Jared
>
>
>
>
>
>Wolfgang Breitling <breitliw_at_centrexcc.com>
>Sent by: ml-errors_at_fatcity.com
>
> 09/23/2003 03:29 PM
> Please respond to ORACLE-L
>
> To: Multiple recipients of list ORACLE-L
> <ORACLE-L_at_fatcity.com>
> cc:
> Subject: RE: Hiding passwords
>
>
>I don't quite get that. Why can't you set a local environment variable from
>a script? If you could, where do you propose to get the value that you want
>to put into an environment variable?
>
>At 01:59 PM 9/23/2003 -0800, you wrote:
>
> >Paul,
> >
> >Any chance these scripts could be run from Cygwin, Uwin, MKS Toolkit,
> >or anything that will let you use a korn shell?
> >
> >That would simplify things tremendously.
> >
> >One of the problems with Windohs is that you cannot execute a script
> >or program so that it can return a value to a local environment variable.
> >
> >That ability would make this task simple from command.com.
> >
> >Another possibility is to put your passwords in the registry, restrict that
> >portion of the registry, ( or the whole thing ), and use a Perl script to
> >retrieve
> >the passwords and kick off the other jobs.
> >
> >What I do in linux is use a password server ( as seen in "Perl for Oracle
> >DBA's")
> >and retrieve the password across the network, encrypted of course.
> >
> >This works on windows as well, though you're there restricted to doing this
> >strictly from within the Perl script.
> >
> >Jared
>
>Wolfgang Breitling
>Oracle7, 8, 8i, 9i OCP DBA
>Centrex Consulting Corporation
>http://www.centrexcc.com
Wolfgang Breitling
Oracle7, 8, 8i, 9i OCP DBA
Centrex Consulting Corporation
http://www.centrexcc.com
-- Please see the official ORACLE-L FAQ: http://www.orafaq.net -- Author: Wolfgang Breitling INET: breitliw_at_centrexcc.com Fat City Network Services -- 858-538-5051 http://www.fatcity.com San Diego, California -- Mailing list and web hosting services --------------------------------------------------------------------- To REMOVE yourself from this mailing list, send an E-Mail message to: ListGuru_at_fatcity.com (note EXACT spelling of 'ListGuru') and in the message BODY, include a line containing: UNSUB ORACLE-L (or the name of mailing list you want to be removed from). You may also send the HELP command for other information (like subscribing).Received on Tue Sep 23 2003 - 20:44:39 CDT