Urgent Please help me out here!!!

Hi,

Without using DBI/DBD, i need to run the given below script in PERL in different oracle databases in a single server.

PERL Script:

#!usr/bin/perl -w
 
$c=`ps -ef |grep -v grep|grep pmon|sed -e 's/.*_//|sort -u >dbname.log`;
$cnt=`ps -ef |grep -v grep|grep pmon|sed -e 's/.*_//|sort -u |awk 'END {print NR-0}'`;
$qry=`sqlplus "/as sysdba" <<EOF
select name from v\\\\$database;
exit;
EOF`;
$i=1;
while($i<=$cnt)
{
$dbn=`awk 'NR==$i' dbname.log`;
$dbname = trim($dbn);
$p=`cat /etc/oratab |grep $dbname|grep -v "#"|gawk -F: {print \$2'}`;
$ENV{'ORACLE_SID'}="$dbname";
$ENV{'ORACLE_HOME'}="$p";
print $qry;
$i++;
}
exit 0;
 
sub trim 
{
my $s = shift;
$s =~s/^\s+|\s+$//g;
return $s;
}

the given result is unable to export ORACLE_SID,ORACLE_HOME? so no output.one more question please let me know how to set this parameter ORACLE_SID,ORACLE_HOME and PATH.

Thanks,
Appu Ramu

Suggest you take a look at:
Environment variables in Perl / use Env

Hence Not working...

Have you got the env perl module installed?

Hi,

i have mention that we don't install DBI,DBD,ENV...etc.
please do let know any idea
Thanks,
Appu

You will need the ENV Perl module if you want to make your script work.

tyler_durden

In the HP-UX Server, we are not allow to install any package for PERL.
That why i'm trying to set the given parameter.

i have already work out using DBI,DBD is working fine.

and the question it should be work with default package with coming under perl intallation and not includes ENV,DBD,DBI...etc packages in the BOX.