When a LOAD utility is terminated while the LOAD job is in progress, DB2 puts table in recovery pending (RECP) status. There are several ways to solve this recovery pending status issue.
Solution 1
Run the below query for the table space is in question and it will give the QUIESCE points. Note down the last QUIESCE points (i.e, START_RBA column)
SELECT
DBNAME
,TSNAME
,HEX(START_RBA) AS START_RBA
,TIMESTAMP
FROM SYSIBM.SYSCOPY
WHERE DBNAME = 'MYDB' AND
TSNAME = ' TBLSPACE ' AND
ICTYPE = 'Q';
In the below job, put the latest QUIESCE point (START_RBA) after the TOLOGPOINT parameter. This job will recover table space to the latest full image copy and then it applies all the DB2 log records to the table space starting from the QUIESCE point X'C8E090980F3F'. The RECOVER puts the associated index spaces in REBUILD pending status. So, we should build the all indexes as part of recover job.
//RECOVR EXEC PGM=DSNUTILB,PARM='DB0T,RECOVR'
//SYSPRINT DD SYSOUT=*
//UTPRINT DD SYSOUT=*
//SYSIN DD *
LISTDEF COPONE INCLUDE TABLESPACE MYDB.TBLSPACE PARTLEVEL
RECOVER LIST COPONE
TOLOGPOINT X'C8E090980F3F'
PARALLEL 6
TAPEUNITS 6
REBUILD INDEX (ALL) TABLESPACE MYDB.TBLSPACE
SORTKEYS
SORTDEVT SYSDA
SORTNUM 12
//*
Solution 2
We can use the latest full/partial image copy datasets to recover the table space. 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.
//RECOVR EXEC PGM=DSNUTILB,PARM='DB0T,RECOVR'
//SYSPRINT DD SYSOUT=*
//UTPRINT DD SYSOUT=*
//SYSIN DD *
//SYSIN DD *
RECOVER TABLESPACE MYDB.TBLSPACE DSNUM 1
TOCOPY MYDB.TBLSPACE.FC00001.D3362331
RECOVER TABLESPACE MYDB.TBLSPACE DSNUM 2
TOCOPY MYDB.TBLSPACE.FC00002.D3362331
RECOVER TABLESPACE MYDB.TBLSPACE DSNUM 3
TOCOPY MYDB.TBLSPACE.FC00003.D3362331
RECOVER TABLESPACE MYDB.TBLSPACE DSNUM 4
TOCOPY MYDB.TBLSPACE.FC00004.D3362331
REBUILD INDEX (ALL) TABLESPACE MYDB.TBLSPACE
SORTKEYS
SORTDEVT SYSDA
SORTNUM 12
//*
Solution 3
The below job 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.
//RECOVR EXEC PGM=DSNUTILB,PARM='DB0T,RECOVR'
//SYSPRINT DD SYSOUT=*
//UTPRINT DD SYSOUT=*
//SYSIN DD *
//SYSIN DD *
RECOVER TABLESPACE MYDB.TBLSPACE DSNUM 1
TOLASTCOPY
RECOVER TABLESPACE MYDB.TBLSPACE DSNUM 2
TOLASTCOPY
RECOVER TABLESPACE MYDB.TBLSPACE DSNUM 3
TOLASTCOPY
RECOVER TABLESPACE MYDB.TBLSPACE DSNUM 4
TOLASTCOPY
REBUILD INDEX (ALL) TABLESPACE MYDB.TBLSPACE
SORTKEYS
SORTDEVT SYSDA
SORTNUM 12
//*
Solution 4
The below job 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.
//RECOVR EXEC PGM=DSNUTILB,PARM='DB0T,RECOVR'
//SYSPRINT DD SYSOUT=*
//UTPRINT DD SYSOUT=*
//SYSIN DD *
//SYSIN DD *
RECOVER TABLESPACE MYDB.TBLSPACE DSNUM 1
TOLASTFULLCOPY
RECOVER TABLESPACE MYDB.TBLSPACE DSNUM 2
TOLASTFULLCOPY
RECOVER TABLESPACE MYDB.TBLSPACE DSNUM 3
TOLASTFULLCOPY
RECOVER TABLESPACE MYDB.TBLSPACE DSNUM 4
TOLASTFULLCOPY
REBUILD INDEX (ALL) TABLESPACE MYDB.TBLSPACE
SORTKEYS
SORTDEVT SYSDA
SORTNUM 12
//*