1
votes

I just tried Ora2Pg on my Ubuntu Jaunty Jackalope.

First of all, the installation was hard, but after downloading a few debs & rpms here & there, I was finally managed to install ora2pg via synaptic.

However, when I try to run this command

ora2pg /tmp/ora2pg.conf

I am getting a

install_driver(Oracle) failed: Can't load '/usr/lib/perl5/auto/DBD/Oracle/Oracle.so' for module DBD::Oracle: libclntsh.so.10.1: cannot open shared object file: No such file or directory at /usr/lib/perl/5.10/DynaLoader.pm line 196.

at (eval 14) line 3

Compilation failed in require at (eval 14) line 3.

Perhaps a required shared library or dll isn't installed where expected

at /usr/share/perl5/Ora2Pg.pm line 566

Any ideas what's wrong and how to fix it?

Note: I don't perl. I just started browsing a bit it because of this.

3

3 Answers

2
votes

This is the correct sequence for installation:

apt-get install libdbi-perl
apt-get install alien dpkg-dev debhelper build-essential
apt-get install libaio1
apt-get install make
apt-get install alien
apt-get install rpm
apt-get install libpq-dev

download DBD-Oracle-1.74 or last version
download DBD-Pg-3.5.3 or last version
download DBI-1.636 or last version
download ora2pg-17.5 or last version
download oracle-instantclient12.1-sqlplus-12.1.0.2.0-1.x86_64.rpm
download oracle-instantclient12.1-basic-12.1.0.2.0-1.x86_64.rpm
download oracle-instantclient12.1-devel-12.1.0.2.0-1.x86_64.rpm

after extract rpm package and install:

alien oracle-instantclient12.1-basic-12.1.0.2.0-1.x86_64.rpm
alien oracle-instantclient12.1-sqlplus-12.1.0.2.0-1.x86_64.rpm 
alien oracle-instantclient12.1-devel-12.1.0.2.0-1.x86_64.rpm
dpkg -i oracle-instantclient12.1-basic-12.1.0.2.0-1.x86_64.deb
dpkg -i oracle-instantclient12.1-devel_12.1.0.2.0-2_amd64.deb
dpkg -i oracle-instantclient12.1-devel-12.1.0.2.0-1.x86_64.deb

then:

export LD_LIBRARY_PATH=/usr/lib/oracle/12.1/client64/lib 

the path of oracle client installation

export ORACLE_HOME=/usr/lib/oracle/12.1/client64/

then, istall the perl extension for Oracle and Postgres

cd  DBI-1.636
perl Makefile.PL
make && makeinstall

cd DBD-Oracle-1.74 o DBD-Oracle-1.64
perl Makefile.PL
make && makeinstall

cd DBD-Pg-3.5.3
perl Makefile.PL
make && makeinstall

and finally, install

cd ora2pg-17.x
perl Makefile.PL
make && makeinstall

check in the version is correct

ora2pg -v

and last configure ora2pg.conf on /etc/ora2pg/

insert in file, the configuration for connect to Oracle and Postgres.

1
votes

DBD::Oracle can't find the Oracle client libraries because they're not in your library path. If you don't have the Oracle client libraries and you don't have a sysadmin to provide them for you, then you need to get the "Oracle Instantclient" package from the oracle website and install it. If you already have Instantclient installed, then you need to add its lib directory (something like /usr/lib/oracle/instantclient/lib or /opt/ora/instantclient10_1/lib) to your library path -- either by adding a line to /etc/ld.so.conf and running ldconfig as root, or by setting the LD_LIBRARY_PATH environment variable.

0
votes

Pre-installation steps:

  1. ORACLE Client must be installed and ORACLE_HOME must be set.
  2. Install perl (version 5.6 and above)

Installation steps:

  1. Install DBI (database interface module)

    apt-get install cpanminus (for ubuntu)
    yum install cpanminus (for Linux)

    cpanm DBI
    
  2. Install DBD::Oracle and DBD::Pg

    cpanm DBD::Oracle
    cpanm DBD::Pg
    
  3. Download the latest version of ora2pg from http://sourceforge.net/projects/ora2pg/ and run the following commands:

    tar -xvf ora2pg-18.0.tar
    cd ora2pg-18.0/
    perl Makefile.PL
    su root
    make
    make install
    
  4. Do the changes as per req
    By default Ora2Pg will look to ora2pg.conf configuration file into /etc/ora2pg/ directory.

    ORACLE_HOME /app/oracle/product/11.2.0
    ORACLE_DSN dbi:Oracle:host=[hostname];sid=[SID name]
    ORACLE_USER [SYSTEM]
    ORACLE_PWD [password]
    USER_GRANTS 1
    
  5. Check the version of pra2pg:

    ora2pg SHOW_VERSION
    
  6. Run the below command

    ora2pg -c /etc/ora2pg/ora2pg.conf
    ora2pg -c /etc/ora2pg/ora2pg.conf -p -P 10 -J 10 -L 1000000
    
  7. .sql file will create in the current directory have converted data into PostgreSql

Hope this will work.