DB2 Server for VSE & VM: Data Restore Guide


DBSU DATAUNLOAD and DATALOAD

DATAUNLOAD and DATALOAD are part of the DBSU.

DATAUNLOAD enables you to unload data from DB2 tables to a file with a user-defined format. The data to be unloaded is selected from the database within an SQL SELECT statement. The DATAUNLOAD command can have some subcommands that describe the data fields and the source in the output records. In most cases, each output record contains data from one row of a table. The record format can vary and can have different formats not only depending on the operating system, but also based on the user-defined record layout.

DATALOAD allows you to reload rows into existing DB2 tables from data contained in a sequential input file that was created by either DATAUNLOAD or a process outside the DB2 system.

For a complete and detailed description of these commands, refer to the DB2 Server for VSE & VM Database Services Utility manual.

Purpose

Some of the different purposes of this facility are:

Reorganization

Indexes can become unclustered when rows in a table are being added, deleted or updated. So there may be a need to unload and reload the data to cluster the indexes again. Reorganization is also useful if many rows have been deleted and the number of empty pages is too high. If reorganization is the main purpose, it is easier and faster to use the method described in DBSU UNLOAD and RELOAD. To unload data in a specific order and reload it independent of the clustering index you can use ORDER BY on the DATAUNLOAD command.

Restructure

A change in the structure of a table may be required. If the layout of the table, the datatype of the columns or the NULL definition needs changing, consider using DATAUNLOAD and DATALOAD because you can provide the table definition with the DATALOAD command sequence. DATAUNLOAD and DATALOAD would be the best way to do this.

DATAUNLOAD should also be used if columns need the NOT NULL specification, or columns have to be created that would be parts of an existing column or combination of columns. In general, DATAUNLOAD and DATALOAD are best for any data manipulation against the existing database because you have the possibility to make changes.

Export/Import

Data may be needed for a test system or for another application. For example, if you are building a new application, you may want to use some of your data or tables as a sample of the actual data with which the application will need to work. Or you may want to unload data so it can be moved to another database, used by a completely different type of application, or moved to another platform. There, this data could be used for creating a report, making an analysis, or for other purposes.

Other database system

If data needs to be unloaded from or reloaded to a different platform or another type of database, the appropriate command should be used there to do the equivalent operation.

Ease of Operation with Control Center

If data remains on the same platform, Control Center can help you to ease work. The Control Center function SQLTABLE uses the DATAUNLOAD function and offers a menu driven interface to provide options to:

For a complete description of SQLTABLE refer to DB2 for VM Control Center Operations Guide or DB2 for VSE Control Center Operations Guide.


[ Top of Page | Previous Page | Next Page | Table of Contents | Index ]