Sometimes its needed to take a backup of schema metadata of all objects with only limited rows from each table with Oracle DataPump (export and import).
In my example, I'll take the export of 20 rows from each table with all metadata, you can modify .par accordingly. Will run two export command
- Export METADATA_ONLY
- Export N Rows from each table
Also, you can extract the DDL from a dump into a .SQL file.
In this way, we can have the data in a small limited-size file for our testing purpose to import into another database.
Create directory in oracle
First export run for metadata only for a specified schema.
Second export run for 20 rows from each table.
Third Export to extract the DDL from an exported .dmp file.
Another example of exporting with multiple queries and keeping only the latest data based on the date column and also can be modified according to your requirements.
Note: Above parameter file is not tested but you can use it as a reference. Also, we can add other data pump parameters as per export/import requirements in the .par file.