arthur

Austin Ofor

Posted on Jul 29, 2024

TABLE_EXISTS_ACTION Option In IMPDP

TABLE_EXISTS_ACTION parameter is required while importing table, which is already present in the database. We can put required value, according to our requirement.

TABLE_EXISTS_ACTION Action to take if imported object already exists. Valid keywords are: APPEND, REPLACE, [SKIP] and TRUNCATE.

TABLE_EXISTS_ACTION=APPEND:

With this option, while importing the table, if the table exists in the database, then it will append the data on top the existing data in the table.

select count(*) from "DBATEST"."EMP_TAB";

COUNT(*)
----------
175340


impdp dumpfile=emp_tab.dmp logfile=emp_tab.log directory=VEN table_exists_action=APPEND


Starting "SYS"."SYS_IMPORT_FULL_01": /******** AS SYSDBA dumpfile=emp_tab.dmp logfile=emp_tab.log directory=VEN table_exists_action=APPEND
Processing object type TABLE_EXPORT/TABLE/TABLE
Table "DBATEST"."EMP_TAB" exists. Data will be appended to existing table but all dependent metadata will be skipped due to table_exists_action of append
Processing object type TABLE_EXPORT/TABLE/TABLE_DATA
. . imported "DBATEST"."EMP_TAB" 19.16 MB 175340 rows
Job "SYS"."SYS_IMPORT_FULL_01" successfully completed at Tue Jan 24 08:57:09 2017 elapsed 0 00:01:18


SQL[SYS@]SQL>>]select count(*) from "DBATEST"."EMP_TAB";

COUNT(*)
----------
350680

TABLE_EXISTS_ACTION=TRUNCATE:

While importing the table, if the table exists in database, it will truncate the table and load the data.

impdp dumpfile=emp_tab.dmp logfile=emp_tab.log directory=VEN table_exists_action=TRUNCATE

Starting "SYS"."SYS_IMPORT_FULL_01": /******** AS SYSDBA dumpfile=emp_tab.dmp logfile=emp_tab.log directory=VEN table_exists_action=TRUNCATE
Processing object type TABLE_EXPORT/TABLE/TABLE
Table "DBATEST"."EMP_TAB" exists and has been truncated. Data will be loaded but all dependent metadata will be skipped due to table_exists_action of truncate
Processing object type TABLE_EXPORT/TABLE/TABLE_DATA
. . imported "DBATEST"."EMP_TAB" 19.16 MB 175340 rows
Job "SYS"."SYS_IMPORT_FULL_01" successfully completed at Tue Jan 24 09:02:23 2017 elapsed 0 00:01:11

TABLE_EXISTS_ACTION=REPLACE:

While importing , if the table exists in database, then it will drop it and recreate it from the dump

impdp dumpfile=emp_tab.dmp logfile=emp_tab.log directory=VEN table_exists_action=REPLACE

Starting "SYS"."SYS_IMPORT_FULL_01": /******** AS SYSDBA dumpfile=emp_tab.dmp logfile=emp_tab.log directory=VEN table_exists_action=REPLACE
Processing object type TABLE_EXPORT/TABLE/TABLE
Processing object type TABLE_EXPORT/TABLE/TABLE_DATA
. . imported "DBATEST"."EMP_TAB" 19.16 MB 175340 rows
Job "SYS"."SYS_IMPORT_FULL_01" successfully completed at Tue Jan 24 09:20:30 2017 elapsed 0 00:01:37

TABLE_EXISTS_ACTION=SKIP:

This is the defult option with impdp. I.e if the the table exists, it will skip that table.

Starting "SYS"."SYS_IMPORT_FULL_01": /******** AS SYSDBA dumpfile=emp_tab.dmp logfile=emp_tab.log directory=VEN
Processing object type TABLE_EXPORT/TABLE/TABLE
ORA-39151: Table "DBATEST"."EMP_TAB" exists. All dependent metadata and data will be skipped due to table_exists_action of skip
Processing object type TABLE_EXPORT/TABLE/TABLE_DATA
Job "SYS"."SYS_IMPORT_FULL_01" completed with 1 error(s) at Tue Jan 24 09:31:51 2017 elapsed 0 00:01:01

A forum to write, learn and earn.

Made with love and Next.js with a touch of tailwind.

Built by @kwadoskii

TSB © 2021 - 2026