UNLOAD

The UNLOAD online utility copies data from one or more source objects to one or more BSAM sequential data sets in external formats. The output records that the UNLOAD utility writes are compatible as input to the LOAD utility. Therefore, you can use this output to reload the original table or different tables.

Although the function of the UNLOAD utility is often referred to as unloading data, the data is not deleted from the source object. The utility just makes a copy of the data. That copy includes the data only; it does not include all of the pages, such as the system pages and header pages, that are included in an image copy.

The source for UNLOAD can be DB2® table spaces or DB2 image copy data sets. Start of changeThe source cannot be a concurrent copy or a FlashCopy® image copy.End of change

You can unload rows from an entire table space or select specific partitions or tables to unload. You can also select columns by using the field specification list. If a table space is partitioned, you can unload all of the selected partitions into a single data set. Alternatively, you can unload each partition in parallel into physically distinct data sets.

UNLOAD must be run on the system where the definitions of the table space and the table exist.

Output

UNLOAD generates an unloaded table space or partition.

Authorization required

To execute this utility, you must use a privilege set that includes one of the following authorities:

  • Ownership of the tables
  • SELECT privilege on the tables
  • DBADM authority for the database. If the object on which the utility operates is in an implicitly created database, DBADM authority on DSNDB04 or the implicitly created database is sufficient.
  • Start of changeDATAACCESS authorityEnd of change
  • SYSADM authority
  • SYSCTRL authority (catalog tables only)
  • Start of changeSQLADM authority (catalog tables only)End of change
  • Start of changeSystem DBADM authority (catalog tables only)End of change
  • Start of changeACCESSCTRL authority (catalog tables only)End of change
  • Start of changeSECADM authority (catalog tables only)End of change

If you use RACF® access control with multilevel security and UNLOAD is to process a table space that contains a table that has multilevel security with row-level granularity, you must be identified to RACF and have an accessible valid security label. Each row is unloaded only if your security label dominates the data security label. If your security label does not dominate the data security label, the row is not unloaded, but DB2 does not issue an error message.

Execution phases of UNLOAD

The UNLOAD utility operates in these phases:

Phase
Description
UTILINIT
Performs initialization.
UNLOAD
Unloads records to sequential data sets. One pass through the input data set is made. If UNLOAD is processing a table space or partition, DB2 takes internal commits. These commits provide commit points at which the utility can be restarted if the utility stops in this phase.
UTILTERM
Performs cleanup.