Sunday, April 24, 2011

EXPDP - EXCLUDE Multiple TABLES and SCHEMAS



The below example gives syntax to EXCLUDE multiple tables and multiple schemas while doing a full database export using expdp

=== BEGIN expdp_exclude.par

DIRECTORY=DATA_PUMP_DIR
DUMPFILE=abc.dmp
LOGFILE=abc.log
FULL=Y
EXCLUDE=STATISTICS
EXCLUDE=TABLE:"IN ('NAME', 'ADDRESS' , 'EMPLOYEE' , 'DEPT')"
EXCLUDE=SCHEMA:"IN ('WMSYS', 'OUTLN')"

=== END expdp_exclude.par

In the above example parameter file; tables NAME and ADDRESS are owned by SCOTT and tables EMPLOYEE and DEPT are owned by HR
EXCLUDE=TABLE => You do not have to prefix the OWNER name, in fact, if you put the OWNER.TABLE_NAME, it would not work.
It will EXCLUDE all TABLES having the name mentioned in the list, even if more than one owner has the same object name.
For example: If ADDRESS table is owned by user SCOTT and user HR, that table will be EXCLUDED from both the users.

The above commands would work only via parameter file and would not work on the command line.


COMMAND LINE SYNTAX for EXPDP

expdp system/password DIRECTORY=DATA_PUMP_DIR DUMPFILE=abc.dmp FULL=Y
EXCLUDE=TABLE:\"IN \(\'NAME\', \'ADDRESS\' , \'EMPLOYEE\' , \'DEPT\'\)\"
EXCLUDE=SCHEMA:\"IN \(\'WMSYS\', \'OUTLN\'\)\"


10 comments:

  1. See some examples here...
    http://shonythomas.blogspot.in/2011/06/data-pump-expdp-impdp-exclude-and.html

    ReplyDelete
  2. This comment has been removed by the author.

    ReplyDelete
  3. Good post. I found lot of useful articles on datapump in this link.
    http://www.acehints.com/p/site-map.html

    ReplyDelete
  4. perfect. Just what I was looking for.

    ReplyDelete
  5. This is a new tip for me. I have also written some Expdp Exclude parameter at

    http://www.dbas-oracle.com/2013/07/Expdp-Exclude-and-Expdp-Include-Parameter.html

    ReplyDelete
  6. At last I found the solution to my problem. Simply all other notes didn't put an escape character to the parenthesis.

    Thanks a lot.

    ReplyDelete
  7. This comment has been removed by the author.

    ReplyDelete
  8. the problem is that i exclude the given schemas which i didnt want to exp dump file ,but still they are going to backup
    what should be the reason ???
    any one have this issue

    ReplyDelete
  9. I’d must test with you here. Which isn't one thing I normally do! I enjoy reading a post that can make people think. Also, thanks for allowing me to remark! online gambling casino

    ReplyDelete
  10. Expdp full=y dumpfile=CTO,CIO exclude=CRAZY_BOSS,OBNOXIOUS_APP_OWNER Include=MOREDAYS_OFF,GOOD_PATCHES parallel=UNIVERSE logfile=CIA_NSA_KREMLIN.log

    ReplyDelete