Linux安装DBI/DBD-ORACLE

王朝学院·作者佚名  2016-05-26
窄屏简体版  字體: |||超大  

linux安装DBI/DBD-Oracle 2015-06-08 16:38 by 潇湘隐者, ... 阅读, ... 评论, 收藏, 编辑 本文只是学习如何配置PERL DBI、PERL DBD时,整理的一个学习实践文档,大部分参考网上资料,详情请见下面参考资料。 PERL对数据库的支持广而且全,几乎所有的主流数据库都有与之相应的PERL模块支持。为了开发可在不同数据库上移植的PERL应用,DBI(DataBase Interface)模块应运而生,使用这个模块,应用只需使用统一的接口便能操作不同的数据库,真正实现了可移植;当然,这个DBI也配备有相应的开关来支持不同数据库的各种特性。 DBI只是个抽象层,要实现支持不同的数据库,则需要在DBI之下,编写针对不同数据库的驱动。对MySQL来说,有DBD::Mysql, 而对ORACLE来说,则是DBD::Oracle。其中的DBD这是DataBase Driver的简写。 安装顺序是先装DBI,再装DBD::Oracle,DBD::Oracle模块不是Oracle官方开发的,而是由Pythian Group这个很有名的DBA咨询公司组织专人开发,目前的最新版本是1.74,主页在http://www.pythian.com/resources/dba-resources/dbdoracle-PRoject/,读者可以到那里找到关于此模块的最新动态。 1:检查当前系统的Perl版本

[root@getlnx01 ~]# perl -v

This is perl, v5.8.8 built for x86_64-linux-thread-multi

Copyright 1987-2006, Larry Wall

Perl may be copied only under the terms of either the Artistic License or the

GNU General Public License, which may be found in the Perl 5 source kit.

Complete documentation for Perl, including FAQ lists, should be found on

this system using "man perl" or "perldoc perl". If you have access to the

Internet, point your browser at http://www.perl.org/, the Perl Home Page.

2: 检查验证系统中安装了哪些Perl modulescheck.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@getlnx01 tmp]# chmod +x check.pl

[root@getlnx01 tmp]# perl check.pl

Perl -- 5.8.8

3:具体安装步骤

[root@getlnx01 tmp]# tar xvf DBI-1.627.tar

[root@getlnx01 tmp]# cd DBI-1.627

[root@getlnx01 DBI-1.627]# perl Makefile.PL

[root@getlnx01 DBI-1.627]# make

[root@getlnx01 DBI-1.627]# make test

[root@getlnx01 DBI-1.627]# make install

二: 安装DBD-ORACLE组件,安装步骤简单如下所示:

[root@getlnx01 DBI-1.627]# cd /tmp

[root@getlnx01 tmp]# tar zxf DBD-Oracle-1.64.tar

[root@getlnx01 tmp]# cd DBD-Oracle-1.64

[root@getlnx01 DBD-Oracle-1.64]# export ORACLE_HOME=/u01/app/oracle/product/10.2.0/db_1;

[root@getlnx01 DBD-Oracle-1.64]# export PATH=$ORACLE_HOME/bin:$PATH;

[root@DB-Server DBD-Oracle-1.64]# export LD_LIBRARY_PATH=$ORACLE_HOME/lib:/lib:/usr/lib;

[root@DB-Server DBD-Oracle-1.64]# perl Makefile.PL

[root@getlnx01 DBD-Oracle-1.64]# perl Makefile.PL

Using DBI 1.627 (for perl 5.008008 on x86_64-linux-thread-multi) installed in /usr/lib64/perl5/site_perl/5.8.8/x86_64-linux-thread-multi/auto/DBI/

Configuring DBD::Oracle for perl 5.008008 on linux (x86_64-linux-thread-multi)

Remember to actually *READ* the README file! Especially if you have any problems.

Installing on a linux, Ver#2.6

Using Oracle in /u01/app/oracle/product/10.2.0/db_1

DEFINE _SQLPLUS_RELEASE = "1002000400" (CHAR)

Oracle version 10.2.0.4 (10.2)

Found /u01/app/oracle/product/10.2.0/db_1/rdbms/demo/demo_rdbms.mk

Found /u01/app/oracle/product/10.2.0/db_1/rdbms/demo/demo_rdbms64.mk

Found /u01/app/oracle/product/10.2.0/db_1/rdbms/lib/ins_rdbms.mk

Using /u01/app/oracle/product/10.2.0/db_1/rdbms/demo/demo_rdbms.mk

Your LD_LIBRARY_PATH env var is set to '/u01/app/oracle/product/10.2.0/db_1/lib:/lib:/usr/lib'

Reading /u01/app/oracle/product/10.2.0/db_1/rdbms/demo/demo_rdbms.mk

Reading /u01/app/oracle/product/10.2.0/db_1/rdbms/lib/env_rdbms.mk

Attempting to discover Oracle OCI build rules

gcc -c -o DBD_ORA_OBJ.o DBD_ORA_OBJ.c

by executing: [make -f /u01/app/oracle/product/10.2.0/db_1/rdbms/demo/demo_rdbms.mk build ECHODO=echo ECHO=echo GENCLNTSH='echo genclntsh' CC=true OPTIMIZE= CCFLAGS= EXE=DBD_ORA_EXE OBJS=DBD_ORA_OBJ.o]

Oracle oci build command:

 
 
 
免责声明:本文为网络用户发布,其观点仅代表作者个人观点,与本站无关,本站仅提供信息存储服务。文中陈述内容未经本站证实,其真实性、完整性、及时性本站不作任何保证或承诺,请读者仅作参考,并请自行核实相关内容。
 
 
© 2005- 王朝網路 版權所有 導航