一、安装DBI
DBI(Database Interface)是perl连接数据库的接口。其是perl连接数据库的最优
方法,他支持包括Orcale,Sybase,mysql,db2等绝大多数的数据库,下面将简要
介绍其安装方法。

1.1解压
tar -zxvf DBI-1.616_901.tar.gz

1.2安装依赖
yum install perl-ExtUtils-CBuilder perl-ExtUtils-MakeMaker
yum install perl-Test-Simple-0.98-243.el7.noarch.rpm
yum install gcc
1.3进入目录
cd DBI-1.616/

1.4编译
perl MakefIle.PL
make

1.5执行测试
make test

1.6安装
make install

二、安装DBD:oracle
DBI只是个抽象层,要实现支持不同的数据库,则需要在DBI之下,编写针对不同数据库的驱动,对MySql来说,有DBD::Mysql, 而对Oracle来说,则是DBD::Oracle。其中的DBD这是DataBase Driver之简写

2.1解压
tar -zxvf DBD-Oracle-1.36.tar.gz

2.2环境变量设置(按照真实环境修改)
export ORACLE_HOME=/oracle/app/product/19.3.0/db_1
export LD_LIBRARY_PATH=$ORACLE_HOME/lib:/usr/lib
export TNS_ADMIN=$ORACLE_HOME/network/admin
export ORACLE_USERID=def/oracle
export ORACLE_SID=orcl
export ORACLE_BASE=/oracle/app
2.3进去目录
cd DBD-1.36/

2.4编译
perl MakefIle.PL
make

2.5执行测试
make test

2.6安装
make install

三、测试
3.1创建测试文件
vi check.pl
内容如下:

!/usr/bin/perl
use strict;
use ExtUtils::Installed;
my $inst=ExtUtils::Installed->new();
my @modules = $inst->modules();
foreach(@modules){

my $ver = $inst->version($_) || "???";
printf("%-12s -- %s\n",$_,$ver);
}
3.2给予权限
chmod +x check.pl

3.3进行检测
perl check.pl
结果如下:
DBD::Oracle -- 1.70
DBI -- 1.642
Perl -- 5.16.3
https://weibo.com/ttarticle/p/show?id=2309405149093231198414
https://weibo.com/ttarticle/p/show?id=2309405149093327405120
https://weibo.com/ttarticle/p/show?id=2309405149093424136416
https://weibo.com/ttarticle/p/show?id=2309405149093520605746
https://weibo.com/ttarticle/p/show?id=2309405149093617074720
https://weibo.com/ttarticle/p/show?id=2309405149093713543291
https://weibo.com/ttarticle/p/show?id=2309405149093906219111
https://weibo.com/ttarticle/p/show?id=2309405149094007144630
https://weibo.com/ttarticle/p/show?id=2309405149094103613511
https://weibo.com/ttarticle/p/show?id=2309405149094200082756
https://weibo.com/ttarticle/p/show?id=2309405149094296551501
https://weibo.com/ttarticle/p/show?id=2309405149094396952584
https://weibo.com/ttarticle/p/show?id=2309405149094493683732
https://weibo.com/ttarticle/p/show?id=2309405149094585696336
https://weibo.com/ttarticle/p/show?id=2309405149094686621726
https://weibo.com/ttarticle/p/show?id=2309405149094783090728
https://weibo.com/ttarticle/p/show?id=2309405149094879560144
https://weibo.com/ttarticle/p/show?id=2309405149094976028817
https://weibo.com/ttarticle/p/show?id=2309405149095168967076
https://weibo.com/ttarticle/p/show?id=2309405149095361905126
https://weibo.com/ttarticle/p/show?id=2309405149095458111624
https://weibo.com/ttarticle/p/show?id=2309405149095554843198
https://weibo.com/ttarticle/p/show?id=2309405149095655505938
https://weibo.com/ttarticle/p/show?id=2309405149095751974930
https://weibo.com/ttarticle/p/show?id=2309405149095944650916
https://weibo.com/ttarticle/p/show?id=2309405149096041382590
https://weibo.com/ttarticle/p/show?id=2309405149096238252168
https://weibo.com/ttarticle/p/show?id=2309405149096435646544
https://weibo.com/ttarticle/p/show?id=2309405149096532116074
https://weibo.com/ttarticle/p/show?id=2309405149096628322428
https://weibo.com/ttarticle/p/show?id=2309405149096725053938
https://weibo.com/ttarticle/p/show?id=2309405149096821522609
https://weibo.com/ttarticle/p/show?id=2309405149097018654828
https://weibo.com/ttarticle/p/show?id=2309405149097119318188
https://weibo.com/ttarticle/p/show?id=2309405149097215787210
https://weibo.com/ttarticle/p/show?id=2309405149097312256117
https://weibo.com/ttarticle/p/show?id=2309405149097408725472
https://weibo.com/ttarticle/p/show?id=2309405149097505194556
https://weibo.com/ttarticle/p/show?id=2309405149097702326914
https://weibo.com/ttarticle/p/show?id=2309405149097802989574
https://weibo.com/ttarticle/p/show?id=2309405149097899458587
https://weibo.com/ttarticle/p/show?id=2309405149097995927651
https://weibo.com/ttarticle/p/show?id=2309405149098092396649
https://weibo.com/ttarticle/p/show?id=2309405149098188865824
https://weibo.com/ttarticle/p/show?id=2309405149098285334902
https://weibo.com/ttarticle/p/show?id=2309405149098381804046
https://weibo.com/ttarticle/p/show?id=2309405149098478272952
https://weibo.com/ttarticle/p/show?id=2309405149098578935832
https://weibo.com/ttarticle/p/show?id=2309405149098675404821
https://weibo.com/ttarticle/p/show?id=2309405149098771611694
https://weibo.com/ttarticle/p/show?id=2309405149099107418628
https://weibo.com/ttarticle/p/show?id=2309405149099304550596
https://weibo.com/ttarticle/p/show?id=2309405149099401019473
https://weibo.com/ttarticle/p/show?id=2309405149099598151700
https://weibo.com/ttarticle/p/show?id=2309405149099694358554
https://weibo.com/ttarticle/p/show?id=2309405149099791089888
https://weibo.com/ttarticle/p/show?id=2309405149099887558924
https://weibo.com/ttarticle/p/show?id=2309405149099984027695
https://weibo.com/ttarticle/p/show?id=2309405149100080496707
https://weibo.com/ttarticle/p/show?id=2309405149100181160310
https://weibo.com/ttarticle/p/show?id=2309405149100277629334
https://weibo.com/ttarticle/p/show?id=2309405149100474761239
https://weibo.com/ttarticle/p/show?id=2309405149100671893712
https://weibo.com/ttarticle/p/show?id=2309405149100772556818
https://weibo.com/ttarticle/p/show?id=2309405149100869025846
https://weibo.com/ttarticle/p/show?id=2309405149100965494868
https://weibo.com/ttarticle/p/show?id=2309405149101061701658
https://weibo.com/ttarticle/p/show?id=2309405149101158432843
https://weibo.com/ttarticle/p/show?id=2309405149101254901994
https://weibo.com/ttarticle/p/show?id=2309405149101351370791
https://weibo.com/ttarticle/p/show?id=2309405149101447839982
https://weibo.com/ttarticle/p/show?id=2309405149101544308968
https://weibo.com/ttarticle/p/show?id=2309405149101640777976
https://weibo.com/ttarticle/p/show?id=2309405149101737247178
https://weibo.com/ttarticle/p/show?id=2309405149101833716412
https://weibo.com/ttarticle/p/show?id=2309405149101934379052
https://weibo.com/ttarticle/p/show?id=2309405149102030848180
https://weibo.com/ttarticle/p/show?id=2309405149102319992921
https://weibo.com/ttarticle/p/show?id=2309405149102416724354
https://weibo.com/ttarticle/p/show?id=2309405149102517125132
https://weibo.com/ttarticle/p/show?id=2309405149102722908526
https://weibo.com/ttarticle/p/show?id=2309405149102819115072
https://weibo.com/ttarticle/p/show?id=2309405149102915846526
https://weibo.com/ttarticle/p/show?id=2309405149103024635935
https://weibo.com/ttarticle/p/show?id=2309405149103121367099
https://weibo.com/ttarticle/p/show?id=2309405149103217573991
https://weibo.com/ttarticle/p/show?id=2309405149103314042964
https://weibo.com/ttarticle/p/show?id=2309405149103414968484
https://weibo.com/ttarticle/p/show?id=2309405149103511437522
https://weibo.com/ttarticle/p/show?id=2309405149103612100707
https://weibo.com/ttarticle/p/show?id=2309405149103905702236
https://weibo.com/ttarticle/p/show?id=2309405149104001908755
https://weibo.com/ttarticle/p/show?id=2309405149104195108913
https://weibo.com/ttarticle/p/show?id=2309405149104291578262
https://weibo.com/ttarticle/p/show?id=2309405149104387784780
https://weibo.com/ttarticle/p/show?id=2309405149104488710686
https://weibo.com/ttarticle/p/show?id=2309405149104589111374
https://weibo.com/ttarticle/p/show?id=2309405149104685580354
https://weibo.com/ttarticle/p/show?id=2309405149104782049334
https://weibo.com/ttarticle/p/show?id=2309405149104882974876
https://weibo.com/ttarticle/p/show?id=2309405149104991764489
https://weibo.com/ttarticle/p/show?id=2309405149105092690004
https://weibo.com/ttarticle/p/show?id=2309405149105188896801
https://weibo.com/ttarticle/p/show?id=2309405149105382096937
https://weibo.com/ttarticle/p/show?id=2309405149105583423784
https://weibo.com/ttarticle/p/show?id=2309405149105679630367
https://weibo.com/ttarticle/p/show?id=2309405149105776361786
https://weibo.com/ttarticle/p/show?id=2309405149105872830696
https://weibo.com/ttarticle/p/show?id=2309405149105969299786
https://weibo.com/ttarticle/p/show?id=2309405149106179014759
https://weibo.com/ttarticle/p/show?id=2309405149106380079144
https://weibo.com/ttarticle/p/show?id=2309405149106476810381
https://weibo.com/ttarticle/p/show?id=2309405149106573279908
https://weibo.com/ttarticle/p/show?id=2309405149106673680398
https://weibo.com/ttarticle/p/show?id=2309405149106774606006
https://weibo.com/ttarticle/p/show?id=2309405149106871074974
https://weibo.com/ttarticle/p/show?id=2309405149106971476003
https://weibo.com/ttarticle/p/show?id=2309405149107068207416
https://weibo.com/ttarticle/p/show?id=2309405149107164413982
https://weibo.com/ttarticle/p/show?id=2309405149107261145133
https://weibo.com/ttarticle/p/show?id=2309405149107357351984
https://weibo.com/ttarticle/p/show?id=2309405149107458277489
https://weibo.com/ttarticle/p/show?id=2309405149107558940724
https://weibo.com/ttarticle/p/show?id=2309405149107655409687
https://weibo.com/ttarticle/p/show?id=2309405149107751616553
https://weibo.com/ttarticle/p/show?id=2309405149107848347946
https://weibo.com/ttarticle/p/show?id=2309405149108045480254
https://weibo.com/ttarticle/p/show?id=2309405149108238155861
https://weibo.com/ttarticle/p/show?id=2309405149108431356622
https://weibo.com/ttarticle/p/show?id=2309405149108532019259
https://weibo.com/ttarticle/p/show?id=2309405149108628488374
https://weibo.com/ttarticle/p/show?id=2309405149108724957298
https://weibo.com/ttarticle/p/show?id=2309405149108821426540
https://weibo.com/ttarticle/p/show?id=2309405149108917895544
https://weibo.com/ttarticle/p/show?id=2309405149109018558650
https://weibo.com/ttarticle/p/show?id=2309405149109114765364
https://weibo.com/ttarticle/p/show?id=2309405149109211496930
https://weibo.com/ttarticle/p/show?id=2309405149109307966020
https://weibo.com/ttarticle/p/show?id=2309405149109404172397
https://weibo.com/ttarticle/p/show?id=2309405149109505097745
https://weibo.com/ttarticle/p/show?id=2309405149109601567174
https://weibo.com/ttarticle/p/show?id=2309405149109698036018
https://weibo.com/ttarticle/p/show?id=2309405149109794504816
https://weibo.com/ttarticle/p/show?id=2309405149109890711582
https://weibo.com/ttarticle/p/show?id=2309405149109987442934
https://weibo.com/ttarticle/p/show?id=2309405149110083912004
https://weibo.com/ttarticle/p/show?id=2309405149110180380886
https://weibo.com/ttarticle/p/show?id=2309405149110276850046
https://weibo.com/ttarticle/p/show?id=2309405149110373318910
https://weibo.com/ttarticle/p/show?id=2309405149110473719936
https://weibo.com/ttarticle/p/show?id=2309405149110574645273
https://weibo.com/ttarticle/p/show?id=2309405149110675308800
https://weibo.com/ttarticle/p/show?id=2309405149110771515459
https://weibo.com/ttarticle/p/show?id=2309405149110972842026
https://weibo.com/ttarticle/p/show?id=2309405149111069573620
https://weibo.com/ttarticle/p/show?id=2309405149111404855371
https://weibo.com/ttarticle/p/show?id=2309405149111501586744
https://weibo.com/ttarticle/p/show?id=2309405149111598055862
https://weibo.com/ttarticle/p/show?id=2309405149111698718982
https://weibo.com/ttarticle/p/show?id=2309405149111795187826
https://weibo.com/ttarticle/p/show?id=2309405149111891394628
https://weibo.com/ttarticle/p/show?id=2309405149111988126208
https://weibo.com/ttarticle/p/show?id=2309405149112084595268
https://weibo.com/ttarticle/p/show?id=2309405149112281464899
https://weibo.com/ttarticle/p/show?id=2309405149112377933959
https://weibo.com/ttarticle/p/show?id=2309405149112478859528
https://weibo.com/ttarticle/p/show?id=2309405149112575328688
https://weibo.com/ttarticle/p/show?id=2309405149112768266766
https://weibo.com/ttarticle/p/show?id=2309405149112864735678
https://weibo.com/ttarticle/p/show?id=2309405149113057673343
https://weibo.com/ttarticle/p/show?id=2309405149113158074384
https://weibo.com/ttarticle/p/show?id=2309405149113254543382
https://weibo.com/ttarticle/p/show?id=2309405149113351274862
https://weibo.com/ttarticle/p/show?id=2309405149113447743922
https://weibo.com/ttarticle/p/show?id=2309405149113544212639
https://weibo.com/ttarticle/p/show?id=2309405149113640681984
https://weibo.com/ttarticle/p/show?id=2309405149113741344868
https://weibo.com/ttarticle/p/show?id=2309405149113841746142
https://weibo.com/ttarticle/p/show?id=2309405149113938215140
https://weibo.com/ttarticle/p/show?id=2309405149114039140696
https://weibo.com/ttarticle/p/show?id=2309405149114135609732
https://weibo.com/ttarticle/p/show?id=2309405149114231816414
https://weibo.com/ttarticle/p/show?id=2309405149114328285414
https://weibo.com/ttarticle/p/show?id=2309405149114424754394
https://weibo.com/ttarticle/p/show?id=2309405149114529611820
https://weibo.com/ttarticle/p/show?id=2309405149114630537570
https://weibo.com/ttarticle/p/show?id=2309405149114731200654
https://weibo.com/ttarticle/p/show?id=2309405149114827669958
https://weibo.com/ttarticle/p/show?id=2309405149114923876453
https://weibo.com/ttarticle/p/show?id=2309405149115125465160
https://weibo.com/ttarticle/p/show?id=2309405149115221671952
https://weibo.com/ttarticle/p/show?id=2309405149115318403100
https://weibo.com/ttarticle/p/show?id=2309405149115414872206
https://weibo.com/ttarticle/p/show?id=2309405149115511341356
https://weibo.com/ttarticle/p/show?id=2309405149115612004376
https://weibo.com/ttarticle/p/show?id=2309405149115708211217
https://weibo.com/ttarticle/p/show?id=2309405149115804942614
https://weibo.com/ttarticle/p/show?id=2309405149115901411425
https://weibo.com/ttarticle/p/show?id=2309405149115997880387
https://weibo.com/ttarticle/p/show?id=2309405149116098543818
https://weibo.com/ttarticle/p/show?id=2309405149116291481651
https://weibo.com/ttarticle/p/show?id=2309405149116387688507
https://weibo.com/ttarticle/p/show?id=2309405149116484157502
https://weibo.com/ttarticle/p/show?id=2309405149116580626492
https://weibo.com/ttarticle/p/show?id=2309405149116677357603
https://weibo.com/ttarticle/p/show?id=2309405149116773826597
https://weibo.com/ttarticle/p/show?id=2309405149116870295808
https://weibo.com/ttarticle/p/show?id=2309405149116966764994
https://weibo.com/ttarticle/p/show?id=2309405149117159440489
https://weibo.com/ttarticle/p/show?id=2309405149117255909510
https://weibo.com/ttarticle/p/show?id=2309405149117352641114
https://weibo.com/ttarticle/p/show?id=2309405149117453041729
https://weibo.com/ttarticle/p/show?id=2309405149117549510773
https://weibo.com/ttarticle/p/show?id=2309405149117646242306
https://weibo.com/ttarticle/p/show?id=2309405149117746905556
https://weibo.com/ttarticle/p/show?id=2309405149117939580986
https://weibo.com/ttarticle/p/show?id=2309405149118132519040
https://weibo.com/ttarticle/p/show?id=2309405149118229250560
https://weibo.com/ttarticle/p/show?id=2309405149118329913456
https://weibo.com/ttarticle/p/show?id=2309405149118426382450
https://weibo.com/ttarticle/p/show?id=2309405149118522851402
https://weibo.com/ttarticle/p/show?id=2309405149118619320382
https://weibo.com/ttarticle/p/show?id=2309405149118715789447
https://weibo.com/ttarticle/p/show?id=2309405149118812258856
https://weibo.com/ttarticle/p/show?id=2309405149118908727596
https://weibo.com/ttarticle/p/show?id=2309405149119005196894
https://weibo.com/ttarticle/p/show?id=2309405149119105859782
https://weibo.com/ttarticle/p/show?id=2309405149119202066463
https://weibo.com/ttarticle/p/show?id=2309405149119298798004
https://weibo.com/ttarticle/p/show?id=2309405149119395267156
https://weibo.com/ttarticle/p/show?id=2309405149119491473541
https://weibo.com/ttarticle/p/show?id=2309405149119781142936
https://weibo.com/ttarticle/p/show?id=2309405149119877611637
https://weibo.com/ttarticle/p/show?id=2309405149119973818466
https://weibo.com/ttarticle/p/show?id=2309405149120074743814
https://weibo.com/ttarticle/p/show?id=2309405149120175407128
https://weibo.com/ttarticle/p/show?id=2309405149120271613980
https://weibo.com/ttarticle/p/show?id=2309405149120469008772
https://weibo.com/ttarticle/p/show?id=2309405149120582254614
https://weibo.com/ttarticle/p/show?id=2309405149120678723680
https://weibo.com/ttarticle/p/show?id=2309405149120775192778
https://weibo.com/ttarticle/p/show?id=2309405149120871661696
https://weibo.com/ttarticle/p/show?id=2309405149121064599988
https://weibo.com/ttarticle/p/show?id=2309405149121161068920
https://weibo.com/ttarticle/p/show?id=2309405149121261732418
https://weibo.com/ttarticle/p/show?id=2309405149121362395490
https://weibo.com/ttarticle/p/show?id=2309405149121458602028
https://weibo.com/ttarticle/p/show?id=2309405149121555333211
https://weibo.com/ttarticle/p/show?id=2309405149121752203277
https://weibo.com/ttarticle/p/show?id=2309405149121848934411
https://weibo.com/ttarticle/p/show?id=2309405149121945403526
https://weibo.com/ttarticle/p/show?id=2309405149122041872470
https://weibo.com/ttarticle/p/show?id=2309405149122242936836
https://weibo.com/ttarticle/p/show?id=2309405149122339667986
https://weibo.com/ttarticle/p/show?id=2309405149122532606200
https://weibo.com/ttarticle/p/show?id=2309405149122629075470
https://weibo.com/ttarticle/p/show?id=2309405149122725544426
https://weibo.com/ttarticle/p/show?id=2309405149122826207258
https://weibo.com/ttarticle/p/show?id=2309405149122922676270
https://weibo.com/ttarticle/p/show?id=2309405149123019145324
https://weibo.com/ttarticle/p/show?id=2309405149123115614221
https://weibo.com/ttarticle/p/show?id=2309405149123211821128
https://weibo.com/ttarticle/p/show?id=2309405149123405021570
https://weibo.com/ttarticle/p/show?id=2309405149123505684490
https://weibo.com/ttarticle/p/show?id=2309405149123614474275
https://weibo.com/ttarticle/p/show?id=2309405149123711205574
https://weibo.com/ttarticle/p/show?id=2309405149123807674544
https://weibo.com/ttarticle/p/show?id=2309405149123903881289
https://weibo.com/ttarticle/p/show?id=2309405149124101275886
https://weibo.com/ttarticle/p/show?id=2309405149124201938950
https://weibo.com/ttarticle/p/show?id=2309405149124298407973
https://weibo.com/ttarticle/p/show?id=2309405149124394877154
https://weibo.com/ttarticle/p/show?id=2309405149124491346566
https://weibo.com/ttarticle/p/show?id=2309405149124592009256
https://weibo.com/ttarticle/p/show?id=2309405149124692672530
https://weibo.com/ttarticle/p/show?id=2309405149124789141528
https://weibo.com/ttarticle/p/show?id=2309405149124885610572
https://weibo.com/ttarticle/p/show?id=2309405149124982079509
https://weibo.com/ttarticle/p/show?id=2309405149125078548523
https://weibo.com/ttarticle/p/show?id=2309405149125179211786
https://weibo.com/ttarticle/p/show?id=2309405149125275680828
https://weibo.com/ttarticle/p/show?id=2309405149125372150058
https://weibo.com/ttarticle/p/show?id=2309405149125468619074
https://weibo.com/ttarticle/p/show?id=2309405149125565088110
https://weibo.com/ttarticle/p/show?id=2309405149125661557236
https://weibo.com/ttarticle/p/show?id=2309405149125762220342
https://weibo.com/ttarticle/p/show?id=2309405149125858689470
https://weibo.com/ttarticle/p/show?id=2309405149125955158378
https://weibo.com/ttarticle/p/show?id=2309405149126051364992
https://weibo.com/ttarticle/p/show?id=2309405149126152290342
https://weibo.com/ttarticle/p/show?id=2309405149126248759348


程序员小锋
1 声望1 粉丝