I have a Solaris 8 host running perl 5.8 and using DBI version 1.50 and
DBD::Oracle version 1.16. The database is Oracle 10.2.0.1 and runs on a
different host.

If I run this query from a shell script, it completes in under 1 second,
however, using a perl script it takes 5-10 seconds.

Here is the shell script:

#!/bin/bash

ORACLE_HOME=/u01/app/oracle/product/10.2
ORACLE_SID=mysid
SQLPLUS=/u01/app/oracle/product/10.2/bin/sqlplus

$SQLPLUS -s xxxxx/[EMAIL PROTECTED] << EOF
/ as sysdba
SELECT hostname from xxxxx.adc_ait_hosts where status > 0 order by hostname
asc;
quit;
EOF


Here is the perl code to do the same:

$ENV{ORACLE_HOME}       = $_oracle_home;
$ENV{TWO_TASK}          = $_oracle_two_task;
$ENV{TNS_ADMIN}         = $_tns_admin;
my $ds                  = "dbi:Oracle:$_dbsid";
my $dbuser              = $_dbuser;
my $dbpass              = $_dbpass;

my @tapeservers;

my $dbh = DBI->connect($ds, $dbuser, $dbpass);

if (!defined($dbh)) {
        print "Error: main(): database connection failed: $DBI::errstr\n";
        cleanup();
        exit(-1);
}

my $query1      = "SELECT hostname from xxxxx.adc_ait_hosts where status > 0
order by hostname asc ";
my $sth1        = $dbh->prepare($query1) || die "Error: Unable to prepare
query: $DBI::errstr\n";
$sth1->execute();

while ( my @row = $sth1->fetchrow_array)
{
        if ($STRIP) {
                my ($host, $subd, $domain, $sfx) = split(/\./, $row[0]);
                print STDOUT "$host\n";
        } else {
                print STDOUT "$row[0]\n";
        }
}


Can anyone point me in the right direction?

Thx,
CC

Reply via email to