Syntax and options of the RECOVER control statement
The RECOVER utility control statement, with its multiple options, defines the function that the utility job performs.
You can create a control statement with the ISPF/PDF edit function. After creating it, save it in a sequential or partitioned data set. When you create the JCL for running the job, use the SYSIN DD statement to specify the name of the data set that contains the utility control statement.
Syntax diagram
>>-RECOVER------------------------------------------------------> >--+-+-LIST--listdef-name----------------+--list-options-spec-+--> | | .-------------------------------. | | | | V .-DSNUM--ALL---------. | | | | '---object-+--------------------+-+-' | | | (1) | | | '-DSNUM--integer-----' | +-recover-options-spec-------------------------------------+ '-object--PAGE--page-number--+----------+------------------' '-CONTINUE-' .-LOGRANGES--YES----. >--+-------+--+--------------+--+-------------------+---------->< '-CLONE-' +-LOCALSITE----+ | (2) | '-RECOVERYSITE-' '-LOGRANGES--NO-----'
- DSNUM integer is not valid for nonpartitioned indexes.
- Use the LOGRANGES NO option only at the direction of IBM® Software Support. This option can cause the LOGAPPLY phase to run much longer and, in some cases, apply log records that should not be applied.
object:
>>-+-TABLESPACE--+----------------+-table-space-name-+--------->< | '-database-name.-' | +-INDEXSPACE--+----------------+-index-space-name-+ | '-database-name.-' | '-INDEX--+-------------+-index-name---------------' '-creator-id.-'
list-options-spec:
.-BACKOUT--NO------. >>-+------------------+-----------------------------------------> | .-YES-. | '-BACKOUT--+-----+-' >--+------------------------------------------------------------------+--> | .-VERIFYSET--YES-. .-ENFORCE--YES-. | +-TORBA--X'byte-string'--+----------------+--+--------------+------+ | '-VERIFYSET--NO--' '-ENFORCE--NO--' | | .-VERIFYSET--YES-. .-ENFORCE--YES-. | '-TOLOGPOINT--X'byte-string'--+----------------+--+--------------+-' '-VERIFYSET--NO--' '-ENFORCE--NO--' >--+-non-LOGONLY-options-spec-+-------------------------------->< '-LOGONLY------------------'
non-LOGONLY-options-spec:
>>-+-------+--+-----------------+-------------------------------> '-REUSE-' '-CURRENTCOPYONLY-' >--+----------------------------------------------------------------+--> '-PARALLEL-+---------------+-+---------------------------------+-' '-(num-objects)-' '-TAPEUNITS--(--num-tape-units--)-' >--+-------------------------------+----------------------------> '-RESTOREBEFORE--X'byte-string'-' >--+--------------------------------+-------------------------->< '-FROMDUMP--+------------------+-' '-DUMPCLASS--(dcl)-'
recover-options-spec:
.-DSNUM--ALL---------. >>-object--+--------------------+-------------------------------> | (1) | '-DSNUM--integer-----' .-ENFORCE--YES-. >--+-TOCOPY--data-set--+-----------------+--+-------+--+-----------------+--+--------------+-+->< | '-image-copy-spec-' '-REUSE-' '-CURRENTCOPYONLY-' '-ENFORCE--NO--' | | .-ENFORCE--YES-. | +-TOLASTCOPY--+-------+--+-----------------+--+--------------+----------------------------+ | '-REUSE-' '-CURRENTCOPYONLY-' '-ENFORCE--NO--' | | .-ENFORCE--YES-. | +-TOLASTFULLCOPY--+-------+--+-----------------+--+--------------+------------------------+ | '-REUSE-' '-CURRENTCOPYONLY-' '-ENFORCE--NO--' | '-ERROR--RANGE----------------------------------------------------------------------------'
- DSNUM integer is not valid for nonpartitioned indexes unless the data set that is specified for TOCOPY is a FlashCopy image copy.
image-copy-spec:
>>-TOVOLUME-+-CATALOG----------------------+------------------->< '-vol-ser-+------------------+-' '-TOSEQNO--integer-'
Option descriptions
You can specify a list of objects by repeating the TABLESPACE, INDEX, or INDEXSPACE keywords. If you use a list of objects, the valid keywords are: DSNUM, TORBA, TOLOGPOINT, LOGONLY, PARALLEL, and either LOCALSITE or RECOVERYSITE.
The options TOCOPY, TOLASTCOPY, TOLASTFULLCOPY, TORBA and TOLOGPOINT are all referred to as point-in-time recovery options.
- LIST listdef-name
- Specifies the name of a previously defined LISTDEF list name. The utility allows one LIST
keyword for each control statement of RECOVER. The list can contain a mixture of table spaces and
index spaces.
RECOVER
is invoked once for the entire list.
This utility does not support lists that
specify more than 32,000 objects. Partitions of table spaces or index spaces that are included by
the PARTLEVEL keyword count as separate objects.
This utility only processes clone data if the CLONE keyword is specified. The use of CLONED YES on the LISTDEF statement is not sufficient.
The
partitions or partition ranges can be specified in a list.
- TABLESPACE database-name.table-space-name
- Specifies the table space (and optionally, the database to which it belongs) that is to be
recovered.You can specify a list of table spaces by repeating the TABLESPACE keyword. You can recover an individual catalog or directory table space in a list with its IBM-defined indexes.
- database-name
- Is the name of the database to which the table space belongs.
The default value is DSNDB04.
- table-space-name
- Is the name of the table space that is to be recovered.
- INDEXSPACE database-name.index-space-name
- Specifies the index space that is to be recovered.
- database-name
- Specifies the name of the database to which the index space belongs.
The default value is DSNDB04.
- index-space-name
- Specifies the name of the index space that is to be recovered.
- INDEX creator-id.index-name
- Specifies the index in the index space that is to be recovered. The RECOVER utility can recover
only indexes that were defined with the COPY YES attribute and subsequently copied.
- creator-id
- Optionally specifies the creator of the index.
The default value is the user identifier for the utility.
- index-name
- Specifies the name of the index in the index space that is to be recovered. Enclose the index name in quotation marks if the name contains a blank.
- DSNUM
- Identifies a partition within a partitioned table space or a partitioned index, or identifies a
data set within a nonpartitioned table space that is to be recovered. Alternatively, the option can
recover the entire table space or index space.
You cannot specify a logical partition of a
nonpartitioned index. You cannot specify a single data set of a nonpartitioned index unless the data
set that is specified for TOCOPY is a FlashCopy image copy. However, to ensure consistency, all data
sets of a nonpartitioned index should be recovered to the same point in time. 
- ALL
- Specifies that the entire table space or index space is to be recovered.
- integer
- Specifies the number of the partition or data set that is to be recovered. The maximum value is 4096.
- For a partitioned table space or index space:
The
integer is its physical partition number.
- For a nonpartitioned table space:
Find the integer at the end of the data set name. The data set name has the following format:
catname.DSNDBx.dbname.tsname.y000z.Annn- catname
- Is the VSAM catalog name or alias.
- x
- Is C or D.
- dbname
- Is the database name.
- tsname
- Is the table space name.
- y
- Is I or J.
- z
- Is 1 or 2.
- nnn
- Is the data set integer.
- PAGE page-number
- Specifies a particular page that is to be recovered. You cannot specify this option if you are
recovering from a concurrent copy. page-number is the number of the page, in either decimal or hexadecimal notation. For example, both 999 and X'3E7' represent the same page. PAGE is invalid with the LIST specification.
- CONTINUE
- Specifies that the recovery process is to continue. Use this option only if an error causes
RECOVER to terminate during reconstruction of a page. In this case, the page is marked as
"broken". After you repair the page, you can use the CONTINUE option to recover the page,
starting from the point of failure in the recovery log.
Contact the IBM Support Center before you run the
RECOVER utility with the PAGE CONTINUE keywords.
- TORBA X'byte-string'
- Specifies, in a non-data-sharing environment, a point on the log to which RECOVER is to recover.
Specify an RBA value. The recovery process ends with the last log record whose relative byte address
(RBA) is not greater than X'byte-string'. If
X'byte-string' is the RBA of the first byte of a log record, that
record is included in the recovery.
The RBA is a string
of up to 20 hexadecimal characters, which represent the 6-byte RBA format or the extended 10-byte
RBA format. Values are padded on the left with zeros if needed. Values greater than
X'FFFFFFFFFFFF' are invalid.
In a data sharing environment, use TORBA only when you want to recover to a point before the originating member joined the data sharing group. If you specify an RBA after this point, the recovery fails.
For a NOT LOGGED table space, the value must be a recoverable point.
Uncommitted work by units of recovery that are active at the specified RBA are backed out by RECOVER so that each object is left in a consistent state.
- TOLOGPOINT X'byte-string'
- Specifies a point on the log to which RECOVER is to recover. Specify either an RBA or an LRSN
value.
The
RBA or LRSN is a string of 12 or 20 hexadecimal characters, which represent the 6-byte RBA format or
the extended 10-byte RBA format.
In a data-sharing environment, a 6-byte LRSN value must be greater than X'00FFFFFFFFFF' and
a 10-byte value must be greater than X'0000FFFFFFFFFFFFFFFF'.
Support for values that are
shorter than 12 hexadecimal digits is deprecated in DB2® 11. For compatibility with DB2 11, specify all values as 12 hexadecimal digits
or 20 hexadecimal digits.
For a NOT LOGGED table space, the value must be a recoverable point.
Uncommitted work by units of recovery that are active at the specified LRSN or RBA will be backed out by RECOVER, leaving each object in a consistent state.
- REUSE
- Specifies that RECOVER is to logically reset and reuse DB2-managed data sets without deleting
and redefining them. If you do not specify REUSE, DB2 deletes and redefines DB2-managed data sets to
reset them.
If you are recovering an object because of a media failure, do not specify REUSE.
If a data set has multiple extents, the extents are not released if you use the REUSE parameter.
- CURRENTCOPYONLY
- Specifies that RECOVER is to improve the performance of restoring concurrent copies (copies that
were made by the COPY utility with the CONCURRENT option) by using only the most recent primary copy
for each object in the
list.
When you specify CURRENTCOPYONLY for a concurrent copy, RECOVER builds a DFSMSdss RESTORE command for each group of objects that is associated with a concurrent copy data set name. If the RESTORE fails, RECOVER does not automatically use the next most recent copy or the backup copy, and the object fails. If you specify DSNUM ALL with CURRENTCOPYONLY and one partition fails during the restore process, the entire utility job on that object fails.
If you specify CURRENTCOPYONLY and the most recent primary copy of the object to be recovered is not a concurrent copy, DB2 ignores this keyword.
For objects in the recovery list whose recovery base is a system-backup, the default is CURRENTCOPYONLY.
- PARALLEL
Specifies the maximum number of objects in the list that are to be restored in parallel from image copies on disk or tape. RECOVER attempts to retain tape mounts for tapes that contain stacked image copies when the PARALLEL keyword is specified. In addition, to maximize performance, RECOVER determines the order in which objects are to be restored. PARALLEL also specifies the maximum number of objects in the list that are to be restored in parallel from system-level backups that have been dumped to tape. The processing may be limited by DFSMShsm.
If you specify TAPEUNITS with PARALLEL, you control the number of tape drives that are dynamically allocated for the recovery function. The TAPEUNITS keyword applies only to tape drives that are dynamically allocated. The TAPEUNITS keyword does not apply to JCL-allocated tape drives. The total number of tape drives that are allocated for the RECOVER job is the sum of the JCL-allocated tape drives, and the number of dynamically allocated tape drives. The number of dynamically allocated tape drives is determined as follows:
- The specified value for TAPEUNITS.
- The value that is determined by the RECOVER utility if you omit the TAPEUNITS keyword. The number of tape drives that RECOVER attempts to allocate is determined by the object in the list that requires the most tape drives.
If you specify PARALLEL, you cannot specify TOCOPY, TOLASTCOPY, or TOLASTFULLCOPY.
- (num-objects)
- Specifies the number of objects in the list that are to be processed in parallel. If storage
constraints are encountered, you can adjust this value to a smaller
value.
If you specify 0 or do not specify TAPEUNITS keyword, RECOVER determines the optimal number of objects to process in parallel.
- TAPEUNITS
- Specifies the number of tape drives that the utility should dynamically allocate for the list of
objects that are to be processed in parallel. If you omit this keyword, the utility determines the
number of tape drives to allocate for the recovery function.
The TAPEUNITS option does not apply to recovery from system-level backups. In this case, DFSMShsm determines the number of tape drives that are used for the recovery.
- (num-tape-units)
- Specifies the number of tape drives to allocate. If you specify 0 or do not specify a value for num-tape-units, RECOVER determines the maximum number of tape units to use at one time. RECOVER TAPEUNITS has a max value of 32767.
- RESTOREBEFORE X'byte-string'
- Specifies that RECOVER is to search for an image copy, concurrent copy, or
system-level backup (if yes has been specified for the SYSTEM_LEVEL_BACKUPS subsystem parameter)
with an RBA or LRSN value earlier than the specified X'byte-string' value
to use in the RESTORE phase.
The RBA or LRSN is a string of 12 or
20 hexadecimal characters, which represent the 6-byte RBA format or the extended 10-byte RBA format.
Any 10-byte values are immediately converted to 6-byte format. All further RECOVER processing is
performed with the 6-byte format.In a data-sharing environment, a 6-byte LRSN value must be greater
than X'00FFFFFFFFFF' and a 10-byte value must be greater than
X'0000FFFFFFFFFFFFFFFF'.
Support for values that are shorter than
12 hexadecimal digits is deprecated in DB2 11. For compatibility with DB2 11, specify all values as 12 hexadecimal digits
or 20 hexadecimal digits.
To avoid specific image copies, concurrent copies, or system-level backups with matching or more recent RBA or LRSN values in START_RBA, the RECOVER utility applies the log records and restores the object to its current state or the specified TORBA or TOLOGPOINT value. The RESTOREBEFORE value is compared with the RBA or LRSN value in the START_RBA column in the SYSIBM.SYSCOPY record for those copies. For system-level backups, the RESTOREBEFORE value is compared with the data complete LRSN.
If you specify a TORBA or TOLOGPOINT value with the RESTOREBEFORE option, the RBA or LRSN value for RESTOREBEFORE must be lower than the specified TORBA OR TOLOGPOINT value. If you specify RESTOREBEFORE, you cannot specify TOCOPY, TOLASTCOPY, or TOLASTFULLCOPY.
- FROMDUMP
- Specifies that only dumps of the database copy pool are used for the restore of the data sets.
- DUMPCLASS (dcl)
- Indicates the DFSMShsm dump class to use to restore the data sets.
- LOGONLY
- Specifies that the target objects are to be recovered from their existing data sets by applying
only log records to the data sets. DB2 applies all log records
that were written after a point that is recorded in the data set itself.
To recover an index space by using RECOVER LOGONLY, you must define the index space with the COPY YES attribute.
Use the LOGONLY option when the data sets of the target objects have already been restored to a point of consistency by another process offline, such as DFSMSdss concurrent copy.
LOGONLY is not allowed on a table space or index space with the NOT LOGGED attribute.
- TOCOPY data-set
- Specifies the particular image copy data set that DB2 is to use as a source for recovery.
data-set is the name of the data set.
If the data set is a full image copy, it is the only data set that is used in the recovery. If it is an incremental image copy, RECOVER also uses the previous full image copy and any intervening incremental image copies.
If you specify the data set as the local backup copy, DB2 first tries to allocate the local primary copy. If the local primary copy is unavailable, DB2 uses the local backup copy.
If you use TOCOPY or TORBA to recover a single data set of a nonpartitioned table space, DB2 issues message DSNU520I to warn that the table space can become inconsistent following the RECOVER job. This point-in-time recovery can cause compressed data to exist without a dictionary or can even overwrite the data set that contains the current dictionary.
If you use TOCOPY with a particular partition or data set (identified with DSNUM), the image copy must be for the same partition or data set, or for the whole table space or index space. If you use TOCOPY with DSNUM ALL, the image copy must be for DSNUM ALL. You cannot specify TOCOPY with a LIST specification.
If the image copy is a Flash Copy image copy data set, and the object is partitioned,
you must specify the number of the partition that is to be recovered on the DSNUM
parameter.
If the image copy data set is a z/OS® generation data set, supply a fully qualified data set name, including the absolute generation and version number.
If the image copy data set is not a generation data set and more than one image copy data set with the same data set name exists, use one of the following options to identify the data set exactly:
- TOVOLUME
- Identifies the image copy data set.
- CATALOG
- Indicates that the data set is cataloged. Use this option only for an image copy that was
created as a cataloged data set. (Its volume serial is not recorded in SYSIBM.SYSCOPY.)
RECOVER refers to the SYSIBM.SYSCOPY catalog table during execution. If you use TOVOLUME CATALOG, the data set must be cataloged. If you remove the data set from the catalog after creating it, you must catalog the data set again to make it consistent with the record for this copy that appears in SYSIBM.SYSCOPY.
- vol-ser
- Identifies the data set by an alphanumeric volume serial identifier of its first volume. Use
this option only for an image copy that was created as a noncataloged data set. Specify the first
vol-ser in the SYSCOPY record to locate a data set that is stored on
multiple tape volumes.
- TOSEQNO integer
- Identifies the image copy data set by its file sequence number. integer is the file sequence number.
- TOLASTCOPY
- Specifies that RECOVER is to restore the object to the last image copy that was taken. If the last image copy is a full image copy, it is restored to the object. If the last image copy is an incremental image copy, the most recent full copy along with any incremental copies are restored to the object.
If the
image copy is a Flash Copy image copy data set, and the object is partitioned, you must specify the
number of the partition that is to be recovered on the DSNUM parameter.
- TOLASTFULLCOPY
- Specifies that the RECOVER utility is to restore the object to the last full image copy that was taken. Any incremental image copies that were taken after the full image copy are not restored to the object.
If the
image copy is a Flash Copy image copy data set, and the object is partitioned, you must specify the
number of the partition that is to be recovered on the DSNUM parameter.
- ERROR RANGE
- Specifies that all pages within the range of reported I/O errors are to be recovered. Recovering
an error range is useful when the range is small, relative to the object that contains it;
otherwise, recovering the entire object is preferred. You cannot specify this option if you are
recovering from a concurrent copy.
In some situations, recovery using the ERROR RANGE option is not possible, such as when a sufficient quantity of alternate tracks cannot be obtained for all bad records within the error range. You can use the IBM Device Support Facility, ICKDSF service utility to determine whether this situation exists. In such a situation, redefine the error data set at a different location on the volume or on a different volume, and then run the RECOVER utility without the ERROR RANGE option.
You cannot specify ERROR RANGE with a LIST specification.
VERIFYSET
Specifies whether the RECOVER utility verifies that all related objects that are required for a
point-in-time recovery are included in the RECOVER control statement. This option applies to
point-in-time recoveries of base objects and the following related objects: - LOB objects
- XML objects
- History objects
The VERIFYSET option does not apply to point-in-time recoveries of catalog and
directory objects. VERIFYSET NO behavior is always in effect for point-in-time recoveries of catalog
and directory objects.
- VERIFYSET YES
- The RECOVER utility verifies that all related objects that are required to perform a point-in-time recovery are included in the RECOVER control statement. VERIFYSET YES is the default.
- VERIFYSET NO
- The RECOVER utility does not verify that all related objects that are required to perform a point-in-time recovery are included in the RECOVER control statement.
- By specifying VERIFYSET NO, you can break up a point-in-time recovery into multiple jobs or avoid recovering objects that have changed since the selected recovery point.

ENFORCE YES
Specifies that CHKP and ACHKP pending states are set for a point-in-time recovery when only a
subset of the related objects (BASE, LOB, XML, and RI) have been recovered to a point in time.
ENFORCE YES is the default for catalog and directory objects. There is no override for the ENFORCE
YES option for catalog and directory objects.
ENFORCE NO
Specifies that CHKP and ACHKP pending states are not set for a point-in-time recovery when only
a subset of the related objects (BASE, LOB, XML, and RI) have been recovered to a point in
time.
- CLONE
- Indicates that RECOVER is to recover only clone table data in the specified table spaces, index spaces or indexes that contain indexes on clone tables. This utility will only process clone data if the CLONE keyword is specified. The use of CLONED YES on the LISTDEF statement is not sufficient.
- LOCALSITE
- Specifies that RECOVER is to use image copies from the local site. If you specify neither LOCALSITE or RECOVERYSITE, RECOVER uses image copies from the current site of invocation. (The current site is identified on the installation panel DSNTIPO under SITE TYPE and in the macro DSN6SPRM under SITETYP.)
- RECOVERYSITE
- Specifies that RECOVER is to use image copies from the recovery site. If you specify neither LOCALSITE or RECOVERYSITE, RECOVER uses image copies from the current site of invocation. (The current site is identified on the installation panel DSNTIPO under SITE TYPE and in the macro DSN6SPRM under SITETYP.)
- LOGRANGES YES
- Specifies that RECOVER should use SYSLGRNX information for the LOGAPPLY phase. This option is the default.
- LOGRANGES NO
- Specifies that RECOVER should not use SYSLGRNX information for the LOGAPPLY phase. Use this
option only under the direction of IBM Software Support.
This option can cause RECOVER to run much longer. In a data sharing environment this option can result in the merging of all logs from all members that were created since the last image copy.
This option can also cause RECOVER to apply logs that should not be applied. For example, assume that you take an image copy of a table space and then run REORG LOG YES on the same table space. Assume also that the REORG utility abends and you then issue the TERM UTILITY command for the REORG job. The SYSLGRNX records that are associated with the REORG job are deleted, so a RECOVER job with the LOGRANGES YES option (the default) skips the log records from the REORG job. However, if you run RECOVER LOGRANGES NO, the utility applies these log records.
BACKOUT
Specifies whether a log-only backout is to be used to recover objects to a prior point in time.
A log-only backout might decrease the amount of time that an object is unavailable during a
point-in-time recovery if the specified recovery point is relatively recent.- NO
- Specifies that backout processing is not to be used.
BACKOUT NO is the default behavior.
- YES
- Specifies that RECOVER is to use the log to back out changes that were made since the recovery
point. (The recovery point is specified by the TOLOGPOINT or TORBA options.) The changes are backed
out from the current state of the object. No image copy is restored. Any uncommitted work at the
specified recovery point is backed out so that the objects are transactionally consistent.
If
you specify BACKOUT YES, the recovery point must be within the most recent DB2 system checkpoints that are recorded in the BSDS for each member.
Otherwise, the recovery cannot proceed and returns an error.
If you specify the BACKOUT keyword
without YES or NO, YES is the default. (If you do not specify the BACKOUT keyword, BACKOUT NO is the
default.)
Related information:
