还可以从cpan.perl.org站点下载tar压缩文件形式的源代码发行版本,解压缩后,切换到相应的文件目录
cd DBI-1.54
perl Makefile.PL
make
make test
make install

安装DBD时候 需要export ORACLE_HOME

验证安装:
perldoc DBD::Oracle
DBD 版本
[oracle@oadb ~]$ perldoc -m DBD::Oracle
perldoc DBI

在线文档;
perldoc -m DBI

perl DBI版本:

perl -MDBI -le 'print $DBI::VERSION;'

查看安装路径:
[oracle@dwh1 ~]$ perldoc -l DBI
/usr/local/lib64/perl5/DBI.pm


配置用户环境变量:
export ORACLE_OWNER=oracle
export ORACLE_BASE=/oracle/app
export ORACLE_HOME=/oracle/app/product/11.2.0/db_1
export ORACLE_SID=dwh1
export LD_LIBRARY_PATH=$ORACLE_HOME/lib:/usr/lib
export NLS_DATE_FORMAT="YYYY-MM-DD"
export PATH=/usr/lib64/qt-3.3/bin:/usr/kerberos/bin:/usr/local/bin:/bin:/usr/bin:/home/oracle/bin:/oracle/app10g/product/10.2.0/db/bin
#####################################################
#export LC_CTYPE=en_US.UTF-8
export NLS_LANG=AMERICAN_AMERICA.ZHS16GBK
CLASSPATH=$ORACLE_HOME/JRE:$ORACLE_HOME/jlib:$ORACLE_HOME/rdbms/jlib;
export CLASSPATH
export JAVA_OPTS=-Djava.awt.headless=true

#!/usr/bin/perl 
use strict;
use DBI;
my $dbName = 'dev2';
my $dbUser = 'hr';
my $dbUserPass = 'hr';
my $dbh = DBI->connect("dbi:Oracle:$dbName", $dbUser, $dbUserPass) or die "can't connect to database " . $DB
my $hostSql = qq{select table_name,tablespace_name,status from user_tables};
#你用print是打印sql语句和sth对象,看到这个说明没有错误
#另外,perl中打印对象或其它复杂数据结构最好用use Data::Dumper;print Dumper $obj;这种形式,要不你就只能看到HA
#$dbh->prepare($sql),只是生成了一个statement handle对象而已,该对象调用execute后,通过它的fetchrow_array()就
#
my $sql = "select count(*) from dba_users";
print "$sql..\n";
my $sth = $dbh->prepare($sql);
print "$sth..\n";

$sth->execute();
my $count = $sth->fetchrow_array();
print "$count....\n";

$sth->finish;

my ($table_name, $tablespace_name, $status);
my $selStmt = $dbh->prepare($hostSql);
$selStmt->bind_columns(undef, \$table_name, \$tablespace_name, \$status);
$selStmt->execute();
while( $selStmt->fetch() ){
  print "$table_name\t\t$tablespace_name\t\t$status\n";
}
$selStmt->finish;
$dbh->disconnect;