Here you can find the detailed instruction on how to export data from Oracle database to PostgreSQL database.

Below, it is shown how to export data from GUI or command line.

Export Conditions

In most cases, to export data from Oracle to PostgreSQL, the following conditions are required:

  • We recommend to use Exportizer Enterprise and FD interface when working with Oracle and PostgreSQL databases. FD engine does not require ODBC drivers and exports data much faster. But if you prefer to use ODBC for both databases, Exportizer Pro can be used.
  • Oracle client must be installed and its architecture (32-bit or 64-bit) must match Exportizer architecture.
  • PostgreSQL client must be installed and its architecture (32-bit or 64-bit) must match Exportizer architecture.
  • All other involved components, e.g. ODBC drivers (if you use ODBC on source or target side), OLE DB providers etc. must also match Exportizer architecture.

Note: If your operating system is 64-bit, you can install both 32-bit and 64-bit versions of the Exportizer software and use them independently.

Configuring Oracle to PostgreSQL Exporting

The following preparations are recommended, but not required. If you want to dive into the process and understand how it works, do these steps. Anyway, you can skip them and proceed to the Export Steps below; in this case, all the preparations will be done on the fly, explicitly or implicitly.

  1. Launch Exportizer Pro or Exportizer Enterprise.
  2. Register your source Oracle database. You can register it by several ways.
  3. Register your target PostgreSQL database. The recommended interface is FD, but other options are also available. Basically, you specify a server and a port. Other important options are database, vendor library, and charset. Note: You can register the target database from the Export dialog during the exporting.

Export Steps (GUI)

  1. Open the registered Oracle database.
  2. Choose a table or tables to export, or write and execute your SQL query or queries. Please note that exporting multiple datasets at a time is available in Exportizer Enterprise only.
  3. Click Export button or choose a needed item from Export menu.
  4. Switch to the Database tab and select your registered PostgreSQL database as a target database. If you did not register it yet, do it now by clicking the '...' button to the right.
  5. Specify export parameters:
    • Turn on the Memory saving mode option and its related options. In case of exporting problems, if you suspect that they can be caused by these options, try different combinations of them.
    • Specify a Table name, i.e. name of the target table. For multi-table exporting, you can leave it empty, otherwise, all source datasets will be exported to one destination table.
    • Both Oracle and PostgreSQL support optional table descriptions (comments). You can either type a description for the target table(s) or copy it from the source (if any) by one click. Note that descriptions are applied during the target table creation only; they are ignored when the export mode (see below) is appending, updating, or deleting records in existing target table.
    • Choose the Export mode. You can read detailed description for selected export mode to the right (hover mouse over it to see full text). For multi-table exporting, this mode will be applied to the most of the tables, and you can override it for specific tables at the next step. For example, it can be Replace+Insert for the most of tables, and Update or Append+Update for others etc.
    • Specify Commit interval. The bigger its value, the faster your exporting process. But too big value may cause memory and other issues. So, try to play with it to find the optimal value for your database before porting the solution to your production environment.
    Exporting Data to PostgreSQL Database
  6. Click Next.
    Specify the source-to-target table and/or field mappings.
    In field mappings, you create the correspondence between the source and target columns. In addition to source table columns, you can also use calculated fields specified by formulas. It is possible to define full specifications for target columns here, i.e. rename target columns, choose their types, specify NOT NULL constraints, default values, primary key flags, descriptions (comments) etc. These specifications will be applied when the target table needs to be created or overwritten.
    In table mappings (for multi-table exporting), you create the correspondence between the source datasets (tables and/or queries) and target tables. Here, you can specify target table names, their descriptions (comments), and nested field mappings for each table pair.
  7. Click Next to proceed to export logs and error handling options or click Export to start the export process immediately.

In case of performance problems: try different combinations of Memory saving mode options and Commit interval option; you might want to read all the data exporting recommendations.

Exporting Oracle to PostgreSQL from Command Line

Here are some examples of command lines to export data from an Oracle to PostgreSQL database.

Exporting a Table from Oracle to PostgreSQL Database

"C:\Program Files (x86)\Vitalii Levchenko\Exportizer Enterprise 9\exptizer.exe" /export /SrcDBUserName=sdf /SrcDBPassword=sdf_password /ExportType=DATABASE /ExportMode=REPLACE+INSERT /TrgTableName=public.client_addresses /TrgDBInterface=fd /TrgDBKind=DSN /TrgDBDriver=PostgreSQL /TrgDBUserName=dwh /TrgDBUserName=dwh_password /CommitInterval=1000 /MemorySaving /UseSQLParameters /UseBatchMode /TrgServer=mytestdatabase.rds.amazonaws.com /TrgPort=5432 "/TrgVendorLibrary=C:\Program Files (x86)\PostgreSQL\10\bin\libpq.dll" /TrimTrailingSpaces /SrcDBInterface=fd /SrcDBKind=DSN /SrcDBDriver=ORACLE /SrcDB=MY_ORA_CLOUD /SrcOSAuthentication=No /SrcAuthenticationMode=Normal /SrcVendorHomepath=C:\app\Vitalii\product\12.1.0\client_1 /SrcTableName=SDF.CLIENT_ADDRESS /TrgDB=dwh_test

Oracle to PostgreSQL Exporting in Silent Mode

Let's improve the previous example by running it in silent mode, when no windows are shown. Also, let's add a log file to control exporting process:

"C:\Program Files (x86)\Vitalii Levchenko\Exportizer Enterprise 9\exptizer.exe" /silent /export /SrcDBUserName=sdf /SrcDBPassword=sdf_password /ExportType=DATABASE /ExportMode=REPLACE+INSERT /TrgTableName=public.client_addresses /TrgDBInterface=fd /TrgDBKind=DSN /TrgDBDriver=PostgreSQL /TrgDBUserName=dwh /TrgDBUserName=dwh_password /CommitInterval=1000 /MemorySaving /UseSQLParameters /UseBatchMode /TrgServer=mytestdatabase.rds.amazonaws.com /TrgPort=5432 "/TrgVendorLibrary=C:\Program Files (x86)\PostgreSQL\10\bin\libpq.dll" /TrimTrailingSpaces /SrcDBInterface=fd /SrcDBKind=DSN /SrcDBDriver=ORACLE /SrcDB=MY_ORA_CLOUD /SrcOSAuthentication=No /SrcAuthenticationMode=Normal /SrcVendorHomepath=C:\app\Vitalii\product\12.1.0\client_1 /SrcTableName=SDF.CLIENT_ADDRESS /TrgDB=dwh_test /LogFile=C:\Test\export.log

Notes

These are just basic command lines, and you can improve them by adding other needed command line parameters in accordance with the documentation.

Alternative Scenario Using Third-Party SQL Tool

If you have a third party PostgreSQL SQL tool, you can export Oracle data in Exportizer to SQL file(s) first, and then load data from the script using that tool. And, of course, you can export data to SQL script either by GUI or from the command line. We recommend to use Batch Insert SQL statement type for that.

But please note, that when choosing exporting to SQL script, your export process will have two phases: first, exporting the data to SQL script; second, loading data from the script to your target database. So, this way can be less effective, especially for large datasets or when automating the data exporting.

Anyway, we recommend to try both export scenarios and select the fastest and/or the most convenient one.

See also

 Opening Oracle Databases

 Opening PostgreSQL Databases

 Command Line Usage

 Field Mappings File

 Table Mappings File