1、Requirement
創(chuàng)新互聯(lián)公司長(zhǎng)期為近1000家客戶提供的網(wǎng)站建設(shè)服務(wù),團(tuán)隊(duì)從業(yè)經(jīng)驗(yàn)10年,關(guān)注不同地域、不同群體,并針對(duì)不同對(duì)象提供差異化的產(chǎn)品和服務(wù);打造開(kāi)放共贏平臺(tái),與合作伙伴共同營(yíng)造健康的互聯(lián)網(wǎng)生態(tài)環(huán)境。為河曲企業(yè)提供專(zhuān)業(yè)的成都網(wǎng)站建設(shè)、成都做網(wǎng)站,河曲網(wǎng)站改版等技術(shù)服務(wù)。擁有十載豐富建站經(jīng)驗(yàn)和眾多成功案例,為您定制開(kāi)發(fā)。
[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客戶端或者服務(wù)端(這里是已經(jīng)安裝了oracle11g服務(wù)端)
參考 http://www.cnblogs.com/zydev/p/7213845.html
配置root用戶下 Oracle環(huán)境變量,因?yàn)闇?zhǔn)備將ora2pg在root下執(zhí)行
[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只是個(gè)抽象層,要實(shí)現(xiàn)支持不同的數(shù)據(jù)庫(kù),則需要在DBI之下,編寫(xiě)針對(duì)不同數(shù)據(jù)庫(kù)的驅(qū)動(dòng)。對(duì)MySQL來(lái)說(shuō),有DBD::Mysql, 而對(duì)ORACLE來(lái)說(shuō),則是DBD::Oracle。其中的DBD這是DataBase Driver的簡(jiǎn)寫(xiě)。安裝順序是先裝DBI,再裝DBD::Oracle
介質(zhì)下載路徑:
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
http://ora2pg.darold.net/ 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
環(huán)境變量
[root@centos1 opt]# export PERL5LIB=/usr/local/bin/ [root@centos1 opt]# source /etc/profile
安裝完成,接下來(lái)測(cè)試從oracle到postgres的數(shù)據(jù)遷移 查看 ora2pg的使用(二、ora2pg的配置及oracle向postgres數(shù)據(jù)遷移)