Linux下安裝DBI和DBD

來源:互聯網
上載者:User

Linux下安裝DBI和DBD

1. 介質下載
www.cpan.org開啟cpan的首頁,然後點擊search.cpan.org,搜尋DBI和DBD::Oracle
-rw-r--r--  1 oracle  oinstall    592307 Apr  5 00:58 DBI-1.633.tar.gz
-rw-r--r--  1 oracle  oinstall    452537 Apr  5 01:02 DBD-Oracle-1.75_2.tar.gz
2. 安裝DBD::Oracle
[root@ora10g DBI-1.633]# perl Makefile.PL

*** Your LANG environment variable is set to 'en_US.UTF-8'
*** This may cause problems for some perl installations.
*** If you get test failures, please try again with LANG unset.
*** If that then works, please email dbi-dev@perl.org with details
*** including the output of 'perl -V'

Your perl was compiled with gcc (version 4.4.6 20120305 (Red Hat 4.4.6-4)), okay.
Creating test wrappers for DBD::Gofer:
t/zvg_01basics.t
t/zvg_02dbidrv.t
t/zvg_03handle.t
t/zvg_04mods.t
t/zvg_05concathash.t
t/zvg_06attrs.t
t/zvg_07kids.t
t/zvg_08keeperr.t
t/zvg_09trace.t
t/zvg_10examp.t
[root@ora10g DBI-1.633]# make
[root@ora10g DBI-1.633]# make test
Files=182, Tests=0,  5 wallclock secs ( 0.40 usr  0.40 sys +  2.67 cusr  0.75 csys =  4.22 CPU)
Result: FAIL
Failed 176/182 test programs. 0/0 subtests failed.
make: *** [test_dynamic] Error 2
[root@ora10g DBI-1.633]# make install
[root@ora10g perl_script]# chmod u+x list.pl
[root@ora10g perl_script]# ./list.pl
DBI          --  1.633
Perl        --  5.10.1
說明DBI已經安裝好了。
3. 下載並安裝相關oracle軟體包
:http://www.oracle.com/technetwork/topics/linuxsoft-082809.html
因為我的Oracle版本是10.2.0.5,所以下載10205的用戶端軟體包
-rw-r--r--  1 oracle  oinstall    745257 Apr  9 05:39 oracle-instantclient-sqlplus-10.2.0.5-1.i386.rpm
-rw-r--r--  1 oracle  oinstall  32883472 Apr  9 05:40 oracle-instantclient-basic-10.2.0.5-1.i386.rpm
-rw-r--r--  1 oracle  oinstall    289726 Apr  9 05:43 oracle-instantclient-devel-10.2.0.5-1.i386.rpm
[root@ora10g opt]# rpm -ivh oracle-instantclient-basic-10.2.0.5-1.i386.rpm
Preparing...                      ########################################### [100%]
  1:oracle-instantclient-ba########################################### [100%]
[root@ora10g opt]# rpm -ivh oracle-instantclient-devel-10.2.0.5-1.i386.rpm
Preparing...                      ########################################### [100%]
  1:oracle-instantclient-de########################################### [100%]
[root@ora10g opt]# rpm -ivh oracle-instantclient-sqlplus-10.2.0.5-1.i386.rpm
Preparing...                      ########################################### [100%]
  1:oracle-instantclient-sq########################################### [100%]
4. 安裝DBD-Oracle
--關閉監聽,資料庫
[root@ora10g DBD-Oracle-1.75_2]# export ORACLE_HOME=/u01/oracle/product/10.2.0/db_1
[root@ora10g DBD-Oracle-1.75_2]# export LD_LIBRARY_PATH=/u01/oracle/product/10.2.0/db_1/lib:/lib:/usr/lib:/usr/local/lib
[root@ora10g DBD-Oracle-1.75_2]# perl Makefile.PL
Using DBI 1.633 (for perl 5.010001 on i386-linux-thread-multi) installed in /usr/local/lib/perl5/auto/DBI/
Configuring DBD::Oracle for perl 5.010001 on linux (i386-linux-thread-multi)

If you encounter any problem, a collection of troubleshooting
guides are available under lib/DBD/Oracle/Troubleshooting.
'DBD::Oracle::Troubleshooting' is the general troubleshooting
guide, while platform-specific troubleshooting hints
live in their labelled sub-document (e.g., Win32
hints are gathered in 'lib/DBD/Oracle/Troubleshooting/Win32.pod').

Installing on a linux, Ver#2.6
Using Oracle in /u01/oracle/product/10.2.0/db_1
DEFINE _SQLPLUS_RELEASE = "1002000500" (CHAR)
Oracle version 10.2.0.5 (10.2)
Found direct-link candidates: libclntsh.so
Oracle sysliblist: -ldl -lm -lpthread -lnsl -lirc
Found header files in /u01/oracle/product/10.2.0/db_1/rdbms/public.
Your LD_LIBRARY_PATH env var is set to '/u01/oracle/product/10.2.0/db_1/lib:/lib:/usr/lib:/usr/local/lib'

client_version=10.2


DEFINE= -Wall -Wno-comment -DUTF8_SUPPORT -DORA_OCI_VERSION=\"10.2.0.5\" -DORA_OCI_102


Checking for functioning wait.ph


System: perl5.010001 linux x86-022.build.eng.bos.RedHat.com 2.6.18-308.16.1.el5 #1 smp tue sep 18 07:21:07 edt 2012 i686 i686 i386 gnulinux
Compiler:  gcc -O2 -g -pipe -Wall -Wp,-D_FORTIFY_SOURCE=2 -fexceptions -fstack-protector --param=ssp-buffer-size=4 -m32 -march=i686 -mtune=atom -fasynchronous-unwind-tables -D_REENTRANT -D_GNU_SOURCE -fno-strict-aliasing -pipe -fstack-protector -I/usr/local/include -D_LARGEFILE_SOURCE -D_FILE_OFFSET_BITS=64
Linker:    /usr/bin/ld
Sysliblist: -ldl -lm -lpthread -lnsl -lirc
Linking with -lclntsh.

Checking if your kit is complete...
Looks good
LD_RUN_PATH=/u01/oracle/product/10.2.0/db_1/lib
Using DBD::Oracle 1.75_2.
Using DBD::Oracle 1.75_2.
Using DBI 1.633 (for perl 5.010001 on i386-linux-thread-multi) installed in /usr/local/lib/perl5/auto/DBI/
Writing Makefile for DBD::Oracle
[root@ora10g DBD-Oracle-1.75_2]#make
[root@ora10g DBD-Oracle-1.75_2]# make test
Result: FAIL
Failed 38/38 test programs. 0/0 subtests failed.

make: *** [test_dynamic] Error 2
[root@ora10g DBD-Oracle-1.75_2]# make install
[root@ora10g ~]# cd perl_script/
[root@ora10g perl_script]# cat list.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); 
}
exit;
[root@ora10g perl_script]# ./list.pl
DBD::Oracle  --  1.75_2
DBI          --  1.633
Perl        --  5.10.1
說明DBI和DBD已經安裝好了。

Oracle11g下安裝DBD
1.安裝linux_11gR2_examples軟體包
2.設定環境變數
3.安裝DBD::Oracle
4.檢查安裝

本文永久更新連結地址:

相關文章

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.