zoukankan      html  css  js  c++  java
  • ORA2PG --从oracle迁移数据到postgres

    01, 安装软件

      

    [root@oracle01 ora2gp]# wget http://search.cpan.org/CPAN/authors/id/P/PY/PYTHIAN/DBD-Oracle-1.74.tar.gz
    --2020-04-24 14:45:26--  http://search.cpan.org/CPAN/authors/id/P/PY/PYTHIAN/DBD-Oracle-1.74.tar.gz
    Resolving search.cpan.org (search.cpan.org)... 151.101.110.217, 2a04:4e42:36::729
    Connecting to search.cpan.org (search.cpan.org)|151.101.110.217|:80... connected.
    HTTP request sent, awaiting response... 301 Moved Permanently
    Location: https://cpan.metacpan.org/authors/id/P/PY/PYTHIAN/DBD-Oracle-1.74.tar.gz [following]
    --2020-04-24 14:45:28--  https://cpan.metacpan.org/authors/id/P/PY/PYTHIAN/DBD-Oracle-1.74.tar.gz
    Resolving cpan.metacpan.org (cpan.metacpan.org)... 151.101.110.217, 2a04:4e42:36::729
    Connecting to cpan.metacpan.org (cpan.metacpan.org)|151.101.110.217|:443... connected.
    HTTP request sent, awaiting response... 200 OK
    Length: 448855 (438K) [application/x-gzip]
    Saving to: ‘DBD-Oracle-1.74.tar.gz’
    
    100%[===================================================================>] 448,855     1.20MB/s   in 0.4s
    
    2020-04-24 14:45:28 (1.20 MB/s) - ‘DBD-Oracle-1.74.tar.gz’ saved [448855/448855]
    [root@oracle01 ora2gp]# tar -zxvf DBD-Oracle-1.74.tar.gz
    DBD-Oracle-1.74/
    DBD-Oracle-1.74/lib/
    DBD-Oracle-1.74/lib/DBD/
    DBD-Oracle-1.74/lib/DBD/Oracle.pm
    DBD-Oracle-1.74/lib/DBD/Oracle/
    DBD-Oracle-1.74/lib/DBD/Oracle/GetInfo.pm
    DBD-Oracle-1.74/lib/DBD/Oracle/Troubleshooting/
    DBD-Oracle-1.74/lib/DBD/Oracle/Troubleshooting/Win32.pod
    DBD-Oracle-1.74/lib/DBD/Oracle/Troubleshooting/Vms.pod
    DBD-Oracle-1.74/lib/DBD/Oracle/Troubleshooting/Hpux.pod
    DBD-Oracle-1.74/lib/DBD/Oracle/Troubleshooting/Aix.pod
    DBD-Oracle-1.74/lib/DBD/Oracle/Troubleshooting/Sun.pod
    DBD-Oracle-1.74/lib/DBD/Oracle/Troubleshooting/Macos.pod
    DBD-Oracle-1.74/lib/DBD/Oracle/Troubleshooting/Linux.pod
    DBD-Oracle-1.74/lib/DBD/Oracle/Troubleshooting/Cygwin.pod
    DBD-Oracle-1.74/lib/DBD/Oracle/Troubleshooting/Win64.pod
    DBD-Oracle-1.74/lib/DBD/Oracle/Troubleshooting.pod
    DBD-Oracle-1.74/lib/DBD/Oracle/Object.pm
    DBD-Oracle-1.74/oci.def
    DBD-Oracle-1.74/Makefile.PL
    DBD-Oracle-1.74/MANIFEST
    DBD-Oracle-1.74/ocitrace.h
    DBD-Oracle-1.74/Changes
    DBD-Oracle-1.74/LICENSE
    DBD-Oracle-1.74/README.help.txt
    DBD-Oracle-1.74/README.mkdn
    DBD-Oracle-1.74/CONTRIBUTING.mkd
    DBD-Oracle-1.74/INSTALL
    DBD-Oracle-1.74/Oracle.xs
    DBD-Oracle-1.74/CONTRIBUTORS
    DBD-Oracle-1.74/META.json
    DBD-Oracle-1.74/oci8.c
    DBD-Oracle-1.74/META.yml
    DBD-Oracle-1.74/Oracle.h
    DBD-Oracle-1.74/dbivport.h
    DBD-Oracle-1.74/typemap
    DBD-Oracle-1.74/t/
    DBD-Oracle-1.74/t/23wide_db_al32utf8.t
    DBD-Oracle-1.74/t/00versions.t
    DBD-Oracle-1.74/t/22nchar_al32utf8.t
    DBD-Oracle-1.74/t/31lob.t
    DBD-Oracle-1.74/t/lib/
    DBD-Oracle-1.74/t/lib/ExecuteArray.pm
    DBD-Oracle-1.74/t/10general.t
    DBD-Oracle-1.74/t/28array_bind.t
    DBD-Oracle-1.74/t/26exe_array.t
    DBD-Oracle-1.74/t/14threads.t
    DBD-Oracle-1.74/t/rt74753-utf8-encoded.t
    DBD-Oracle-1.74/t/23wide_db.t
    DBD-Oracle-1.74/t/22nchar_utf8.t
    DBD-Oracle-1.74/t/31lob_extended.t
    DBD-Oracle-1.74/t/000-report-versions-tiny.t
    DBD-Oracle-1.74/t/12impdata.t
    DBD-Oracle-1.74/t/36lob_leak.t
    DBD-Oracle-1.74/t/24implicit_utf8.t
    DBD-Oracle-1.74/t/38taf.t
    DBD-Oracle-1.74/t/21nchar.t
    DBD-Oracle-1.74/t/70meta.t
    DBD-Oracle-1.74/t/15nls.t
    DBD-Oracle-1.74/t/39attr.t
    DBD-Oracle-1.74/t/rt85886.t
    DBD-Oracle-1.74/t/34pres_lobs.t
    DBD-Oracle-1.74/t/56embbeded.t
    DBD-Oracle-1.74/t/40ph_type.t
    DBD-Oracle-1.74/t/55nested.t
    DBD-Oracle-1.74/t/30long.t
    DBD-Oracle-1.74/t/32xmltype.t
    DBD-Oracle-1.74/t/58object.t
    DBD-Oracle-1.74/t/50cursor.t
    DBD-Oracle-1.74/t/80ora_charset.t
    DBD-Oracle-1.74/t/51scroll.t
    DBD-Oracle-1.74/t/01base.t
    DBD-Oracle-1.74/t/20select.t
    DBD-Oracle-1.74/t/nchar_test_lib.pl
    DBD-Oracle-1.74/t/23wide_db_8bit.t
    DBD-Oracle-1.74/t/60reauth.t
    DBD-Oracle-1.74/t/rt13865.t
    DBD-Oracle-1.74/t/25plsql.t
    DBD-Oracle-1.74/examples/
    DBD-Oracle-1.74/examples/japh
    DBD-Oracle-1.74/examples/oradump.pl
    DBD-Oracle-1.74/examples/ora_explain.pl
    DBD-Oracle-1.74/examples/commit.pl
    DBD-Oracle-1.74/examples/bind.pl
    DBD-Oracle-1.74/examples/curref.pl
    DBD-Oracle-1.74/examples/ex.pl
    DBD-Oracle-1.74/examples/read_long_via_blob_read.pl
    DBD-Oracle-1.74/examples/tabinfo.pl
    DBD-Oracle-1.74/examples/proc.pl
    DBD-Oracle-1.74/examples/sql
    DBD-Oracle-1.74/examples/mktable.pl
    DBD-Oracle-1.74/examples/inserting_longs.pl
    DBD-Oracle-1.74/examples/README
    DBD-Oracle-1.74/mkta.pl
    DBD-Oracle-1.74/Todo
    DBD-Oracle-1.74/dbdimp.h
    DBD-Oracle-1.74/hints/
    DBD-Oracle-1.74/hints/macos_syms.pl
    DBD-Oracle-1.74/hints/macos_bundle.syms
    DBD-Oracle-1.74/hints/macos_lib.syms
    DBD-Oracle-1.74/hints/dgux.pl
    DBD-Oracle-1.74/hints/svr4.pl
    DBD-Oracle-1.74/dbdimp.c
    DBD-Oracle-1.74/README
    [root@oracle01 ora2gp]#
    [root@oracle01 ora2gp]# ls
    DBD-Oracle-1.74  DBD-Oracle-1.74.tar.gz  DBI-1.643  DBI-1.643.tar.gz  INSTALL
    [root@oracle01 ora2gp]# cd DBD-Oracle-1.74/
    [root@oracle01 DBD-Oracle-1.74]# ls
    Changes           dbdimp.h    INSTALL      MANIFEST   oci8.c      Oracle.xs        t
    CONTRIBUTING.mkd  dbivport.h  lib          META.json  oci.def     README           Todo
    CONTRIBUTORS      examples    LICENSE      META.yml   ocitrace.h  README.help.txt  typemap
    dbdimp.c          hints       Makefile.PL  mkta.pl    Oracle.h    README.mkdn
    [root@oracle01 DBD-Oracle-1.74]# . ~/.bash_profile
    [root@oracle01 DBD-Oracle-1.74]# . /home/oracle/.bash_profile
    [root@oracle01 DBD-Oracle-1.74]# perl Makefile.PL -l
    Multiple copies of Driver.xst found in: /usr/local/lib64/perl5/auto/DBI/ /usr/lib64/perl5/vendor_perl/auto/DBI/ at Makefile.PL line 39.
    Using DBI 1.643 (for perl 5.016003 on x86_64-linux-thread-multi) installed in /usr/local/lib64/perl5/auto/DBI/
    
    Configuring DBD::Oracle for perl 5.016003 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#3.10
    Using Oracle in /u01/app/oracle/product/11.2.0/db_1
    DEFINE _SQLPLUS_RELEASE = "1102000400" (CHAR)
    Oracle version 11.2.0.4 (11.2)
    Found direct-link candidates: libclntsh.so
    Oracle sysliblist: -ldl -lm -lpthread -lnsl -lirc -lipgo -lsvml
    Found header files in /u01/app/oracle/product/11.2.0/db_1/rdbms/public.
    Your LD_LIBRARY_PATH env var is set to '/u01/app/oracle/product/11.2.0/db_1/lib:/bin:/usr/bin:/usr/local/bin:/usr/X11R6/bin/'
    
    client_version=11.2
    
    
    DEFINE= -Wall -Wno-comment -DUTF8_SUPPORT -DORA_OCI_VERSION="11.2.0.4" -DORA_OCI_102 -DORA_OCI_112
    
    
    Checking for functioning wait.ph
    
    
    System: perl5.016003 linux c1bm.rdu2.centos.org 3.10.0-514.16.1.el7.x86_64 #1 smp wed apr 12 15:04:24 utc 2017 x86_64 x86_64 x86_64 gnulinux
    Compiler:   gcc -O2 -g -pipe -Wall -Wp,-D_FORTIFY_SOURCE=2 -fexceptions -fstack-protector-strong --param=ssp-buffer-size=4 -grecord-gcc-switches -m64 -mtune=generic -D_REENTRANT -D_GNU_SOURCE -fno-strict-aliasing -pipe -fstack-protector -I/usr/local/include -D_LARGEFILE_SOURCE -D_FILE_OFFSET_BITS=64
    Linker:     /bin/ld
    Sysliblist: -ldl -lm -lpthread -lnsl -lirc -lipgo -lsvml
    Linking with -lclntsh.
    
    Checking if your kit is complete...
    Looks good
    LD_RUN_PATH=/u01/app/oracle/product/11.2.0/db_1/lib
    Using DBD::Oracle 1.74.
    Using DBD::Oracle 1.74.
    Multiple copies of Driver.xst found in: /usr/local/lib64/perl5/auto/DBI/ /usr/lib64/perl5/vendor_perl/auto/DBI/ at Makefile.PL line 1789.
    Using DBI 1.643 (for perl 5.016003 on x86_64-linux-thread-multi) installed in /usr/local/lib64/perl5/auto/DBI/
    Writing Makefile for DBD::Oracle
    
    ***  If you have problems...
         read all the log printed above, and the README and README.help.txt files.
         (Of course, you have read README by now anyway, haven't you?)
    
    [root@oracle01 DBD-Oracle-1.74]# make && make install
    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/Vms.pod blib/lib/DBD/Oracle/Troubleshooting/Vms.pod
    cp lib/DBD/Oracle/Troubleshooting/Hpux.pod blib/lib/DBD/Oracle/Troubleshooting/Hpux.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/Object.pm blib/lib/DBD/Oracle/Object.pm
    cp lib/DBD/Oracle/Troubleshooting/Aix.pod blib/lib/DBD/Oracle/Troubleshooting/Aix.pod
    cp lib/DBD/Oracle/Troubleshooting/Win64.pod blib/lib/DBD/Oracle/Troubleshooting/Win64.pod
    cp mk.pm blib/arch/auto/DBD/Oracle/mk.pm
    cp lib/DBD/Oracle/Troubleshooting/Win32.pod blib/lib/DBD/Oracle/Troubleshooting/Win32.pod
    /usr/bin/perl -p -e "s/~DRIVER~/Oracle/g" /usr/local/lib64/perl5/auto/DBI/Driver.xst > Oracle.xsi
    /usr/bin/perl /usr/share/perl5/vendor_perl/ExtUtils/xsubpp  -typemap /usr/share/perl5/ExtUtils/typemap -typemap typemap  Oracle.xs > Oracle.xsc && mv Oracle.xsc Oracle.c
    gcc -c  -I/u01/app/oracle/product/11.2.0/db_1/rdbms/public -I/usr/local/lib64/perl5/auto/DBI -D_REENTRANT -D_GNU_SOURCE -fno-strict-aliasing -pipe -fstack-protector -I/usr/local/include -D_LARGEFILE_SOURCE -D_FILE_OFFSET_BITS=64 -O2 -g -pipe -Wall -Wp,-D_FORTIFY_SOURCE=2 -fexceptions -fstack-protector-strong --param=ssp-buffer-size=4 -grecord-gcc-switches -m64 -mtune=generic   -DVERSION="1.74" -DXS_VERSION="1.74" -fPIC "-I/usr/lib64/perl5/CORE"  -Wall -Wno-comment -DUTF8_SUPPORT -DORA_OCI_VERSION="11.2.0.4" -DORA_OCI_102 -DORA_OCI_112 Oracle.c
    gcc -c  -I/u01/app/oracle/product/11.2.0/db_1/rdbms/public -I/usr/local/lib64/perl5/auto/DBI -D_REENTRANT -D_GNU_SOURCE -fno-strict-aliasing -pipe -fstack-protector -I/usr/local/include -D_LARGEFILE_SOURCE -D_FILE_OFFSET_BITS=64 -O2 -g -pipe -Wall -Wp,-D_FORTIFY_SOURCE=2 -fexceptions -fstack-protector-strong --param=ssp-buffer-size=4 -grecord-gcc-switches -m64 -mtune=generic   -DVERSION="1.74" -DXS_VERSION="1.74" -fPIC "-I/usr/lib64/perl5/CORE"  -Wall -Wno-comment -DUTF8_SUPPORT -DORA_OCI_VERSION="11.2.0.4" -DORA_OCI_102 -DORA_OCI_112 dbdimp.c
    dbdimp.c: In function ‘ora_db_login6’:
    dbdimp.c:725:5: warning: format ‘%d’ expects argument of type ‘int’, but argument 12 has type ‘size_t’ [-Wformat=]
         OCISessionPoolCreate_log_stat(
         ^
    dbdimp.c:725:5: warning: format ‘%d’ expects argument of type ‘int’, but argument 14 has type ‘size_t’ [-Wformat=]
    In file included from Oracle.h:50:0,
                     from dbdimp.c:21:
    dbdimp.c: In function ‘ora_st_FETCH_attrib’:
    /usr/local/lib64/perl5/auto/DBI/DBIXS.h:383:45: warning: unused variable ‘imp_dbh’ [-Wunused-variable]
     #define D_imp_dbh_from_sth D_imp_from_child(imp_dbh, imp_dbh_t, imp_sth)
                                                 ^
    /usr/local/lib64/perl5/auto/DBI/DBIXS.h:381:39: note: in definition of macro ‘D_imp_from_child’
                                     type *name = (type*)(DBIc_PARENT_COM(child))
                                           ^
    dbdimp.c:4349:9: note: in expansion of macro ‘D_imp_dbh_from_sth’
             D_imp_dbh_from_sth;
             ^
    gcc -c  -I/u01/app/oracle/product/11.2.0/db_1/rdbms/public -I/usr/local/lib64/perl5/auto/DBI -D_REENTRANT -D_GNU_SOURCE -fno-strict-aliasing -pipe -fstack-protector -I/usr/local/include -D_LARGEFILE_SOURCE -D_FILE_OFFSET_BITS=64 -O2 -g -pipe -Wall -Wp,-D_FORTIFY_SOURCE=2 -fexceptions -fstack-protector-strong --param=ssp-buffer-size=4 -grecord-gcc-switches -m64 -mtune=generic   -DVERSION="1.74" -DXS_VERSION="1.74" -fPIC "-I/usr/lib64/perl5/CORE"  -Wall -Wno-comment -DUTF8_SUPPORT -DORA_OCI_VERSION="11.2.0.4" -DORA_OCI_102 -DORA_OCI_112 oci8.c
    oci8.c: In function ‘ora_blob_read_mb_piece’:
    oci8.c:1847:4: warning: format ‘%lu’ expects argument of type ‘long unsigned int’, but argument 6 has type ‘ub4’ [-Wformat=]
        fbh->field_num+1, ftype, offset, len, destoffset, ul_t(amtp));
        ^
    Running Mkbootstrap for DBD::Oracle ()
    chmod 644 Oracle.bs
    rm -f blib/arch/auto/DBD/Oracle/Oracle.so
    gcc  -shared -O2 -g -pipe -Wall -Wp,-D_FORTIFY_SOURCE=2 -fexceptions -fstack-protector-strong --param=ssp-buffer-size=4 -grecord-gcc-switches -m64 -mtune=generic -Wl,-z,relro  Oracle.o dbdimp.o oci8.o  -o blib/arch/auto/DBD/Oracle/Oracle.so     
       -L/u01/app/oracle/product/11.2.0/db_1/lib -lclntsh -ldl -lm -lpthread -lnsl -lirc -lipgo -lsvml      
    
    chmod 755 blib/arch/auto/DBD/Oracle/Oracle.so
    cp Oracle.bs blib/arch/auto/DBD/Oracle/Oracle.bs
    chmod 644 blib/arch/auto/DBD/Oracle/Oracle.bs
    Manifying blib/man3/DBD::Oracle::Troubleshooting.3pm
    Manifying blib/man3/DBD::Oracle::Troubleshooting::Cygwin.3pm
    Manifying blib/man3/DBD::Oracle.3pm
    Manifying blib/man3/DBD::Oracle::Troubleshooting::Sun.3pm
    Manifying blib/man3/DBD::Oracle::Troubleshooting::Macos.3pm
    Manifying blib/man3/DBD::Oracle::Troubleshooting::Vms.3pm
    Manifying blib/man3/DBD::Oracle::Troubleshooting::Hpux.3pm
    Manifying blib/man3/DBD::Oracle::Troubleshooting::Aix.3pm
    Manifying blib/man3/DBD::Oracle::Object.3pm
    Manifying blib/man3/DBD::Oracle::Troubleshooting::Linux.3pm
    Manifying blib/man3/DBD::Oracle::Troubleshooting::Win64.3pm
    Manifying blib/man3/DBD::Oracle::GetInfo.3pm
    Manifying blib/man3/DBD::Oracle::Troubleshooting::Win32.3pm
    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/ocitrace.h
    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/Oracle.bs
    Installing /usr/local/lib64/perl5/DBD/Oracle.pm
    Installing /usr/local/lib64/perl5/DBD/Oracle/GetInfo.pm
    Installing /usr/local/lib64/perl5/DBD/Oracle/Troubleshooting.pod
    Installing /usr/local/lib64/perl5/DBD/Oracle/Object.pm
    Installing /usr/local/lib64/perl5/DBD/Oracle/Troubleshooting/Cygwin.pod
    Installing /usr/local/lib64/perl5/DBD/Oracle/Troubleshooting/Vms.pod
    Installing /usr/local/lib64/perl5/DBD/Oracle/Troubleshooting/Hpux.pod
    Installing /usr/local/lib64/perl5/DBD/Oracle/Troubleshooting/Linux.pod
    Installing /usr/local/lib64/perl5/DBD/Oracle/Troubleshooting/Sun.pod
    Installing /usr/local/lib64/perl5/DBD/Oracle/Troubleshooting/Macos.pod
    Installing /usr/local/lib64/perl5/DBD/Oracle/Troubleshooting/Aix.pod
    Installing /usr/local/lib64/perl5/DBD/Oracle/Troubleshooting/Win64.pod
    Installing /usr/local/lib64/perl5/DBD/Oracle/Troubleshooting/Win32.pod
    Installing /usr/local/share/man/man3/DBD::Oracle::Troubleshooting.3pm
    Installing /usr/local/share/man/man3/DBD::Oracle::Troubleshooting::Cygwin.3pm
    Installing /usr/local/share/man/man3/DBD::Oracle.3pm
    Installing /usr/local/share/man/man3/DBD::Oracle::Troubleshooting::Sun.3pm
    Installing /usr/local/share/man/man3/DBD::Oracle::Troubleshooting::Macos.3pm
    Installing /usr/local/share/man/man3/DBD::Oracle::Troubleshooting::Vms.3pm
    Installing /usr/local/share/man/man3/DBD::Oracle::Troubleshooting::Hpux.3pm
    Installing /usr/local/share/man/man3/DBD::Oracle::Troubleshooting::Aix.3pm
    Installing /usr/local/share/man/man3/DBD::Oracle::Object.3pm
    Installing /usr/local/share/man/man3/DBD::Oracle::Troubleshooting::Linux.3pm
    Installing /usr/local/share/man/man3/DBD::Oracle::Troubleshooting::Win64.3pm
    Installing /usr/local/share/man/man3/DBD::Oracle::GetInfo.3pm
    Installing /usr/local/share/man/man3/DBD::Oracle::Troubleshooting::Win32.3pm
    Appending installation info to /usr/lib64/perl5/perllocal.pod

    安装ora2Pg

      https://sourceforge.net/projects/ora2pg/files/?source=navbar

     下载一般看情况需求,我下的最新的

    [root@oracle01 ora2gp]# tar jxf ora2pg-20.0.tar.bz2
    [root@oracle01 ora2gp]# cd ora2pg-20.0/
    [root@oracle01 ora2pg-20.0]# ls
    changelog  doc  INSTALL  lib  LICENSE  Makefile.PL  MANIFEST  packaging  README  scripts
    [root@oracle01 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@oracle01 ora2pg-20.0]#
    [root@oracle01 ora2pg-20.0]# make && make install
    cp lib/Ora2Pg.pm blib/lib/Ora2Pg.pm
    cp lib/Ora2Pg/GEOM.pm blib/lib/Ora2Pg/GEOM.pm
    cp lib/Ora2Pg/PLSQL.pm blib/lib/Ora2Pg/PLSQL.pm
    cp lib/Ora2Pg/MySQL.pm blib/lib/Ora2Pg/MySQL.pm
    cp scripts/ora2pg blib/script/ora2pg
    /usr/bin/perl -MExtUtils::MY -e 'MY->fixin(shift)' -- blib/script/ora2pg
    cp scripts/ora2pg_scanner blib/script/ora2pg_scanner
    /usr/bin/perl -MExtUtils::MY -e 'MY->fixin(shift)' -- blib/script/ora2pg_scanner
    Manifying blib/man3/ora2pg.3
    Installing /usr/local/share/perl5/Ora2Pg.pm
    Installing /usr/local/share/perl5/Ora2Pg/GEOM.pm
    Installing /usr/local/share/perl5/Ora2Pg/PLSQL.pm
    Installing /usr/local/share/perl5/Ora2Pg/MySQL.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
    [root@oracle01 ora2pg-20.0]# vim /etc/
    Display all 296 possibilities? (y or n)
    [root@oracle01 ora2pg-20.0]# vim /etc/ora
    ora2pg/      oraInst.loc  oratab
    [root@oracle01 ora2pg-20.0]# vim /etc/ora2pg/ora2pg.conf.dist
    [root@oracle01 ora2pg-20.0]# ora2pg -c /etc/ora2pg/ora2pg.conf.dist
    DBI connect('host=192.169.0.10;sid=oracle01;port=1521','wateruser',...) failed: ORA-12170: TNS:Connect timeout occurred (DBD ERROR: OCIServerAttach) at /usr/local/share/perl5/Ora2Pg.pm line 1619.
    FATAL: 12170 ... ORA-12170: TNS:Connect timeout occurred (DBD ERROR: OCIServerAttach)
    Aborting export...

    02,使用

        编辑文件 /etc/ora2pg/ora2pg.conf

        

    ora2pg -c /etc/ora2pg/ora2pg.conf.dist 执行导出命令
    
    ora2pg 命令介绍
    
    -d | --debug :启用详细输出。  
    -h | --help :打印出简单的帮助信息。  
    -v | --version :显示Ora2Pg的版本。  
    -c | --conf file :使用另一个替代的配置文件,默认是/etc/ora2pg/ora2pg.conf。  
    -l | --log file :使用一个日志文件,默认是标准输出。  
    -o | --out file :指定导出的SQL脚本文件的路径,默认是当前目录下。  
    -t | --type export :指定导出格式。覆盖配置文件中指定的TYPE。  
    -p | --plsql :启用PLSQL到PLPSQL码的转换。  
    -s | --source dsn :设置Oracle DBI数据源。  
    -u | --user user :设置连接Oracle的用户名。  
    -w | --password pass :设置Oracle用户密码。  
    -n | --namespace schema :设置用于提取的Oracle模式名称。  
    -b | --basedir dir :设置默认的输出文件目录,输出的文件将被保存到该目录。  
    -x | --xtable relname :用于显示给定表的列名,仅在TYPE为SHOW_COLUMN时使用。  
    -f | --forceowner :如果设置为1将促使Ora2Pg设置表和序列的所有者。如果将其值设置为一个用户名会被设定为对象的所有者。  
    --nls_lang code :设置Oracle NLS_LANG客户端编码。  
    --client_encoding code :设置PostgreSQL客户端编码。  
    -i | --input_file file :文件包含在没有Oracle数据库连接发起时Oracle PL/SQL代码的转换。

    03、导出数据库

    [root@oracle01 ora2pg-20.0]# ora2pg -c /etc/ora2pg/ora2pg.conf.dist
    [========================>] 40/40 tables (100.0%) end of scanning.
    [========================>] 40/40 tables (100.0%) end of table export.
    [root@oracle01 ora2pg-20.0]# ls
    1     changelog  INSTALL  LICENSE   Makefile.PL  ora2pg.conf.dist  packaging   README
    blib  doc        lib      Makefile  MANIFEST     output.sql        pm_to_blib  scripts
    [
    
    默认会在当前目录下生成导出文件

      文件直接到psql导入就行了

    kingledb=# i /root/output.SQL 
  • 相关阅读:
    NFS+DHCP+TFTP无人值守安装linux
    systemverilog学习(6)并发进程与内部通信
    systemverilog学习(5)procedural statement ,task ,function&automatic
    systemverilog学习(4)动态数组
    systemverilog学习(3)基本数据类型
    systemverilog学习(2)interface
    systemverilog学习(1)基础
    Verilog学习(13)PLL与搜索代码
    Verilog学习(12)实战之强度与竞争
    verilog学习(11)实战之计数器
  • 原文地址:https://www.cnblogs.com/kingle-study/p/12769086.html
Copyright © 2011-2022 走看看