Sunday , March 3 2024

Foreign Data Wrapper Between PostgreSQL and Oracle


In the article “Postgresql Foreign Data Wrapper“, we created Foreign Data Wrapper to read data between two PostgreSQLs.

And we have created Foreing Data Wrapper Between PostgreSQL and MSSQL in the article named “PostgreSQL Foreign Data Wrapper Between PostgreSQL and MSSQL“.

In this article, we will create Foreign Data Wrapper between PostgreSQL and Oracle.


When installing Oracle Foreign Data Wrapper, we need to install oracle instant client.

In the instant client, we need to install the following rmps;


For installation, please refer to the article titled “How To Install Oracle Client For PostgreSQL On Centos“.

If you have a standard installation on Postgresql, you should download and install postgresql-devel and postresql-lib rpm packages according to your version.

After downloading and installing the required oracle_client version, you can install oracle_fdw by following the steps below.

First we download the Oracle_fdw extension, you can use the link below to download.

After downloading Oracle_fdw extension files and transferring them to any folder on our machine, we go the folder and execute the following command.

After running this command, the result should return as follows.


You may receive errors as follows when you run this command. You can find solutions to these errors in the following articles.

make: gcc : Command not found make:*** [oracle_fdw.o] Error 127″,

Oracle_fdw oracle_utils.c:22:17: fatal error: oci.h: No such file or directory”


After the above operation is completed, you can continue by running the next command.


Finally, we execute the following command and our operations at the operating level are completed.

The purpose of this process is to compile the PostgreSQL code and the oracle_fdw code together.



After connecting to postgres with psql, we run the following command to create the extension.



After the extension is installed, we create the server as in other extension installations.



We create user mapping.



And finally, we create a foreign table.


About Faruk Erdem

One comment

  1. hi,

    what should be the version of oracle_fdw for it to be able build successfully with postgresql 15 ?


Leave a Reply

Your email address will not be published. Required fields are marked *