资讯

精准传达 • 有效沟通

从品牌网站建设到网络营销策划,从策略到执行的一站式服务

ora2pg的使用(一、centos下的安装)-创新互联

1、Requirement

坚守“ 做人真诚 · 做事靠谱 · 口碑至上 · 高效敬业 ”的价值观,专业网站建设服务10余年为成都咖啡厅设计小微创业公司专业提供成都定制网页设计营销网站建设商城网站建设手机网站建设小程序网站建设网站改版,从内容策划、视觉设计、底层架构、网页布局、功能开发迭代于一体的高端网站建设服务。
[root@centos1 ~]# perl -v
This is perl 5, version 16, subversion 3 (v5.16.3) built for x86_64-linux-thread-multi(with 38 registered patches, see perl -V for more detail)
[root@centos1 ~]# gcc -vUsing built-in specs.COLLECT_GCC=gccCOLLECT_LTO_WRAPPER=/usr/local/gcc-9.2.0/libexec/gcc/x86_64-pc-linux-gnu/9.2.0/lto-wrapperTarget: x86_64-pc-linux-gnugcc version 9.2.0 (GCC)
[root@centos1 ~]# yum install perl-DBI perl-DBD-Pg perl-ExtUtils-MakeMaker  perl-Time-HiRes

2、 安装Oracle客户端或者服务端(这里是已经安装了oracle11g服务端)

参考 /tupian/20230521/7213845.html

配置root用户下 Oracle环境变量,因为准备将ora2pg在root下执行

[root@centos1 ~]# echo $ORACLE_HOME
/u01/app/oracle/product/11.2.0/dbhome_1
[root@centos1 ~]# echo $LD_LIBRARY_PATH
/u01/app/oracle/product/11.2.0/dbhome_1/lib:/lib:/usr/lib
[root@centos1 DBD-Oracle-1.80]# echo $ORACLE_BASE
/u01/app/oracle

3 、安装DBI,DBD::Oracle
DBI只是个抽象层,要实现支持不同的数据库,则需要在DBI之下,编写针对不同数据库的驱动。对MySql来说,有DBD::Mysql, 而对ORACLE来说,则是DBD::Oracle。其中的DBD这是DataBase Driver的简写。安装顺序是先装DBI,再装DBD::Oracle
介质下载路径:

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

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

安装DBI

[root@centos1 opt]# tar -zxvf DBI-1.642.tar.gz
[root@centos1 opt]# cd DBI-1.642/
[root@centos1 DBI-1.642]# perl Makefile.PL   I see you're using perl 5.016003 on x86_64-linux-thread-multi, okay.    Remember to actually *read* the README file!    Use  'make' to build the software (dmake or nmake on Windows).    Then 'make test' to execute self tests.    Then 'make install' to install the DBI and then delete this working    directory before unpacking and building any DBD::* drivers.
Writing Makefile for DBI
[root@centos1 DBI-1.642]# make
[root@centos1 DBI-1.642]# make install

安装DBD:Oracle

[root@centos1 opt]# tar zxvf DBD-Oracle-1.80.tar.gz
[root@centos1 DBD-Oracle-1.80]# perl Makefile.PLChecking if your kit is complete...Looks goodLD_RUN_PATH=/u01/app/oracle/product/11.2.0/dbhome_1/libUsing DBD::Oracle 1.80.Using DBD::Oracle 1.80.Multiple copies of Driver.xst found in: /usr/local/lib64/perl5/auto/DBI/ /usr/lib64/perl5/vendor_perl/auto/DBI/ at Makefile.PL line 1807.Using DBI 1.642 (for perl 5.016003 on x86_64-linux-thread-multi) installed in /usr/local/lib64/perl5/auto/DBI/Writing Makefile for DBD::Oracle
[root@centos1 DBD-Oracle-1.80]#  make[root@centos1 DBD-Oracle-1.80]# make install


检查安装

[root@centos1 opt]# vi 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@centos1 opt]# perl list.pl DBD::Oracle  --  1.80DBI          --  1.642Perl         --  5.16.3

4、安装ora2pg

https://github.com/darold/ora2pg/releases

[root@centos1 opt]# tar -zxvf ora2pg-20.0.tar.gz
[root@centos1 opt]# cd ora2pg-20.0/
[root@centos1 ora2pg-20.0]#  perl Makefile.PL


Checking if your kit is complete...
Looks good
Writing Makefile for Ora2Pg

Done...
------------------------------------------------------------------------------
Please read documentation at /tupian/20230521/ before asking for help
------------------------------------------------------------------------------
Now type: make && make install

[root@centos1 ora2pg-20.0]# make && make install
[root@centos1 ora2pg-20.0]# whereis ora2pgora2pg: /etc/ora2pg /usr/local/bin/ora2pg
[root@centos1 opt]# perl list.pl 
DBD::Oracle  --  1.80
DBI          --  1.642
Ora2Pg       --  20.0
Perl         --  5.16.3

环境变量

[root@centos1 opt]# export PERL5LIB=/usr/local/bin/
[root@centos1 opt]# source /etc/profile

安装完成,接下来测试从oracle到postgres的数据迁移 查看 ora2pg的使用(二、ora2pg的配置及oracle向postgres数据迁移)


网页题目:ora2pg的使用(一、centos下的安装)-创新互联
网页URL:http://cdkjz.cn/article/dgjeod.html
多年建站经验

多一份参考,总有益处

联系快上网,免费获得专属《策划方案》及报价

咨询相关问题或预约面谈,可以通过以下方式与我们联系

大客户专线   成都:13518219792   座机:028-86922220