Restoring data in a data sharing environment
If you are in a data sharing environment, you might need to recover from a disaster by restoring data from image copies and logs. The procedure that you follow assumes that all logs, image copies, and reports are available at the recovery site.
About this task
Additional recovery procedures for data sharing environments are also available.
Procedure
To recover from a disaster by using image copies and archive logs:
- If you have information in your coupling facility from
practice startups, remove old information from the coupling facility.
If you do not have old information in your coupling facility, continue with the step 2.
- Enter the following z/OS® command
to display the structures for this data sharing group:
D XCF,STRUCTURE,STRNAME=grpname* -
For group buffer pools, enter the following command to force
off the connection of those structures:
SETXCF FORCE,CONNECTION,STRNAME=strname,CONNAME=ALLConnections for the SCA are not held at termination; therefore you do not need to force off any SCA connections. -
Delete all the Db2 coupling
facility structures that have a STATUS of ALLOCATED by using the following
command for each structure:
SETXCF FORCE,STRUCTURE,STRNAME=strnameThis step is necessary to remove old information that exists in the coupling facility from your practice startup when you installed the group.
- Enter the following z/OS® command
to display the structures for this data sharing group:
- If an integrated catalog facility catalog does not already exist, run job DSNTIJCA to create a user catalog.
- Use the access method services IMPORT command to import the integrated catalog facility catalog.
- Restore Db2 libraries.
Some examples of libraries that you might need to restore include:
- Db2 SMP/E libraries
- User program libraries
- User DBRM libraries
- Db2 CLIST libraries
- Db2 libraries that contain customized installation jobs
- JCL for creating user-defined table spaces
- Use IDCAMS DELETE NOSCRATCH to delete
all catalog and user objects. (Because step 3 imports a user ICF catalog, the catalog reflects data sets that do not exist on disk.)
- Obtain a copy of the installation job
DSNTIJIN, which creates Db2 VSAM
and non-VSAM data sets, for the first data sharing member. Change
the volume serial numbers in the job to volume serial numbers that
exist at the recovery site. Comment out the steps that create Db2 non-VSAM
data sets, if these data sets already exist. Run DSNTIJIN on the first
data sharing member. However, do not run DSNTIJID.
For subsequent members of the data sharing group, run the DSNTIJIN that defines the BSDS and logs.
- Recover the BSDS by following these steps for each member
in the data sharing group:
- Use the access method services REPRO command to restore the contents of one BSDS data set (allocated in step 6) on each member. You can find the most recent BSDS image in the last file (archive log with the highest number) on the latest archive log tape.
If the BSDS that you restored in step 7.a is in 6-byte format, and the system to which you are restoring is in 10-byte format, run utility DSNJCNVT to convert the restored BSDS to 10-byte format. See DSNJCNVT for information on how to do that. 
- Determine the RBA and LRSN ranges for this archive log by using the print log map utility (DSNJU004) to list the current BSDS contents. Find the most recent archive log in the BSDS listing, and add 1 to its ENDRBA value. Use this as the STARTRBA. Find the active log in the BSDS listing that starts with this RBA, and use its ENDRBA as the ENDRBA. Use the STARTLRSN and ENDLRSN of this active log data set as the LRSN range (STARTLRSN and ENDLRSN) for this archive log.
- Delete the oldest archive log from the BSDS.
- Register this latest archive log
tape data set in the archive log inventory of the BSDS that you just
restored by using the change log inventory utility (DSNJU003).
This step is necessary because the BSDS image on an archive log tape does not reflect the archive log data set that resides on that tape.
Running DSNJU003 is critical for data sharing groups. Include the group buffer pool checkpoint information that is stored in the BSDS from the most recent archive log.
After these archive logs are registered, use the print log map utility (DSNJU004) with the GROUP option to list the contents of all BSDSs. You receive output that includes the start and end LRSN and RBA values for the latest active log data sets (shown as NOTREUSABLE). If you did not save the values from the DSNJ003I message, you can get those values by running DSNJU004, which creates output as shown below
The following sample DSNJU004 output shows the (partial) information for the archive log member DB1G.

ACTIVE LOG COPY 1 DATA SETS START RBA/LRSN/TIME END RBA/LRSN/TIME DATE/LTIME DATA SET INFORMATION ---------------------- ---------------------- ---------- -------------------- 0000000007A5C5360000 0000000007A5DB31FFFF 2005.034 DSN=DSNT3LOG.DT31.LOGCOPY1.DS01 00CAC6509C994A000000 00CAC650C5EDD8000000 20:22 PASSWORD=(NULL) STATUS=REUSABLE 2013.015 14:41:16.4 2013.015 14:41:59.7 0000000007A5DB320000 0000000007A5F12DFFFF 2007.051 DSN=DSNT3LOG.DT31.LOGCOPY1.DS04 00CAC650C5EDD8000000 00CAC650EA3857000000 13:27 PASSWORD=(NULL) STATUS=REUSABLE 2013.015 14:41:59.7 2013.015 14:42:37.7
The following sample DSNJU004 output shows the (partial) information for the archive log member DB2G.
ACTIVE LOG COPY 1 DATA SETS START RBA/LRSN/TIME END RBA/LRSN/TIME DATE LTIME DATA SET INFORMATION -------------------- -------------------- -------- ----- -------------------- EMPTY DATA SET 1996.361 14:14 DSN=DSNDB0G.DB2G.LOGCOPY1.DS03 000000000000 000000000000 STATUS=NEW, REUSABLE 0000.000 00:00:00.0 0000.000 00:00:00.0 000000000000 0000000D6FFF 1996.361 14:14 DSN=DSNDB0G.DB2G.LOGCOPY1.DS01 ADFA00BB70FB AE3C45276DD7 STATUS=TRUNCATED, NOTREUSABLE 1996.361 22:30:51.4 1997.048 15:28:23.7 0000000D7000 00000045AFFF 1996.361 14:14 DSN=DSNDB0G.DB2G.LOGCOPY1.DS02 AE3C45276DD8 ............ STATUS=NOTREUSABLE 1997.048 15:28:23.7 ........ .......... - Adjust the active logs in the BSDS by using the change
log inventory utility (DSNJU003), as necessary:
- To delete all active logs in the BSDS, use the DELETE option of DSNJU003. Use the BSDS listing that is produced in step 7.e to determine the active log data set names.
- To add the active log data sets to the BSDS, use the NEWLOG statement of DSNJU003. Do not specify a STARTRBA or ENDRBA in the NEWLOG statement. This specification indicates to Db2 that the new active logs are empty.
- If you are using the Db2 distributed data facility, update the LOCATION and the LUNAME values in the BSDS by running the change log inventory utility with the DDF statement.
- List the new BSDS contents by using the print log map
utility (DSNJU004). Ensure that the BSDS correctly reflects the active
and archive log data set inventories. In particular, ensure that:
- All active logs show a status of NEW and REUSABLE.
- The archive log inventory is complete and correct (for example, the start and end RBAs are correct).
- If you are using dual BSDSs, make a copy of the newly restored BSDS data set to the second BSDS data set.
- Use the access method services REPRO command to restore the contents of one BSDS data set (allocated in step 6) on each member.
- Optional: Restore archive logs to disk for
each member. Archive logs are typically stored on tape, but restoring them to disk might speed later steps. If you elect this option, and the archive log data sets are not cataloged in the primary integrated catalog facility catalog, use the change log inventory utility to update the BSDS. If the archive logs are listed as cataloged in the BSDS, Db2 allocates them by using the integrated catalog and not the unit or VOLSER that is specified in the BSDS. If you are using dual BSDSs, remember to update both copies.
- Use the DSN1LOGP utility to determine, for each member
of the data sharing group, which transactions were in process at the
end of the last archive log. Use the following job control language
where yyyyyyyyyyyy is the STARTRBA of the last
complete checkpoint within the RBA range on the last archive log from
the previous print log map:
//SAMP EXEC PGM=DSN1LOGP //SYSPRINT DD SYSOUT=* //SYSSUMRY DD SYSOUT=* //ARCHIVE DD DSN=last-archive, DISP=(OLD,KEEP),UNIT=TAPE, LABEL=(2,SL),VOL=SER=volser1 (NOTE FILE 1 is BSDS COPY //SYSIN DD * STARTRBA(yyyyyyyyyyyy) SUMMARY(ONLY) /*DSN1LOGP generates a report. - Examine the DSN1LOGP output for each data sharing member,
and identify any utilities that were executing at the end of the last
archive log. Determine the appropriate recovery action to take on
each table space that is involved in a utility job. If DSN1LOGP output showed that utilities are inflight (PLAN=DSNUTIL), examine SYSUTILX to identify the utility status and determine the appropriate recovery approach.
- Modify DSNZPxxx parameters for each
member of the data sharing group:
- Run the DSNTINST CLIST in UPDATE mode.
- To defer processing of all databases, select DATABASES
TO START AUTOMATICALLY from panel DSNTIPB. Panel DSNTIPS opens. On panel DSNTIPS, type DEFER in the first field and ALL in the second field; then press Enter.You are returned to panel DSNTIPB.
- To specify where you are recovering, select OPERATOR
FUNCTIONS from panel DSNTIPB. Panel DSNTIPO opens. From panel DSNTIPO, type RECOVERYSITE in the SITE TYPE field. Press Enter to continue.
- Optional: Specify which archive log to use
by selecting OPERATOR FUNCTIONS from panel DSNTIPB. Panel DSNTIPO opens. From panel DSNTIPO, type YES in the READ ARCHIVE COPY2 field if you are using dual archive logging and want to use the second copy of the archive logs. Press Enter to continue.
- Reassemble DSNZPxxx by using job
DSNTIJUZ (produced by the CLIST started in the first step of this
procedure).
At this point, you have the log, but the table spaces have not been recovered. With DEFER ALL, Db2 assumes that the table spaces are unavailable but does the necessary processing to the log. This step also handles the units of recovery that are in process.
- Create a conditional restart control record
for each data sharing member by using the change log inventory utility
with one of the following forms of the CRESTART statement:
CRESTART CREATE,ENDLRSN=nnnnnnnnnnnnThe nnnnnnnnnnnn is the LRSN of the last log record that is to be used during restart.
CRESTART CREATE,ENDTIME=nnnnnnnnnnnnThe nnnnnnnnnnnn is the end time of the log record. Log records with a timestamp later than nnnnnnnnnnnn are truncated.
Use the same LRSN or system time-of-day clock timestamp value for all members in a data sharing group. Determine the ENDLRSN value by using one of the following methods:- Use the DSN1LOGP summary utility. In the
Summary of Completed Events
section, find the lowest LRSN value that is listed in the DSN1213I message for the data sharing group. Use this value for the ENDLRSN in the CRESTART statement. - Use the print log map utility (DSNJU004) to list the BSDS contents. Find the ENDLRSN of the last log record that is available for each active member of the data sharing group. Subtract 1 from the lowest ENDLRSN in the data sharing group. Use this value for the ENDLRSN in the CRESTART statement. (In the sample output that is shown in step 7.e, the value is AE3C45273A77 - 1, which is AE3C45273A76.)
- If only the console logs are available, use the archive offload message (DSNJ003I) to obtain the ENDLRSN. Compare the ending LRSN values for the archive logs of all members. Subtract 1 from the lowest LRSN in the data sharing group. Use this value for the ENDLRSN in the CRESTART statement. (In the sample output that is shown in step 7.e, the value is AE3C45273A77 - 1, which is AE3C45273A76.)
Use the print log map utility to verify that the conditional restart control record that you created in the previous step is active.
- Enter the command START DB2 ACCESS(MAINT).
You must enter this command, because real-time statistics are active and enabled; otherwise, errors or abends could occur during Db2 restart processing and recovery processing (for example, GRECP recovery, LPL recovery, or the RECOVER utility).
If a discrepancy exists among the print log map reports as to the number of members in the group, which would be an unlikely occurrence, record the one that shows the highest number of members. Start this Db2 subsystem first using ACCESS(MAINT). Db2 prompts you to start each additional Db2 subsystem in the group.
After all additional members are successfully restarted, and if you are going to run single-system data sharing at the recovery site, stop all except one of the Db2 subsystems by using the STOP DB2 command with MODE(QUIESCE).
If you planned to use the light mode when starting the Db2 group, add the LIGHT parameter to the START command. Start the members that run in LIGHT(NO) mode first, followed by the light mode members.
Even though Db2 marks all table spaces for deferred restart, log records are written so that in-abort and inflight units of recovery are backed out. In-commit units of recovery are completed, but no additional log records are written at restart to cause this. This happens when the original redo log records are applied by the RECOVER utility.
At the primary site, Db2 probably committed or canceled the inflight units of recovery, but you have no way of knowing.
During restart, Db2 accesses two table spaces that result in DSNT501I, DSNT500I, and DSNL700I resource unavailable messages, regardless of DEFER status. The messages are normal and expected, and you can ignore them.
The following return codes can accompany the message. Other codes are also possible.- 00C90081
- This return code is issued for activity against the object that occurs during restart as a result of a unit of recovery or pending writes. In this case, the status that is shown as a result of DISPLAY is STOP,DEFER.
- 00C90094
- Because the table space is currently only a defined VSAM data set, it is in a state that Db2 does not expect.
- 00C900A9
- An attempt was made to allocate a deferred resource.
-
Resolve the indoubt units of recovery.
The RECOVER utility, which you run in a subsequent step, fails on any table space that has indoubt units of recovery. Because of this, you must resolve them first. Determine the proper action to take (commit or abort) for each unit of recovery. To resolve indoubt units of recovery, see Resolving indoubt units of recovery. From an installation SYSADM authorization ID, enter the RECOVER INDOUBT command for all affected transactions.
- Recover the catalog and directory. The RECOVER function includes: RECOVER TABLESPACE, RECOVER INDEX, or REBUILD INDEX. If you have an image copy of an index, use RECOVER INDEX. If you do not have an image copy of an index, use REBUILD INDEX to reconstruct the index from the recovered table space.
- Recover DSNDB01.SYSUTILX. This must be a separate job step.
- Recover all indexes on SYSUTILX. This must be a separate job step.
- Determine whether a utility was running at the time
the latest archive log was created by entering the DISPLAY
UTILITY(*) command, and record the name and current phase
of any utility that is running. (You cannot restart a utility at the recovery site that was interrupted at the disaster site. To terminate a utility at the recovery site that was interrupted at the disaster site, you must use the TERM UTILITY command.)
- Run
the DIAGNOSE utility with the DISPLAY SYSUTIL option. The output consists of information about each active utility, including the table space name (in most cases). This is the only way to correlate the object name with the utility. Message DSNU866I gives information about the utility, and DSNU867I gives the database and table space name in USUDBNAM and USUSPNAM, respectively.
- Use the TERM UTILITY command to terminate any utilities that are in progress on catalog or directory table spaces.
- Recover the rest of the catalog and directory objects, starting with DBD01, in the order shown in the description of the RECOVER utility.
- Recover DSNDB01.SYSUTILX.
- Define and initialize the work file database
- Define temporary work files. Use installation job DSNTIJTM as a model.
- Issue the command START DATABASE(work-file-database) to start the work file database.
- Use any method that you want to verify the integrity of
the Db2 catalog
and directory. Use the catalog queries in member DSNTESQ of data set DSN1110.SDSNSAMP after the work file database is defined and initialized.
- If you use data definition control support, recover the objects in the data definition control support database.
- If you use the resource limit facility, recover the objects in the resource limit control facility database.
- Modify DSNZPxxx to restart all databases
on each member of the data sharing group:
-
Run the DSNTINST CLIST in UPDATE mode.
For more information, see Tailoring Db2 11 installation and migration jobs with the CLIST.
- From panel DSNTIPB, select DATABASES TO START AUTOMATICALLY.
Panel DSNTIPS opens. Type RESTART in the first field and ALL in the second field, and press Enter.You are returned to DSNTIPB.
- Reassemble DSNZPxxx by using job DSNTIJUZ (produced by the CLIST started in step 4).
-
Run the DSNTINST CLIST in UPDATE mode.
- Stop Db2.
- Start Db2.
- Make a full image copy of the catalog and directory.
- Recover user table spaces and index spaces. If utilities were running on any table spaces or index spaces, see What to do about utilities that were in progress at time of failure. You cannot restart a utility at the recovery site that was interrupted at the disaster site. Use the TERM UTILITY command to terminate any utilities that are running against user table spaces or index spaces.
- To determine which, if any, of your table spaces or
index spaces are user-managed, perform the following queries for table
spaces and index spaces.
- Table spaces:
SELECT * FROM SYSIBM.SYSTABLEPART WHERE STORTYPE='E'; - Index spaces:
SELECT * FROM SYSIBM.SYSINDEXPART WHERE STORTYPE='E';
To allocate user-managed table spaces or index spaces, use the access method services DEFINE CLUSTER command. To find the correct IPREFIX for the DEFINE CLUSTER command, perform the following queries for table spaces and index spaces.- Table spaces:
SELECT DBNAME, TSNAME, PARTITION, IPREFIX FROM SYSIBM.SYSTABLEPART WHERE DBNAME=dbname AND TSNAME=tsname ORDER BY PARTITION; - Index spaces:
SELECT IXNAME, PARTITION, IPREFIX FROM SYSIBM.SYSINDEXPART WHERE IXCREATOR=ixcreator AND IXNAME=ixname ORDER BY PARTITION;
Now you can perform the DEFINE CLUSTER command with the correct IPREFIX (I or J) in the data set name:
catname.DSNDBx.dbname.psname.y0001.znnnThe y can be either I or J, x is C (for VSAM clusters) or D (for VSAM data components), and spname is either the table space or index space name.
- Table spaces:
- If your user table spaces or index spaces are STOGROUP-defined, and if the volume serial numbers at the recovery site are different from those at the local site, use the SQL statement ALTER STOGROUP to change them in the Db2 catalog.
- Recover all user table spaces and index spaces from
the appropriate image copies. If you do not copy your indexes, use the REBUILD INDEX utility to reconstruct the indexes.
- Start all user table spaces and index spaces for read-write processing by issuing the command START DATABASE with the ACCESS(RW) option.
- Resolve any remaining CHECK-pending states that would prevent COPY execution.
- Run queries for which the results are known.
- To determine which, if any, of your table spaces or
index spaces are user-managed, perform the following queries for table
spaces and index spaces.
- Make full image copies of all table spaces and indexes with the COPY YES attribute.
- Finally, compensate for work that was lost since the last archive was created by rerunning online transactions and batch jobs.