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