Importing a schema in Oracle with a different name

oracle

I exported an Oracle XE 18c database with:

expdp USER1/pwd DIRECTORY=backups DUMPFILE=file.dmp 
      LOGFILE=config_export.log SCHEMAS=USER1

Now, I created in a different machine another user and schema USER2, and need to import all the tables from USER1 in USER2.

In the second machine, I import with:

impdp USER2/pwd DIRECTORY=backups DUMPFILE=file.DMP 
      SCHEMAS=USER1 TABLE_EXISTS_ACTION=TRUNCATE LOGFILE=config_import.log   

But I get the error that USER1 does not exist. Is there a way to import the schema without creating USER1?

Best Answer

REMAP_SCHEMA

The Data Pump Import command-line mode REMAP_SCHEMA parameter loads all objects from the source schema into a target schema.

Default: There is no default

Purpose

Loads all objects from the source schema into a target schema.

Example:

remap_schema=USER1:USER2