IBM Data Server DB2 User Manual
Page 250
236
DB2 Deployment Guide
For a detailed description of the export utility, refer to the DB2 Infocenter:
Importing data
You can use either the import utility or the load utility to move the exported data
into the target database. The import utility is based upon the SQL statements
and all the integrities and constraints are obtained during import. In general, the
import utility is used if the amount of data is not to big. For large amount of data,
the load utility is much faster. However, the load utility does not set referential
integrity, which mean that foreign key relations are not checked. After the load
utility has completed, some tables might be in integrity pending state and are not
accessible. You can use the
set integrity
command to validate dependencies
and bring tables back into accessible mode.
Another difference between import and load is that the import utility cannot
override the columns defined as
generated always
. The load utility is required if
there are such columns in the tables.
Assuming that there are no special requirements or data restrictions that force us
to choose one over the other, the choice can usually be based on the amount of
data and the performance requirements. If the data volume is large and the
performance is a concern, the load utility is preferable.
For a thorough comparison of these two methods, refer to the DB2 Infocenter:
Import utility
The import utility populates a table with data by using the SQL INSERT
statement. There are several options on how to control the behavior of the utility.
The most important option is the import mode. This mode controls what to do
with existing data in the tables. Table 5-2 lists the different modes.
Table 5-2 The different import modes
Mode
Description
INSERT
Insert the data into the target table without changing existing data.
INSER_UPDATE
Update rows with matching primary key values with values of the
input rows. If there is no matching row, insert the data row into the
table.
REPLACE
Delete all the existing data and insert the input data. The table and
index definitions are kept.