oracle-databasepostgresqlmigrationora2pg

How to export particular table schema and data using ora2pg migration?


I'm using ora2pg migration tool for migrate table schema and data from ORACLE database to Postgres Database.

Using the following query, I can export the entire schema and data from the ORACLE database and Import the data into Postgres Database.

To export database schema:

./export_schema.sh

To export data:

ora2pg -t COPY -o data.sql -b ./data -c ./config/ora2pg.conf

Import the exported data using this:

./import_all.sh -d MyDB -o postgres(Owner) -U User

But I've no idea, how to migrate a particular table schema and data using this.

Anybody knows about it, answer.It helps me a lot. Thanks in advice.


Solution

  • If you want to migrate some specific tables, yo have do some configuration changes in the ora2pg.conf file.

    In the export section, uncomment the ALLOW part and give the needed table names with space or comma(,) separated.

    (i.e)

    ALLOW   CUSTOMER,STUDENT,APPLICATION,EMPLOYEE
    

    Then you run the command, the above tables only exported:

    ./export_schema.sh
    

    Hope this helps you.