How DB2 extends data sets
When a data set is created, DB2® allocates a primary allocation space on a volume that has available space and that is specified in the DB2 storage group. Any extension to a data set always gets a secondary allocation space.
If new extensions reach the end of the volume, DB2 accesses all candidate volumes from the DB2 storage group and issues the Access Method Services command ALTER ADDVOLUMES to add these volumes to the integrated catalog facility (ICF) catalog as candidate volumes for the data set. DB2 then makes a request to allocate a secondary extent on any one of the candidate volumes that has space available. After the allocation is successful, DB2 issues the command ALTER REMOVEVOLUMES to remove all candidate volumes from the ICF catalog for the data set.
DB2 extends data sets when either of the following conditions occurs:
- The requested space exceeds the remaining space in the data set.
- 10% of the secondary allocation space (but not over 10 allocation units, based on either tracks or cylinders) exceeds the remaining space.
If DB2 fails to extend a data set with a secondary allocation space because of insufficient available space on any single candidate volume of a DB2 storage group, DB2 tries again to extend with the requested space if the requested space is smaller than the secondary allocation space. Typically, DB2 requests only one additional page. In this case, a small amount of two units (tracks or cylinders, as determined by DFSMS based on the SECQTY value) is allocated. To monitor data set extension activity, use IFCID 258 in statistics class 3.
Nonpartitioned spaces
When a table space requires a new
piece, the primary allocation quantity of the new piece is determined
as follows:

- If the value of subsystem parameter MGEXTSZ is NO, the primary quantity is the PRIQTY value for the table space. If PRIQTY is not specified, the default for PRIQTY is used.
- If the value of MGEXTSZ is YES, the primary quantity is the maximum
of the following values:
- The quantity that is calculated through sliding scale methodology
- The primary quantity from rule 1
- The specified SECQTY value
Partitioned spaces
For a partitioned table space or a partitioned index space, each partition is a data set. Therefore, DB2 defines each partition with the primary allocation space and extends each partition's data set by using a secondary allocation space, as needed.
Extension failures
If a data set uses all possible extents, DB2 cannot extend that data set. For a partitioned page set, the extension fails only for the particular partition that DB2 is trying to extend. For nonpartitioned page sets, DB2 cannot extend to a new data set piece, which means that the extension for the entire page set fails.
To avoid extension failures, allow DB2 to use the default value for primary space allocation and to use a sliding scale algorithm for secondary extent allocations.
DB2 might not be able to extend a data set if
the data set is in an SMS data class that constrains the number of
extents to less than the number that is required to reach full size.
To prevent extension failures, make sure that the SMS data class setting
for the number of allowed extents is large enough to accommodate 128
GB and 256 GB data sets.