Skip to content
Home » Oracle » impdp REMAP_TABLE Multiple Examples

impdp REMAP_TABLE Multiple Examples

In this post, we'll talk about 2 topics.

  1. REMAP_TABLE Single Table
  2. REMAP_TABLE Multiple Tables

REMAP_TABLE Single Table

To prevent damaging the original tables, we usually import tables with different names for developers to verify. The parameter we should use in data pump (impdp) is REMAP_TABLE.

To remap table, we used to use the format:

REMAP_TABLE=<SCHEMA_NAME>.<OLD_TABLE_NAME>:<NEW_TABLE_NAME>

For example:

[oracle@test ~]$ impdp system/password@orclpdb tables=hr.employees remap_table=hr.employees:emp_bak dumpfile=full.dmp

Please note that, we usually use system to perform data migration, but using sys as sysdba is also working to import data.

We know how to map one table, how about two or more tables?

REMAP_TABLE Multiple Tables

There're 2 ways to set multiple remapping tables.

Delimited by Commas

Every mapping set should be delimited by a comma like the following example:

[oracle@test ~]$ impdp system/password@orclpdb tables=hr.employees,hr.jobs remap_table=hr.employees:emp_bak,hr.jobs:job_bak dumpfile=full.dmp

We used one REMAP_TABLE and multiple table mappings.

Repeated REMAP_TABLE

Delimiting by commas may not feasible for hundreds of table remapping, so you may split them by the parameter REMAP_TABLE.

[oracle@test ~]$ impdp system/password@orclpdb tables=hr.employees,hr.jobs remap_table=hr.employees:emp_bak remap_table=hr.jobs:job_bak dumpfile=full.dmp

As you can see, there're two REMAP_TABLE in the command. The basic rule is that the source table can not be duplicated.

2 thoughts on “impdp REMAP_TABLE Multiple Examples”

  1. What will be the functionality if the table already exists
    Example
    Remap table = hr.source:destn
    What would happen to the existing data if destn table is already existing. Also if new rows are present in source will that be copied over or appended to the destn table?

    1. You need to set parameter TABLE_EXISTS_ACTION to indicate that how to deal with an existing table.

      Currently, there’re 4 options you can choose. SKIP, APPEND, TRUNCATE or REPLACE.

Leave a Reply

Your email address will not be published. Required fields are marked *