COPY is not the only utility that writes recovery backups. MERGECOPY shortens incremental copy chains. LOAD and REORG write inline copies so you do not leave COPY-pending after LOG NO. COPYTOCOPY duplicates an existing copy for the local backup or recovery site without touching the table space. This page explains those DB2 for z/OS copy-family utilities and how they share SYSIBM.SYSCOPY.
Think of four jobs that all talk to SYSCOPY:
RECOVER, UNLOAD FROMCOPY, and DSN1COPY consume the data sets those jobs catalog. If you mix FlashCopy, concurrent copy, local COPYDDN, and recovery-site RECOVERYDDN, the rules below keep the chain legal.
Every incremental COPY adds another data set RECOVER must allocate when it restores to current or to a point after that incremental. Ten incrementals on tape can mean ten drives (or a painful wait). MERGECOPY collapses that chain without reading the table space, so applications keep running. The only notable lock is access to SYSIBM.SYSCOPY.
| Option | Output copy | SYSCOPY effect |
|---|---|---|
| NEWCOPY YES | New full image copy | Inserts a new full-copy row; incrementals remain until MODIFY RECOVERY |
| NEWCOPY NO | Single merged incremental | Replaces the SYSCOPY rows of the incrementals that were merged |
IBM recommends NEWCOPY YES in general: you get a new recovery point, tape count during RECOVER drops to one full copy, and the log range RECOVER applies is the same as if you had kept the incrementals. NEWCOPY NO is useful when you only want to stack incrementals into one smaller incremental without rereading the full copy.
You cannot run MERGECOPY on concurrent copies or FlashCopy image copies. If image copies were taken by data set (DSNUM) rather than by table space, MERGECOPY must merge by data set. Do not specify DSNUM and LIST on the same statement; use PARTLEVEL on LISTDEF instead.
WORKDDN (default SYSUT1) names a temporary data set for intermediate merged output when you cannot allocate every input copy at once. If you omit WORKDDN and run out of units, MERGECOPY may merge only some data sets and issue a message with the counts. Repeat MERGECOPY with a new output data set to continue. Keep tape mounts (RETPD, volume counts) in mind when inputs are on cartridge.
12345678910//STEP1 EXEC DSNUPROC,SYSTEM=DB2T,UID='HR.MRG.HRTS' //SYSCOPY DD DSN=HR.COPY.HRTS.MERGED(+1),DISP=(NEW,CATLG,DELETE), // UNIT=TAPE,LABEL=(1,SL) //SYSUT1 DD UNIT=SYSDA,SPACE=(CYL,(50,20),RLSE) //SYSIN DD * MERGECOPY TABLESPACE HRDB.HRTS NEWCOPY YES COPYDDN(SYSCOPY) WORKDDN(SYSUT1) /*
After NEWCOPY YES, run REPORT RECOVERY and confirm the new full DSNAME appears. Schedule MODIFY RECOVERY later to delete obsolete incremental rows and data sets according to your retention standard—MERGECOPY YES does not by itself delete the old incrementals.
Avoid MERGECOPY LOG RBA inconsistencies by not mixing copy methods that IBM documents as incompatible (for example following a CONCURRENT copy with incrementals, or expecting FlashCopy inputs). If local and recovery-site histories drifted apart, take a fresh full COPY for both sites before you merge.
Inline copy processing means: while LOAD, REORG, or REBUILD already scans or reloads pages, write those pages to COPYDDN (local) and optionally RECOVERYDDN (recovery site). You skip a separate COPY utility, avoid COPY-pending after LOG NO, and record a full SHRLEVEL REFERENCE copy in SYSCOPY.
| Utility | When the copy is written | Note |
|---|---|---|
| LOAD REPLACE COPYDDN | RELOAD phase | Avoids COPY-pending after LOG NO; STYPE R or S |
| REORG TABLESPACE COPYDDN | During REORG (required with SHRLEVEL REFERENCE/CHANGE or LOG NO recovery design) | Partition-range inline copies need DSNUM on later COPYTOCOPY |
| REORG INDEX / REBUILD INDEX COPYDDN | Index rebuild/reload | Full index copy; incrementals still not valid for indexes |
Specify COPYDDN and RECOVERYDDN on LOAD. Inline copies are produced in the RELOAD phase. You can specify up to two primary and two secondary copies. LOAD REPLACE is required for some inline-copy cases (IBM: to create an inline copy you must also specify REPLACE when replacing the table space contents). SYSCOPY ICTYPE=F, SHRLEVEL=R. STYPE is R for LOAD REPLACE LOG YES and S for LOAD REPLACE LOG NO.
The sequential file is logically a full REFERENCE copy, but pages may be out of physical order. RECOVER handles that. Do not assume a dump of the data set looks like a stand-alone COPY.
1234TEMPLATE LOC DSN HR.COPY.&DB..&TS..L.&DATE. LOAD DATA INDDN(SYSREC) REPLACE LOG NO COPYDDN(LOC) INTO TABLE HR.EMPLOYEE
REORG TABLESPACE with COPYDDN (or SHRLEVEL REFERENCE/CHANGE, which takes an image copy during execution) writes an inline copy of the reorganized data. That copy is the natural recovery base after a successful SWITCH. If you REORG a range of partitions into one inline data set, COPYTOCOPY does not support part-range: you must specify individual DSNUM values so COPYTOCOPY copies only that partition’s pages from the inline file.
An inline copy cannot be created for a LOB table space while running a REORG of that LOB space in the situations IBM documents as restricted—copy LOB spaces with COPY, or follow the Utility Guide for your release.
COPYTOCOPY can start from the local primary, recovery-site primary, or a FlashCopy and make up to three (or four, if the base is FlashCopy) additional sequential copies: local primary, local backup, recovery primary, recovery backup. MERGECOPY can then merge sequential incrementals that follow that full inline copy. CONCURRENT copies are not valid input to COPYTOCOPY.
1234COPYTOCOPY TABLESPACE HRDB.HRTS FROMLASTCOPY COPYDDN(LOCBKUP) RECOVERYDDN(REM)
Catalog and directory restrictions apply: COPYTOCOPY does not support certain objects (including DSNDB06.SYSTSCPY, DSNDB01.DBD01, SYSUTILX, SYSDBDXA and their indexes). Plan those copies with COPY itself under the documented catalog-copy procedures.
Use COPY when you need a new backup of the live pages. Use inline COPYDDN when LOAD or REORG is already running and you would otherwise be COPY-pending. Use COPYTOCOPY when the backup already exists and you need another sequential file (tape vault, DR site, UNLOAD input from a FlashCopy). Use MERGECOPY when the chain of incrementals is getting long and you want RECOVER to allocate fewer data sets.
COPY versus MERGECOPY for “I want a new full”: COPY rereads the table space (and may drain writers). MERGECOPY NEWCOPY YES rereads only the existing copy data sets. If the table is huge and incrementals are small, MERGECOPY is often cheaper. If incrementals were never taken, COPY FULL YES is the only option.
Imagine a photo album. COPY takes a new photo of the classroom. LOAD and REORG take a photo while they rearrange the desks (inline copy) so you do not forget to photograph afterwards. COPYTOCOPY is the photocopier: it copies a photo you already have so Grandma (the DR site) gets a copy without making the kids sit still again. MERGECOPY is gluing many “only the desks that changed” snapshots onto one page so the substitute teacher (RECOVER) does not have to carry ten envelopes of photos.
1. What does MERGECOPY NEWCOPY YES do?
2. MERGECOPY NEWCOPY NO:
3. Which copies can MERGECOPY not merge?
4. An inline copy from LOAD REPLACE LOG NO is recorded in SYSCOPY as:
5. Why run COPYTOCOPY after a FlashCopy or inline copy?