Slow Performance When Using DBI, otherwise Not
- From: rhugga@xxxxxxxxx (Rhugga Harper)
- Date: Thu, 23 Feb 2006 13:46:28 -0600
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/xxxxx@mysid << 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
- Follow-Ups:
- Re: Slow Performance When Using DBI, otherwise Not
- From: Jared Still
- Re: Slow Performance When Using DBI, otherwise Not
- Prev by Date: perl v5.8.0 DBI core on AIX 5.2
- Next by Date: Using Kerberos enabled connections with Sybase
- Previous by thread: perl v5.8.0 DBI core on AIX 5.2
- Next by thread: Re: Slow Performance When Using DBI, otherwise Not
- Index(es):
Relevant Pages
|
|