Prepare your source for conversion

This page describes how to prepare your source database schema for conversion in the legacy conversion workspace by using the Ora2Pg migration tool.

Oracle and PostgreSQL use different SQL dialects and data types to define the objects and types of data they contain. When migrating between these SQL engines, you need to convert your Oracle schema and code to a schema and code that's compatible with PostgreSQL.

In Database Migration Service, there are two ways you can approach your source conversion:

  • (Recommended) Use the conversion workspace with the built-in conversion editor.

    In this approach, schema conversion is automated and all actions take place directly within Database Migration Service. If you choose to use this approach, there is no additional preparation required (except for adding relevant connectivity information). Continue to the Configure your destination AlloyDB for PostgreSQL database section.

  • Use the legacy conversion workspace with the Ora2Pg conversion tool.

    This approach is useful if you want to run the conversion procedures outside of Database Migration Service. Perform all the steps in the Use Ora2Pg for schema conversion section before you create a conversion workspace.

Use Ora2Pg for schema conversion

Before you set up a conversion workspace, do the following:

  1. Configure an Ora2Pg file. For more information, see the Configuration section of the Ora2Pg documentation.
  2. Use Ora2Pg to generate SQL scripts that you can load into your AlloyDB for PostgreSQL destination database. For more information, see the Installation section of the Ora2Pg documentation.
  3. Run the SQL scripts on your AlloyDB for PostgreSQL database. This creates the schema on the database.

After you complete these steps, create a conversion workspace that includes the Ora2Pg file you configured. Database Migration Service uses this file to create table mappings between your source Oracle database and your AlloyDB for PostgreSQL destination database. These table mappings are used to ensure that Database Migration Service loads data from the source into the destination properly.

Work with Ora2Pg directives

Database Migration Service uses the following directives in the Ora2Pg configuration file:


Because Database Migration Service uses connection profiles to define connectivity details, you don't need to define the following directives in your Or2Pg configuration file:

  • PG_DSN
  • PG_PWD

Additionally, Database Migration Service doesn't use the WHERE configuration directive to limit the records to migrate.

For more information about Ora2Pg configuration directives, see the Configuration section of the Ora2Pg documentation.

Work with tables without primary keys

Data Manipulation Language UPDATE and DELETE statements on tables without primary keys might cause duplicate records because Database Migration Service can't track which row was changed. To learn how to migrate tables in the source database that don't have primary keys, see Migrate tables without primary keys.