Excluding a particular table partition during data pump export

Raihan picture Raihan · Aug 1, 2012 · Viewed 16.8k times · Source

The exclude parameter can be used to filter out schema objects during export in Oracle Data Pump.

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

Is table partition a valid object_type?

In other words, is it posible to exclude selected table partitions during export?

Answer

Alex Poole picture Alex Poole · Aug 1, 2012

The section of the documentation that covers filtering during export operations says:

Metadata filtering is implemented through the EXCLUDE and INCLUDE parameters...

Metadata filters identify a set of objects to be included or excluded from an Export or Import operation...

To see a list of valid object types, query the following views: DATABASE_EXPORT_OBJECTS for full mode, SCHEMA_EXPORT_OBJECTS for schema mode, and TABLE_EXPORT_OBJECTS for table and tablespace mode. The values listed in the OBJECT_PATH column are the valid object types.

The first two views on my 11gR2 (EE) instance do not have any references to partitions; the third has some that refer to DBMS_PLUGTS, which doesn't appear in the PL/SQL Packages and Types Reference section, but seems to be for transportable tablespaces.

Not definitive, but based on that I'd have to say no, at least as separate object type.

So how about using the table:partition syntax that's valid in the TABLES clause? This doesn't work; if you try to include the partition name in the EXCLUDE clause:

expdp tables=MY_TABLE exclude=table:"= 'MY_TABLE:SOME_PARTITION'" ...

... it's ignored and the whole table is still exported - it seems to be treating the : as part of the table name, which isn't entirely unreasonable as it's in quotes, and therefore doesn't match against the table you're exporting at all. Same if you specify a schema to export, rather than just that table.

The only option you seem to have is to specify the partitions you do want in the TABLES clause.