Filtering options in Data Pump are still something that should be improved. Anyway, you could try the below parameters:
exclude=TABLE_DATA:" IN (select table_name from dba_tables where owner in ('SCHEMA1', 'SCHEMA2') union select partition_name from dba_tab_partitions where table_owner in ('SCHEMA1', 'SCHEMA2'))"
TABLE_DATA for all tables and partitions whose name match the result of the query provided in the
And that is why this may not be appropriate for you. If you have a table called
T1 both in
SCHEMA3, the data of
SCHEMA3.T1 will be excluded, because the above query returns
SCHEMA1, and Data Pump will ignore
TABLE_DATA of all table called
T1. If you have a partitioned table in
SCHEMA2, with a partition called
P1, the data of the table
SCHEMA3.P1 will be excluded. The above may work if your table and partition names are distinct accross all referenced schemas.
Or you could dynamically generate the expdp command or use DBMS_DATAPUMP to filter out all the table data from
But I would rather just run 2 seperate exports for
CONTENT=METADATA_ONLY and a default export (