Site icon Database Tutorials

How To Migrate Data From Oracle To PostgreSQL Using Ora2pg

In today’s article, I will tell you How To Migrate Data From Oracle To PostgreSQL Using Ora2pg.

Before migrating data, I will explain ora2pg installation.

Ora2pg

It is a tool used to switch from Oracle database to Postgresql.

First of all, we will install Oracle 19C Client on Oracle Linux 7. For this, we need to download the rpm packages required and put them on our server. After installing the rpm packages on our server, we run the following commands.

We install the required perl packages.

We download the DBI module required for Perl by following the steps below.

We install the Oracle database driver for the DBI module by following the steps below.

We install the Postgres database driver for the DBI module. (DBD-Pg)

After completing the above steps, we can proceed to the Ora2pg installation. We will follow the steps below to install Ora2pg.

After the installation is complete, we need to make some changes to the ora2pg.conf file. For this, we first backup the ora2pg.conf file and make the changes. For example, since I will carry the HR chart, I will write HR in the SCHEMA section.

We run the following command to see that the installation has completed successfully.

Data Migration from Oracle to Postgresql:

After completing the configuration, we create the database and schema that we will transfer in postgres.

After creating the database and schema, we create the output files to move the data in the Oracle database to the postgres database by running the following command.

After the process is finished, data is transferred to the Postgres database using output files.

After the data migration is complete, we can connect to the orcl database and query the tables in the hr schema.

Exit mobile version