Search code examples
oracle-databaseimpdp

import and remaping tables without adding primary key and indexes


I am trying to import a dump to a database. the dump has a table called table1 which already exists in the database , that I was I used remap_table.

impdp schema/pass@server remap_table = table1:table_BR1 directory=TEST_DIR1 dumpfile=table_BR1.dmp logfile=table1.log  

However the problem I am facing , its also creating the primary key and index, causing errors "constraints already exists" In my real scenario I have several tables.

My question , is there way that I can remap the tables without adding the primary keys and indexex ?


Solution

  • In IMPDP, you could use:

    CONTENT=DATA_ONLY
    

    DATA_ONLY loads only table row data into existing tables; no database objects are created.

    Other ways are,

    You could explicitly specify not to import the indexes and constraints as command line arguments.

    rows=Y indexes=N constraints=N
    

    This would import only the data and not indexes and constraints.

    Also, to suppress the error messages, you could ignore them:

    IGNORE=Y
    

    To see a list of all import commands, do:

    impdp help=y
    

    Alternatively, if you know the INDEX names, you could use the EXCLUDE command.

    For example,

    EXCLUDE=INDEX:"LIKE 'DEPT%'"
    

    This will exclude all indexes whose names start with dept.