Linux下安装DBD::Oracle、DBI和Ora2Pg

简介:

介质下载路径:

DBI:http://www.cpan.org/modules/by-module/DBI/

DBD:http://www.cpan.org/modules/by-module/DBD/

Ora2Pg:https://sourceforge.net/projects/ora2pg/files/

要求:perl 版本5.8以上, perl -v查看版本

使用root用户进行安装

1、安装DBI

    [root@rhel6 DBI-1.627]$ 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.7 20120313 (Red Hat 4.4.7-14)), 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 

    ......

    [root@rhel6 DBI-1.627]$ make

    /usr/bin/perl -MExtUtils::Command -e 'mkpath' -- blib/lib/DBI

    rm -f blib/lib/DBI/Changes.pm

    cp Changes blib/lib/DBI/Changes.pm

    cp Driver_xst.h blib/arch/auto/DBI/Driver_xst.h

    cp lib/DBD/Proxy.pm blib/lib/DBD/Proxy.pm

    cp lib/DBI/Gofer/Response.pm blib/lib/DBI/Gofer/Response.pm

    cp lib/DBI/Util/_accessor.pm blib/lib/DBI/Util/_accessor.pm

    cp lib/DBI/Gofer/Transport/Base.pm blib/lib/DBI/Gofer/Transport/Base.pm

    cp lib/DBD/DBM.pm blib/lib/DBD/DBM.pm

    cp DBIXS.h blib/arch/auto/DBI/DBIXS.h

    cp dbixs_rev.pl blib/lib/dbixs_rev.pl

    cp lib/DBI/Gofer/Serializer/DataDumper.pm blib/lib/DBI/Gofer/Serializer/DataDumper.pm

    cp lib/DBI/Const/GetInfoType.pm blib/lib/DBI/Const/GetInfoType.pm

    cp lib/DBI/DBD/Metadata.pm blib/lib/DBI/DBD/Metadata.pm

    cp lib/DBD/Gofer/Transport/pipeone.pm blib/lib/DBD/Gofer/Transport/pipeone.pm

    cp lib/DBI/Const/GetInfo/ODBC.pm blib/lib/DBI/Const/GetInfo/ODBC.pm

    cp lib/DBI/ProfileDumper/Apache.pm blib/lib/DBI/ProfileDumper/Apache.pm

    cp lib/DBD/File/Roadmap.pod blib/lib/DBD/File/Roadmap.pod

    ......

    [oracle@rhel6 DBI-1.627]$ make test(可选)

    PERL_DL_NONLAZY=1 /usr/bin/perl "-MExtUtils::Command::MM" "-e" "test_harness(0, 'blib/lib', 'blib/arch')" t/*.t

    t/01basics.t .................... ok       

    t/02dbidrv.t .................... ok     

    t/03handle.t .................... ok       

    t/04mods.t ...................... ok     

    t/05concathash.t ................ ok     

    t/06attrs.t ..................... ok       

    t/07kids.t ...................... ok     

    [root@rhel6 DBI-1.627]# make install

    Files found in blib/arch: installing files in blib/lib into architecture dependent library tree

    Installing /usr/local/lib64/perl5/auto/DBI/DBI.bs

    Installing /usr/local/lib64/perl5/auto/DBI/dbixs_rev.h

    Installing /usr/local/lib64/perl5/auto/DBI/dbivport.h

    Installing /usr/local/lib64/perl5/auto/DBI/DBIXS.h

    Installing /usr/local/lib64/perl5/auto/DBI/DBI.so

    Installing /usr/local/lib64/perl5/auto/DBI/dbipport.h

    Installing /usr/local/lib64/perl5/auto/DBI/dbi_sql.h

    Installing /usr/local/lib64/perl5/auto/DBI/dbd_xsh.h

    Installing /usr/local/lib64/perl5/auto/DBI/Driver_xst.h

    Installing /usr/local/lib64/perl5/auto/DBI/Driver.xst

    Installing /usr/local/lib64/perl5/dbixs_rev.pl

    ......

2、安装DBD:Oracle

    配置环境变量

    export ORACLE_BASE=/u02/app/oracle

    export ORACLE_HOME=$ORACLE_BASE/product/11.2.4/db1

    export LD_LIBRARY_PATH=$ORACLE_HOME/lib:$LD_LIBRARY_PATH

    安装

    [root@rhel6 DBD-Oracle-1.74]# perl Makefile.PL 

    Multiple copies of Driver.xst found in: /usr/local/lib64/perl5/auto/DBI/ /usr/lib64/perl5/auto/DBI/ at Makefile.PL line 39

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

    

    Configuring DBD::Oracle for perl 5.010001 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 /u02/app/oracle/product/11.2.4/db1

    DEFINE _SQLPLUS_RELEASE = "1102000400" (CHAR)

    Oracle version 11.2.0.4 (11.2)

    Found /u02/app/oracle/product/11.2.4/db1/rdbms/lib/ins_rdbms.mk

    Using /u02/app/oracle/product/11.2.4/db1/rdbms/lib/ins_rdbms.mk

    Your LD_LIBRARY_PATH env var is set to '/u02/app/oracle/product/11.2.4/db1/lib:'

    ......

    [root@rhel6 DBD-Oracle-1.74]# make

    cp lib/DBD/Oracle/Troubleshooting/Cygwin.pod blib/lib/DBD/Oracle/Troubleshooting/Cygwin.pod

    cp lib/DBD/Oracle.pm blib/lib/DBD/Oracle.pm

    cp Oracle.h blib/arch/auto/DBD/Oracle/Oracle.h

    cp lib/DBD/Oracle/Troubleshooting/Hpux.pod blib/lib/DBD/Oracle/Troubleshooting/Hpux.pod

    cp lib/DBD/Oracle/Troubleshooting/Vms.pod blib/lib/DBD/Oracle/Troubleshooting/Vms.pod

    cp lib/DBD/Oracle/Troubleshooting/Linux.pod blib/lib/DBD/Oracle/Troubleshooting/Linux.pod

    cp lib/DBD/Oracle/GetInfo.pm blib/lib/DBD/Oracle/GetInfo.pm

    cp lib/DBD/Oracle/Troubleshooting.pod blib/lib/DBD/Oracle/Troubleshooting.pod

    cp dbdimp.h blib/arch/auto/DBD/Oracle/dbdimp.h

    cp ocitrace.h blib/arch/auto/DBD/Oracle/ocitrace.h

    cp lib/DBD/Oracle/Troubleshooting/Sun.pod blib/lib/DBD/Oracle/Troubleshooting/Sun.pod

    cp lib/DBD/Oracle/Troubleshooting/Macos.pod blib/lib/DBD/Oracle/Troubleshooting/Macos.pod

    cp lib/DBD/Oracle/Troubleshooting/Aix.pod blib/lib/DBD/Oracle/Troubleshooting/Aix.pod

    cp lib/DBD/Oracle/Object.pm blib/lib/DBD/Oracle/Object.pm

    cp lib/DBD/Oracle/Troubleshooting/Win64.pod blib/lib/DBD/Oracle/Troubleshooting/Win64.pod

    cp lib/DBD/Oracle/Troubleshooting/Win32.pod blib/lib/DBD/Oracle/Troubleshooting/Win32.pod

    cp mk.pm blib/arch/auto/DBD/Oracle/mk.pm

    ......

    [root@rhel6 DBD-Oracle-1.74]# make test(可选)

    PERL_DL_NONLAZY=1 /usr/bin/perl "-MExtUtils::Command::MM" "-e" "test_harness(0, 'blib/lib', 'blib/arch')" t/*.t

    t/000-report-versions-tiny.t .. # 

    # 

    # Generated by Dist::Zilla::Plugin::ReportVersions::Tiny v1.10

    # perl: 5.010001 (wanted 5.006) on linux from /usr/bin/perl

    # 

    # B                                             => 1.22       (want any version)

    # Carp                                          => 1.11       (want any version)

    # DBI                                           => 1.627      (want 1.51)   

    ......

    [root@rhel6 DBD-Oracle-1.74]# make install

    Files found in blib/arch: installing files in blib/lib into architecture dependent library tree

    Installing /usr/local/lib64/perl5/auto/DBD/Oracle/Oracle.h

    Installing /usr/local/lib64/perl5/auto/DBD/Oracle/dbdimp.h

    Installing /usr/local/lib64/perl5/auto/DBD/Oracle/Oracle.bs

    Installing /usr/local/lib64/perl5/auto/DBD/Oracle/mk.pm

    Installing /usr/local/lib64/perl5/auto/DBD/Oracle/Oracle.so

    Installing /usr/local/lib64/perl5/auto/DBD/Oracle/ocitrace.h

    Installing /usr/local/lib64/perl5/DBD/Oracle.pm

    Installing /usr/local/lib64/perl5/DBD/Oracle/GetInfo.pm

    Installing /usr/local/lib64/perl5/DBD/Oracle/Object.pm

    Installing /usr/local/lib64/perl5/DBD/Oracle/Troubleshooting.pod

    Installing /usr/local/lib64/perl5/DBD/Oracle/Troubleshooting/Win64.pod

    Installing /usr/local/lib64/perl5/DBD/Oracle/Troubleshooting/Sun.pod

    Installing /usr/local/lib64/perl5/DBD/Oracle/Troubleshooting/Win32.pod

    Installing /usr/local/lib64/perl5/DBD/Oracle/Troubleshooting/Hpux.pod

    ......

3、检查脚本list.pl

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
[root@rhel6 ~] # 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@rhel6 ~] # perl list.pl 
DBD::Oracle  --  1.74
DBI          --  1.627
Perl         --  5.10.1

    DBD::Oracle和DBI安装完成

4、安装ora2pt

    [root@rhel6 ora2pg-17.6]$ perl Makefile.PL 

    Checking if your kit is complete...

    Looks good

    Writing Makefile for Ora2Pg

    

    Done...

    ------------------------------------------------------------------------------

    Please read documentation at http://ora2pg.darold.net/ before asking for help

    ------------------------------------------------------------------------------

    Now type: make && make install

    [root@rhel6 ora2pg-17.6]# make && make install 

    Installing /usr/local/share/perl5/Ora2Pg.pm

    Installing /usr/local/share/perl5/Ora2Pg/PLSQL.pm

    Installing /usr/local/share/perl5/Ora2Pg/MySQL.pm

    Installing /usr/local/share/perl5/Ora2Pg/GEOM.pm

    Installing /usr/local/share/man/man3/ora2pg.3

    Installing /usr/local/bin/ora2pg

    Installing /usr/local/bin/ora2pg_scanner

    Installing default configuration file (ora2pg.conf.dist) to /etc/ora2pg

    Appending installation info to /usr/lib64/perl5/perllocal.pod

检查,DBD::Oracle DBI Ora2Pg安装完成

    [root@rhel6 ~]# perl list.pl 

    DBD::Oracle  --  1.74

    DBI          --  1.627

    Ora2Pg       --  17.6b

    Perl         --  5.10.1

使用Ora2Pg从Oracle导数据到PostgreSQL参考:http://hbxztc.blog.51cto.com/1587495/1880339

参考文档:

http://www.askoracle.org/oracle/backup/1009.html

http://blog.sina.com.cn/s/blog_a32eff280102vmpn.html





     本文转自hbxztc 51CTO博客,原文链接:http://blog.51cto.com/hbxztc/1879227,如需转载请自行联系原作者




相关文章
|
1月前
|
Oracle Cloud Native 关系型数据库
Oracle Linux 9.5 正式版发布 - Oracle 提供支持 RHEL 兼容发行版
Oracle Linux 9.5 正式版发布 - Oracle 提供支持 RHEL 兼容发行版
64 10
Oracle Linux 9.5 正式版发布 - Oracle 提供支持 RHEL 兼容发行版
|
1月前
|
监控 Oracle 关系型数据库
Linux平台Oracle开机自启动设置
【11月更文挑战第8天】在 Linux 平台设置 Oracle 开机自启动有多种方法,本文以 CentOS 为例,介绍了两种常见方法:使用 `rc.local` 文件(较简单但不推荐用于生产环境)和使用 `systemd` 服务(推荐)。具体步骤包括编写启动脚本、赋予执行权限、配置 `rc.local` 或创建 `systemd` 服务单元文件,并设置开机自启动。通过 `systemd` 方式可以更好地与系统启动过程集成,更规范和可靠。
117 2
|
1月前
|
Oracle Ubuntu 关系型数据库
Linux平台Oracle开机自启动设置
【11月更文挑战第7天】本文介绍了 Linux 系统中服务管理机制,并详细说明了如何在使用 systemd 和 System V 的系统上设置 Oracle 数据库的开机自启动。包括创建服务单元文件、编辑启动脚本、设置开机自启动和启动服务的具体步骤。最后建议重启系统验证设置是否成功。
|
2月前
|
存储 Oracle 关系型数据库
|
2月前
|
Oracle 关系型数据库 网络安全
Oracle 19c 安装教程学习
Oracle 19c 安装教程学习
92 2
|
4月前
|
机器学习/深度学习 Oracle 关系型数据库
Oracle 19c单机一键安装脚本分享
Oracle 19c单机一键安装脚本分享
243 2
|
5月前
|
Oracle 关系型数据库 Linux
讲解linux下的Qt如何编译oracle的驱动库libqsqloci.so
通过这一连串的步骤,可以专业且有效地在Linux下为Qt编译Oracle驱动库 `libqsqloci.so`,使得Qt应用能够通过OCI与Oracle数据库进行交互。这些步骤适用于具备一定Linux和Qt经验的开发者,并且能够为需要使用Qt开发数据库应用的专业人士提供指导。
181 1
讲解linux下的Qt如何编译oracle的驱动库libqsqloci.so
|
5月前
|
SQL Oracle 关系型数据库
MySQL、SQL Server和Oracle数据库安装部署教程
数据库的安装部署教程因不同的数据库管理系统(DBMS)而异,以下将以MySQL、SQL Server和Oracle为例,分别概述其安装部署的基本步骤。请注意,由于软件版本和操作系统的不同,具体步骤可能会有所变化。
388 3
|
5月前
|
SQL Oracle 关系型数据库
Oracle数据库基础教程:从安装到基本操作的全面介绍
Oracle数据库基础教程:从安装到基本操作的全面介绍
|
Oracle 网络协议 关系型数据库
linux安装oracle client客户端远程连接数据库
  linux安装oracle client客户端远程连接数据库。   1.到oracle官网下载basic,sqlplus,devel三个软件包   oracle-instantclient11.2-basic-11.2.0.4.0-1.x86_64.tar   oracle-instantclient11.2-sqlplus-11.2.0.4.0-1.x86_64.tar   oracle-instantclient11.2-devel-11.2.0.4.0-1.x86_64.tar   2.到root用户下创建一个oracle文件夹
497 0