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.
- All involved components, i.e. PostgreSQL and Oracle clients, Exportizer, ODBC drivers (if any), should have the same architecture: 32-bit or 64-bit.
Configuring PostgreSQL to Oracle Migration
- 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
- Open the registered PostgreSQL database.
- Chose a table or tables to export or write and execute your SQL query.
- 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. 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, 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 Export mode. To learn about all possible modes, read detailed description for Database 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 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 of 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
- Exporting dBase (DBF) to SQL Script
- Exporting CSV to DBF
- Creating Schema for a Text Table
- Exporting Large Tables
- Exporting SQLite to Excel
- Exporting Excel to Firebird
- Exporting Paradox to Access
- Migrating Data from PostgreSQL to Oracle
- Exporting BLOBs to Individual Files
- Exporting to HTML Using Template
- Importing Database Files from Explorer