DB2 provides the import and load utilities to help you move data into a table from existing sources. Another method of moving data into a database is replication, described briefly in "Replicating Data".
Manual entry of data into your database can be done either with SQL commands, described in the SQL Reference; Lotus Approach, described in the Using Lotus Approach with DB2 booklet (provided in the product box with DB2); or an application.
The import utility takes data from an input file and inserts it into a table or view. This input file would contain data that was extracted from an existing source of data, such as a Lotus 1-2-3 file or an ASCII file. DB2 imports file formats generated from the supported sources listed in "Importing Data into a Table or View". However, the procedure for generating each of these files will vary with the original source. For details on generating the appropriate input file format, refer to the documentation accompanying the source product.
You can also use the import utility to re-create a table or view that was saved by using the export utility. See the Administration Guide for more information on import and export.
This section provides the steps for importing data. A brief overview of the other two methods is provided.
Once you have an input file available in a supported format, use the Import notebook to insert data from the file into an existing table. If this table already contains data, you can either replace or append to the existing data with the data in the file.
You can also use the Import notebook to create a new table that is populated by an input file, or delete existing rows in the selected table and repopulate it using data from the input file.
The online help provides details on how to complete all the optional and required fields.
To import a file into an existing table:
Use the File page of the Import notebook to specify the file and type of file you want to import:
Non-delimited ASCII data is data that is aligned in columns.
Delimited ASCII data is a commonly used way of storing data that separates column values with a user-defined delimiting character such as a comma.
PC/IXF is a structured description of a database table or view. Data that was exported in PC/IXF format can be imported or loaded into another DB2 Universal Database product database.
See the online help for the specific products and releases that are supported.
Use the Large Objects page of the Import notebook to retrieve large objects (LOBs) from the path or paths that store the LOB files:
Use the Columns page of the Import notebook to specify column import options:
This option is not available if you selected the Default (method D) radio button.
The load utility loads data directly into a DB2 table from one or more files, tapes and other devices, or named pipes. For example, you might be required to move in data from databases other than DB2. For a description of the functional differences between the load utility and the import utility, see the Administration Guide.
During load processing, indexes can be built, primary keys, unique keys, and unique indexes validated, and many statistics generated, all without requiring secondary passes through the data. The load utility is faster than the import utility, and supports the loading of all data types (excluding worksheet format). It is intended for either bulk loading of new tables or appending large amounts of data to existing tables.
Replication is the process of taking changes stored in the database log at the source server and applying them to the target server. You can use replication to define, synchronize, automate, and manage copy operations for data across your enterprise. You can automatically deliver the data from a host system to target sites. For example, you can copy data and applications to branch offices, retail outlets, and even sales representatives' laptops.
The two operational components in replication are Capture and Apply. The Capture component captures changes made to data in source tables which have been defined for replication by reading the database log. The Apply component reads the changed data previously captured and stored in a change data table and applies it to the target tables.
Using the Control Center you can do the setup required for replication using the Define as replication source and Define subscription actions. The replication components Capture and Apply run outside the DB2 administration tools.
Replication administrators can perform the following from the Control Center:
The high-level steps for replicating data are as follows. See the Replication Guide and Reference for details.