Search code examples
oracleschemaremapimpdp

Impdp with remap failing on POST_TABLE_ACTION still using old schema


I'm trying to import an oracle dump while remapping schema and tablespace:

impdp usr/pass \
    EXCLUDE=table_statistics \
    DIRECTORY=EXPDP \
    REMAP_SCHEMA=ORG_USR:NEW_USR \
    REMAP_TABLESPACE=ORG_TS:NEW_TS \
    DUMPFILE=FILE.dmp \
    PARALLEL=2 \
    LOGFILE=FILE.imp.log

The job imports all tables and then starts processing object types:

Import: Release 12.1.0.2.0 - Production on Thu Aug 17 11:13:06 2017

[ ... the import remaps correct ]

Processing object type SCHEMA_EXPORT/TABLE/TABLE_DATA
. . imported "NEW_USR"."SOMETABLE"              112.4 MB 1402414 rows
. . imported "NEW_USR"."SOMEOTHERTABLE"                 235.9 MB  955249 rows
. . imported "NEW_USR"."SOMETABLE3"                 86.91 MB  440513 rows

[... everything works until ...]

Processing object type SCHEMA_EXPORT/TABLE/TRIGGER
Processing object type SCHEMA_EXPORT/STATISTICS/MARKER
Processing object type SCHEMA_EXPORT/TABLE/POST_TABLE_ACTION
ORA-39083: Object type POST_TABLE_ACTION failed to create with error:
ORA-01435: user does not exist
Failing sql is:
BEGIN
 SYS.DBMS_SNAPSHOT_UTL.SYNC_UP_LOG('ORG_USR','TABLEA');
 END;
ORA-39083: Object type POST_TABLE_ACTION failed to create with error:
ORA-01435: user does not exist
Failing sql is:
BEGIN
 SYS.DBMS_SNAPSHOT_UTL.SYNC_UP_LOG('ORG_USR','TABLEB');
 END;
ORA-39083: Object type POST_TABLE_ACTION failed to create with error:
ORA-01435: user does not exist
Failing sql is:
BEGIN
 SYS.DBMS_SNAPSHOT_UTL.SYNC_UP_LOG('ORG_USR','TABLEC');
 END;
Processing object type SCHEMA_EXPORT/MATERIALIZED_VIEW
Processing object type SCHEMA_EXPORT/TABLE/MATERIALIZED_VIEW_LOG
Job "SYSTEM"."SYS_IMPORT_FULL_01" completed with 3 error(s) at Thu Aug 17 11:19:02 2017 elapsed 0 00:05:56

I did specify REMAP_SCHEMA and REMAP_TABLESPACE, and the import runs mostly correct.

BUT at the end part trying Processing object type SCHEMA_EXPORT/TABLE/POST_TABLE_ACTION it somehow fails using the OLD User.

Can someone tell me what ist going wrong and how to fix it?


Solution

  • The soulution was to import excluding post_table_action and execute the statements manually after altering the schemaname to the correct value:

    impdp usr/pass \
        EXCLUDE=post_table_action \
        DIRECTORY=EXPDP \
        REMAP_SCHEMA=ORG_USR:NEW_USR \
        REMAP_TABLESPACE=ORG_TS:NEW_TS \
        DUMPFILE=FILE.dmp \
        PARALLEL=2 \
        LOGFILE=FILE.imp.log
    

    and

    BEGIN
    SYS.DBMS_SNAPSHOT_UTL.SYNC_UP_LOG('ORG_USR','TABLEA');
    END;
    BEGIN
    SYS.DBMS_SNAPSHOT_UTL.SYNC_UP_LOG('ORG_USR','TABLEB');
    END;
    BEGIN
    SYS.DBMS_SNAPSHOT_UTL.SYNC_UP_LOG('ORG_USR','TABLEC');
    END;