Database Reference
In-Depth Information
The resulting dump file only contains rows filtered by the
QUERY
parameters. Again, be mindful of any
parent-child relationships, and ensure that what gets exported won't violate any constraints on the import.
You can also specify a query when importing data. Here is a parameter file that limits the rows imported into the
INV
table, based on the
INV_ID
column:
userid=mv_maint/foo
directory=dp_dir
dumpfile=inv.dmp
tables=inv,reg
query=inv:"WHERE inv_id > 10"
This text is placed in a file named
inv2.par
and is referenced during the import as follows:
$ impdp parfile=inv2.par
All the rows from the
REG
table are imported. Only the rows in the
INV
table that have an
INV_ID
greater than 10
are imported.
Exporting a Percentage of the Data
When exporting, the
SAMPLE
parameter instructs Data Pump to retrieve a certain percentage of rows, based on a
number you provide. Data Pump doesn't keep track of parent-child relationships when exporting. Therefore, this
approach doesn't work well when you have tables linked via foreign key constraints and you're trying to select a
percentage of rows randomly.
Here is the general syntax for this parameter:
SAMPLE=[[schema_name.]table_name:]sample_percent
For example, if you want to export 10 percent of the data in a table, do so as follows:
$ expdp mv_maint/foo directory=dp_dir tables=inv sample=10 dumpfile=inv.dmp
This next example exports two tables, but only 30 percent of the
REG
table's data:
$ expdp mv_maint/foo directory=dp_dir tables=inv,reg sample=reg:30 dumpfile=inv.dmp
■
Note
the
SAMPLE
parameter is only valid for exports.
Excluding Objects from the Export File
For export the
EXCLUDE
parameter instructs Data Pump not to export specified objects (whereas the
INCLUDE
parameter instructs Data Pump to include only specific objects in the export file). The
EXCLUDE
parameter has this
general syntax:
EXCLUDE=object_type[:name_clause] [, ...]