6

I have an entire DB to be imported as a dump into my own. I want to exclude data out of certain tables(mostly because they are huge in size and not useful). I cannot entirely exclude those tables since I need the table object per se(minus the data) and will have to re create them in my schema if I do so. Also in the absence of those table objects , various other foreign constraints defined on other tables will also fail to be imported and will need to be redefined.So I need to exclude just the data from certain tables.I want data from all other tables though.

Is there a set of parameters for impdp that can help me do so?

Brian Tompsett - 汤莱恩
  • 5,753
  • 72
  • 57
  • 129
atlantis
  • 3,056
  • 9
  • 30
  • 41

5 Answers5

10

I would make two runs at it: The first I would import metadata only:

impdp ... CONTENT=METADATA_ONLY

The second would include the data only for the tables I was interested in:

impdp ... CONTENT=DATA_ONLY TABLES=table1,table2...

Blag
  • 5,818
  • 2
  • 22
  • 45
DCookie
  • 42,630
  • 11
  • 83
  • 92
8

Definitely make 2 runs. One to create all the table objects, but instead of using tables in the second impdp run, use the exclude

impdp ... Content=data_only exclude=TABLE:"IN ('table1', 'table2')"

The other way works, but this way you only have to list the tables you don't want versus all that you want.

NullUserException
  • 83,810
  • 28
  • 209
  • 234
MichaelN
  • 1,734
  • 11
  • 6
  • For some reason `exclude=TABLE:"IN ('table1', 'table2')"` didn't work for me in 11.4. I had to write: `exclude=TABLE:"IN ('table1')" exclude=TABLE:"IN ('table2')"` separately for each table – Jack Scandall Nov 28 '22 at 09:44
1

Syntax:

EXCLUDE=[object_type]:[name_clause],[object_type]:[name_clause]
INCLUDE=[object_type]:[name_clause],[object_type]:[name_clause]

Examples of operator-usage:

   EXCLUDE=SEQUENCE
or EXCLUDE=TABLE:"IN ('EMP','DEPT')"
or EXCLUDE=INDEX:"= 'MY_INDX'"
or INCLUDE=PROCEDURE:"LIKE 'MY_PROC_%'"
or INCLUDE=TABLE:"> 'E'"

The parameter can also be stored in a parameter file, for example: exp.par

DIRECTORY = my_dir
DUMPFILE = exp_tab.dmp
LOGFILE = exp_tab.log
SCHEMAS = scott
INCLUDE = TABLE:"IN ('EMP', 'DEPT')"
Mat
  • 202,337
  • 40
  • 393
  • 406
mmahroug
  • 11
  • 1
1

If the size of the table is big for export import the you can use "SAMPLE" parameter in expdp command to take export of table for what ever percentage you want ....

$ expdp tables=T100test DIRECTORY=expimp1 DUMPFILE=test12.dmp SAMPLE = 10;

This command will export only 10% data of the T100test table's data.

xav
  • 5,452
  • 7
  • 48
  • 57
0

It seems you can exclude directly when importing using impdp query parameter

impdp [...] QUERY='TABLE_NAME:"WHERE rownum = 0"'

cf : community.oracle.com

k4cy
  • 322
  • 3
  • 8