Let's understand Mainframe
Home Tutorials Interview Q&A Quiz Mainframe Memes Contact us About us

Module 13: DB2 Utilities and Production Support


COPY

The COPY utility takes image copies - backups - of DB2 table spaces. These copies are what the RECOVER utility restores when data is lost or corrupted. Without regular COPY jobs, you have nothing to recover from.

What is COPY

  • COPY writes the pages of a table space to sequential data sets called image copies.
  • Each copy is registered in the SYSIBM.SYSCOPY catalog table with its timestamp and type.
  • You can copy a full table space, a single partition, or a list of table spaces.
  • COPYDDN names the DD statements in the JCL that receive the copy data sets.
  • Always make two copies on different volumes when the data is critical.

Full vs incremental COPY

  • FULL YES copies every page of the table space - a complete backup.
  • FULL NO (incremental) copies only the pages changed since the last full or incremental copy.
  • Incremental copies are faster and smaller, but RECOVER must apply the full copy plus all incrementals.
  • Take a full copy regularly (for example weekly) and incrementals in between (for example daily).
  • CHANGELIMIT can trigger a full copy automatically when enough pages have changed.

SHRLEVEL options

  • SHRLEVEL REFERENCE is the default - applications can read but not update during the copy.
  • SHRLEVEL CHANGE allows updates during the copy; DB2 logs the changes so the copy stays consistent.
  • After a LOAD with LOG NO, the table space is in COPY pending status until you take a full COPY.
  • COPYTOCOPY makes a backup copy of an existing image copy, for example to send one offsite.

Example of a COPY control statement:-

//COPY01 EXEC PGM=DSNUTILB,PARM='DB2S,COPY01' //STEPLIB DD DSN=DB2.V12.SDSNLOAD,DISP=SHR //SYSTSIN DD * COPY TABLESPACE HRDB.HRTSEMP FULL YES SHRLEVEL REFERENCE COPYDDN(SYSCOPY1,SYSCOPY2) /* //SYSCOPY1 DD DSN=HRDB.BACKUP.HRTSEMP.FULL1, // DISP=(NEW,CATLG,DELETE), // SPACE=(CYL,(50,10)) //SYSCOPY2 DD DSN=HRDB.BACKUP.HRTSEMP.FULL2, // DISP=(NEW,CATLG,DELETE), // SPACE=(CYL,(50,10)) //SYSPRINT DD SYSOUT=*






© copyright mainframebug.com
Privacy Policy
MainframeBug Assistant