Perl Ora2Pg on Ubuntu - perl

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.

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.

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.

Pre-installation steps:
ORACLE Client must be installed and ORACLE_HOME must be set.
Install perl (version 5.6 and above)
Installation steps:
Install DBI (database interface module)
apt-get install cpanminus (for ubuntu)
yum install cpanminus (for Linux)
cpanm DBI
Install DBD::Oracle and DBD::Pg
cpanm DBD::Oracle
cpanm DBD::Pg
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
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
Check the version of pra2pg:
ora2pg SHOW_VERSION
Run the below command
ora2pg -c /etc/ora2pg/ora2pg.conf
ora2pg -c /etc/ora2pg/ora2pg.conf -p -P 10 -J 10 -L 1000000
.sql file will create in the current directory have converted data into PostgreSql
Hope this will work.

Related

install Net::SSH2 with carton

I want to install Net::SSh2 with Carton:
I have locally installed libssh2-1.6.0.
exported all necessary LIBSSH2 variables
export LIBSSH2_INCLUDE=$HOME/lib/libssh2-1.6.0/include
export LIBSSH2_LIB=$HOME/lib/lib
export LIBSSH2_LDARGS="-lz"
and then call carton install
and here Carton still complains that dependency can't be found.
It is not clear to me why Carton does not see Env variables?
log:
$ ~/.cpanm/work/1469440056.31412/Net-SSH2-0.62 $ perl Makefile.PL lib=$HOME/libssh2/lib inc=$HOME/libssh2/include \
> # 56 ldargs="-lz"
The libssh2 library is required by this module. If you don't have it, you can
download it from http://www.libssh2.org; you may also need OpenSSL, which can
be obtained from http://www.openssl.org , or libgcrypt, which can be obtained
from http://www.gnupg.org .
Debian: sudo aptitude install libssh2-1-dev
OpenSUSE: sudo zypper in libssh2-1 libssh2-devel
You can pass your libssh2 lib and include dirs (and extra link args) on the
command line. E.g.:
perl Makefile.PL lib=$HOME/libssh2/lib inc=$HOME/libssh2/include \
ldargs="-lz"
These can also be set through the LIBSSH2_LIB/LIBSSH2_INCLUDE/LIBSSH2_LDARGS
environment variables.

Linux: How to install DBD::Pg module?

Postgres DB is already installed. I'm not using system perl I have installed another perl in "/srv/data203806/Migration/CPAN/localperl/bin". When I'm trying to install, It is asking for PATH TO pg_config:
[root1#frmrszvwb023 bin]# ./cpan install DBD::Pg
Reading '/root/.cpan/Metadata'
Database was generated on Fri, 07 Mar 2014 03:53:02 GMT
Running install for module 'DBD::Pg'
Running make for T/TU/TURNSTEP/DBD-Pg-3.0.0.tar.gz
Checksum for /root/.cpan/sources/authors/id/T/TU/TURNSTEP/DBD-Pg-3.0.0.tar.gz ok
CPAN.pm: Building T/TU/TURNSTEP/DBD-Pg-3.0.0.tar.gz
Configuring DBD::Pg 3.0.0
Path to pg_config?
No POSTGRES_HOME defined, cannot find automatically
Warning: No success on command[/srv/data203806/MUXmh-Migration/CPAN/localperl/bin/perl Makefile.PL]
'YAML' not installed, will not store persistent state
TURNSTEP/DBD-Pg-3.0.0.tar.gz
/srv/data203806/MUXmh-Migration/CPAN/localperl/bin/perl Makefile.PL -- NOT OK
Running make test
Make had some problems, won't test
Running make install
Make had some problems, won't install
Could not read metadata file. Falling back to other methods to determine prerequisites
Please help me to install DBD::Pg? How to get path to pg_config?
Just ran into this issue, and on Ubuntu 16.04 Xenial the package you're looking for is:
apt-get install libdbd-pg-perl
You have to install libpq-dev, e.g. on Ubuntu:
sudo apt-get install libpq-dev
On CentOS/RH you can fix it by installing perl-DBD-Pg package with yum
sudo yum install perl-DBD-Pg
From the README:
INSTALLATION:
Before installing, please use the "cpansign -v" program to
cryptographically verify that your copy of DBD::Pg is complete and
valid. The program "cpansign" is part of Module::Signature, available
from CPAN.
By default Makefile.PL uses App::Info to find the location of the
PostgreSQL library and include directories. However, if you want to
control it yourself, define the environment variables POSTGRES_INCLUDE
and POSTGRES_LIB, or define just POSTGRES_HOME. Note that if you have
compiled PostgreSQL with SSL support, you must define the POSTGRES_LIB
environment variable and add "-lssl" and "-lcrypto" to it, like this:
export POSTGRES_LIB="/usr/local/pgsql/lib -lssl -lcrypto"
The usual steps to install DBD::Pg:
perl Makefile.PL
make
make test
make install
Do steps 1 to 2 as a normal user, not as root!
If the script cannot find the pg_config information itself, it will
ask you for the path to it. Enter the complete path to the pg_config
file here, including the name of the file itself.
If you want to use a module, read the documentation.
Before installing perl module, you must install client for accessing Postgres DB. I just install server and header files:
sudo apt-get install postgresql
sudo apt-get install libpq-dev
You can try:
locate pg_config
This will show something like:
/usr/pgsql-10/bin/pg_config
/usr/pgsql-10/include/ecpg_config.h
/usr/pgsql-10/include/ecpg_config_x86_64.h
Then run:
POSTGRES_HOME=/usr/pgsql-10 ./cpan install DBD::Pg
UPD
If you still encounter issues with pg_config, you may need to add it to your PATH, e.g.:
export PATH=$PATH:/usr/pgsql-x.x/bin
where x.x is your version, such as /usr/pgsql-9.2./bin.
Fedora 29, plenv, perl v5.18.0
Once I got plenv working, I was able to install DBD::Pg with cpanm using these commands:
sudo dnf install postgresql postgresql-devel
cpanm --quiet --notest DBD::Pg
For ArchLinux (or any Distro using Pacman):
pacman -S perl-dbd-pg
For my Ubuntu 22 worked this:
sudo apt install build-essential
sudo apt install cpanminus
sudo apt-get install -y postgresql-server-dev-all
sudo cpanm DBD::Pg

Perl Dist::Zilla doesn't install because of Net::SSLeay on Debian Wheezy

I am using perlbrew together with cpanm on debian wheezy.
I tried to install Dist::Zilla but installation failed because of Net::SSLeay.
Error message: SSLeay.xs:153:25: fatal error: openssl/err.h: Datei oder Verzeichnis nicht gefunden (German for "openssl/err.h not found").
People suggest installing libssl-dev which I have already done and does not help.
Is it that something has changed from Squeeze to Wheezy and Perl-Modules are not aware of yet??
The problem is likely that OpenSSL needs to be compiled into the Perlbrew environment -- the same environment that will run Net::SSLeay. Try this recipe:
Install dependencies:
sudo apt install build-essential checkinstall zlib1g-dev -y
Create a subdirectory for OpenSSL under Perlbrew:
mkdir ~/perl5/perlbrew/openssl
Download & extract latest LTS OpenSSL into above directory. To determine latest LTS OpenSSL, go to https://openssl.org/source/ and find the latest stable version. For example below we use openssl-1.1.1.tar.gz:
cd ~/perl5/perlbrew/openssl
wget https://www.openssl.org/source/openssl-1.1.1.tar.gz [replace with latest LTS version]
tar -xf openssl-1.1.1.tar.gz
cd openssl-1.1.1
Install and compile. Starting at above directory:
./config shared --prefix=$PERLBREW_ROOT/openssl
make
make test
Install Net::SSLeay using cpanm:
cpanm install Net::SSLeay

Error "the PGXS Makefile cannot be found" when installing PostGis on Debian

I am in the process of installing PostGis over psql on a Debian machine (actually crunchbang).
I have completed the following steps:
$ wget http://download.osgeo.org/postgis/source/postgis-2.0.3.tar.gz
$ tar xzf postgis-2.0.3.tar.gz
$ cd postgis-2.0.3
$ ./configure
On the final step I get the following error:
configure: error: the PGXS Makefile /usr/lib/postgresql/9.1/lib/pgxs/src/makefiles/pgxs.mk cannot be found. Please install the PostgreSQL server development packages and re-run configure.
The issue is that I do already have Postgres installed:
$ psql --version
psql (9.1.9)
I have checked this on two machines with the same configuration and get the same error. What am I missing here?
PostgreSQL is broken down into several packages, and having psql installed doesn't imply that the development packages are also installed.
According to the error message:
Please install the PostgreSQL server development packages and re-run
configure
you need:
# apt-get install postgresql-server-dev-9.1
Also note there's a APT pgdg repository providing recent pre-compiled versions of postgres-related packages (including postgis) that you may use instead of self-compiling.
If your system is set up to use this repository, just do:
# apt-get install postgresql-9.1-postgis-2.0
Daniel's answer works great except that it needs the following update:
$ sudo apt-get install postgresql-9.1-postgis-2.1
These packages can be updated some time in future again. So, it is recommended to search for new packages using aptitude and install the appropriate one:
$ aptitude search postgis

Installing LuaMongo on Ubuntu 11.10

I have researched and viewed the post to install luamongo- http://groups.google.com/group/luamongo/browse_thread/thread/1eaa56974614dc90/c91c842e241aa4de#c91c842e241aa4de
But the installation will not work. I already have mongodb-10gen version 2.0.3 and lua5.1 version 5.1.4.10 installed.
How do I download luamongo from https://github.com/moai/luamongo and install it and get it working as an import statement in a lua script to be able to write to a mongo db? Any suggestions would be helpful, nothing I have tried so far or read has been able to help. If more information is needed I will post it. Thanks in advance.
I got this script from a friend of mine which should be helpful:
# Download mongodb and driver
wget http://downloads.mongodb.org/cxx-driver/mongodb-linux-x86_64-v2.0-latest.tgz
wget http://fastdl.mongodb.org/linux/mongodb-linux-x86_64-2.0.2.tgz
# Extract each
tar xvzf mongodb-linux-x86_64-2.0.2.tgz
tar xvzf mongodb-linux-x86_64-v2.0-latest.tgz
# Add mongo bin to PATH
export PATH=$PATH:~/mongodb-linux-x86_64-2.0.2/bin
# Grab dev tools and dependencies (May need to run apt-get update to download all)
sudo apt-get -y install tcsh scons libpcre++-dev libboost-dev libreadline-dev libboost-program-options-dev libboost-thread-dev libboost-filesystem-dev libboost-date-time-dev gcc g++ git lua5.1-dev make
# Grab latest luamongo (will need to add your github ssh key)
git clone git#github.com:moai/luamongo
# Compile mongo driver
cd mongo-cxx-driver-v2.0
sudo scons install
# Install where lua can load it
sudo cp libmongoclient.* /usr/lib