| Oracle FAQ | Your Portal to the Oracle Knowledge Grid | |
Home -> Community -> Mailing Lists -> Oracle-L -> RE: Perl code example
Jared,
> When 'Perl for Oracle DBA's' comes out...
Do you have an ETA on this? Are you going to put it up on SourceForge or the
like?
Yours curiously,
Steve Orr
-----Original Message-----
Sent: Tuesday, September 18, 2001 10:20 AM
To: Multiple recipients of list ORACLE-L
I'm looking for a Perl example passing parameters.
>
> The code below has the userids and passwords hardcoded in clear text in
the
> system line, parms 3 and 5 (five lines from the bottom), and the Oracle
sid
> is hardcoded also. The code has to be changed to 1) read .pwd1 and .pwd2
> files containing the passwords, and set a literal for the SID and
> substitute it at in the code.
Linda,
Here's a cheap lightweight password server.
Put the files pwd.pm and pwd.pl into a directory and try as is.
Follow the example of the template in pwd.pm and fill in with your own wervers/instances/usernames.
Copy the file 'pwd.pm' to some secure location, and change the line "use lib './" to "use lib 'full_path_to_pwd.pm".
You can cut and paste pwd.pl into your code.
When 'Perl for Oracle DBA's' comes out ( or whatever we eventually call it" it will have a network password server in it, with encrypted transmissions.
This one should suffice though.
Jared
PS. the power of Perl demonstrated. this took 30 minutes. :)
use lib './';
use pwd;
use Getopt::Long;
my %optctl;
GetOptions( \%optctl,
"username:s",
"instance:s",
"server:s",
"z|h|help" => \$help
if ( $help ) {
usage();
exit 1;
$optctl{server} || do { usage();exit 2};
$optctl{instance} || do { usage();exit 3};
$optctl{username} || do { usage();exit 4};
my $password = pwd::password(
$optctl{server},
$optctl{instance},
$optctl{username}
print "Password: $password\n";
sub usage {
print qq{
pwd.pl
--server --instance --username
package pwd;
$PKG = pwd;
=head1
stuff between '=head1' and '=cut' is comments
here's an example
my %passwd = (
server => {
instance => {
username => 'password',
username => 'password'
}
}
=cut
%passwd = (
venus => {
db1 => {
system => 'foxtrot',
sys => 'over_the_hedge'
},
db2 => {
system => 'user_friendly',
sys => 'gpf-comics'
}
},
mars => {
db1 => {
system => 'ubersoft',
sys => 'get_fuzzy'
},
db3 => {
system => 'schlock',
sys => 'mercenary'
}
}
sub password {
my ( $server, $instance, $username ) = @_;
use Carp;
$server || croak "Please specify server in $PKG\n";
$instance || croak "Please specify instance in $PKG\n";
$username || croak "Please specify username in $PKG\n";
$passwd{$server}{$instance}{$username};
}
-- Please see the official ORACLE-L FAQ: http://www.orafaq.com -- Author: Orr, Steve INET: sorr_at_rightnow.com Fat City Network Services -- (858) 538-5051 FAX: (858) 538-5051 San Diego, California -- Public Internet access / Mailing Lists -------------------------------------------------------------------- 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 Wed Sep 19 2001 - 11:43:15 CDT
![]() |
![]() |