Here you can find the detailed instruction on how to export data from PostgreSQL database to Oracle database in Exportizer software.
Below, it is shown how to export data from GUI or command line.
Export Conditions
In most cases, to export data from PostgreSQL to Oracle, the following conditions are required:
- We recommend to use Exportizer Enterprise and FD interface when working with PostgreSQL and Oracle 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.
- PostgreSQL client must be installed and its architecture (32-bit or 64-bit) must match Exportizer architecture.
- Oracle 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 PostgreSQL to Oracle Migration
If you are exporting data via GUI:
- Launch Exportizer Pro or Exportizer Enterprise.
- Register your source PostgreSQL database by choosing File | Connect / Register... menu. You have several ways to register it.
- Register your target Oracle database. You can register it by several ways. Note: You can register the target database from the Export dialog during the exporting.
Export Steps (GUI)
- Open the registered PostgreSQL database.
- 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.
- Click Export button .
- Switch to the Database tab and select your registered Oracle database as a target database. If you did not register it yet, click '...' button to the right to register it.
- Specify export parameters. Some notes:
- Turn on the Memory saving mode option and its related options. Turning on all three options gives you the maximum speed. But in case of exporting problems, if you suspect that they can be caused by these options, try different combinations of them. If your source data or column names on any side can contain Unicode characters, set the stream Encoding to UTF-8.
- Specify a Table name, i.e. name of the target table. For multi-table exporting, you can leave it empty, otherwise, the data will be exported to one destination table.
- Both PostgreSQL and Oracle 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 table creation only; they are ignored when the export mode (see below) is appending, updating, or deleting records in existing target table.
- Choose the needed Export mode. To learn about all possible modes, read detailed description for Database export format. 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.
- The bigger Commit interval value, the faster your exporting process. But too big value may cause memory and other issues. Therefore, try to play with it (starting from a moderate value) to find the optimal value before porting the solution to your production environment.
- Click Next.
For multi-table exporting, specify the source-to-target table mappings, otherwise check the source-to-target field mappings.
In field or table mappings, you create the correspondence between the source objects (tables and/or fields) and target objects.
In field mappings, in addition to source table fields, 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.
- Click Next to proceed to export logs and error handling options or click Export to start the export process immediately.
Exporting PostgreSQL to Oracle from Command Line
Command Line Example
Here is how to export data from several PostgreSQL tables to Oracle:
exptizer.exe /silent /export /ExportType=DATABASE /ExportMode=REPLACE+INSERT /CommitInterval=400 /SrcDBInterface=FD /SrcDBKind=DSN /SrcDBDriver=POSTGRESQL "/SrcServer=222.333.2.14" /SrcPort=5432 /SrcDB=dwh /SrcDBUserName=dwh_master /SrcDBPassword=dwh_master_password /TrgDBInterface=FD /TrgDBKind=DSN /TrgDBDriver=ORACLE /TrgOSAuthentication=Yes /TrgAuthenticationMode=Normal /TrgVendorHomepath=C:\app\John\product\12.1.0\client_1 /TrgDB=cloud_prod "/TableMappingsFile=c:\DWH\Export\PostgreSQL-To-Oracle-Table-Mappings.xml" /LogFile=C:\DWH\Export\Log\export.log /AppendLog
Note: You can add other parameters to the command lines above in accordance with the documentation.
Action File Example
The command line above can be transformed to an action file, which is much more comfortable to work with. You can run action files either form the command line or from Exportizer GUI. The action file contains all the command line parameters (except /silent switch), one parameter per line, and allows comments:
/export
/ExportType=DATABASE
/ExportMode=REPLACE+INSERT ;Target tables recreated when exist
;/ExportMode=APPEND ;Incoming records are appended to target tables
/CommitInterval=400 ;COMMIT after exporting every 400 records
/SrcDBInterface=FD
/SrcDBKind=DSN
/SrcDBDriver=POSTGRESQL
/SrcServer=222.333.2.14 ;IP address or server URL
/SrcPort=5432
/SrcDB=dwh
/SrcDBUserName=dwh_master
/SrcDBPassword=dwh_master_password
/TrgDBInterface=FD
/TrgDBKind=DSN
/TrgDBDriver=ORACLE
/TrgOSAuthentication=Yes
/TrgAuthenticationMode=Normal
/TrgVendorHomepath=C:\app\John\product\12.1.0\client_1
/TrgDB=cloud_prod ;a name from tnsnames.ora file
/TableMappingsFile=c:\DWH\Export\PostgreSQL-To-Oracle-Table-Mappings.xml ;a file with table source-to-target table mappings
/LogFile=C:\DWH\Export\Log\export.log ;a file for writing logs to
/AppendLog ;keep previous logs and add new logs to the end of the log file
See also
Practical Cases
- Migrating PostgreSQL Data to Oracle
- Migrating SQL Server Data to Oracle
- Exporting Large Tables
- Exporting Calculated Fields
- Exporting BLOBs to Individual Files
- Exporting to HTML Using Template
- Importing Database Files from Explorer