The COPYTOCOPY Utility

 <  Day Day Up  >  

The COPYTOCOPY Utility

graphics/v7_icon.gif

The purpose of the COPYTOCOPY utility, introduced as of DB2 V7, is to permit image copies to be made from existing image copies. The primary benefit is to reduce the amount of time required to run the COPY utility. COPY can be used to take up to four image copies with a single execution of the utility. But with COPYTOCOPY available, instead of using COPY to make four image copy backups , the DBA can use COPY to make a single image copy, and then run COPYTOCOPY to make additional image copies.


COPYTOCOPY can be run against any DB2 image copy data set including inline copies made during the execution of REORG or LOAD . Starting with either the local primary or recovery site primary copy, COPYTOCOPY can make up to three copies of one or more of the following types of copies:

  • Local primary

  • Local backup

  • Recovery site primary

  • Recovery site backup

Copies created by COPYTOCOPY can be used by the RECOVER utility just like image copies created using the COPY utility. Both table space and index space copies can be made using the COPYTOCOPY utility. Any DB2 utility process that uses image copy data sets can use the image copies created by COPYTOCOPY . This includes MERGECOPY , UNLOAD , and subsequent runs of COPYTOCOPY . However, keep in mind that image copies created with the CONCURRENT option of the COPY utility are not supported by the COPYTOCOPY utility.

Just like the COPY utility, the COPYTOCOPY utility records information about the image copies that it creates in the SYSIBM.SYSCOPY system catalog table. The COPYTOCOPY utility will insert the values in the DSNAME , GROUP_MEMBER , JOBNAME , AUTHID , DSVOLSER , and DEVTYPE columns as appropriate depending on the copies that are being created.

You cannot run COPYTOCOPY to create additional image copies for certain DB2 Catalog ( SYSCOPY in DSNDB06 ) and DB2 Directory ( DSNDB01 and SYSUTILX both in DSNDB01 ) objects.

To execute COPYTOCOPY , the process or user running the utility must have been granted one of the following privileges:

  • SYSADM or SYSCTRL

  • IMAGCOPY , DBADM , DBCTRL , or DBMAINT for the database in which the index or table space resides

Processes or users having INSTALL SYSOPR authority can run COPYTOCOPY for table spaces in the DB2 Directory ( DSNDB01 ) and DB2 Catalog ( DSNDB06 ).

COPYTOCOPY Phases

COPYTOCOPY creates a new image copy of a table space or an index from an existing image copy. The COPYTOCOPY utility operates in these distinct phases:

UTILINIT

Initialization and setup

CPY2CPY

Copying the image copy

UTILTERM

Cleanup


COPYTOCOPY Locking and Concurrency

When COPYTOCOPY is running, the object for which the copy applies is placed in utility restricted read/write state ( UTRW ). Basically, this will prevent anyone from dropping the object while the COPYTOCOPY utility executes.

Individual data and index partitions are treated as distinct target objects by the COPYTOCOPY utility. Any other utilities operating on different partitions of the same table space or index space can be run concurrently with COPYTOCOPY .

The following utilities cannot be run concurrently on the same object as the COPYTOCOPY utility:

COPY

LOAD

MERGECOPY

MODIFY

RECOVER

REORG INDEX

REORG TABLESPACE

 

COPYTOCOPY Execution

To run the COPYTOCOPY utility, it is not necessary to provide the explicit data set name of the image copy being copied . Instead, the input to the COPYTOCOPY utility is the name of the table space, index space, or index for which the original copy was made, and an indication of which image copy in the catalog is to be copied. There are three options:

  • FROMLASTCOPY ” Indicates that the most recent image copy taken for the table space or index space is to be used as input to the COPYTOCOPY utility. The input could be either a full image copy or incremental copy. The utility will retrieve the information from the SYSIBM.SYSCOPY system catalog table.

  • FROMLASTFULLCOPY ” Indicates that the most recent full image copy taken for the object is to be used as the input to COPYTOCOPY job. Once again, this information is obtained by querying the DB2 Catalog.

  • FROMLASTINCRCOPY ” Indicates that the most recent incremental image copy taken for the object is to be used as the input to COPYTOCOPY job. FROMLASTINCRCOPY is not valid for index spaces or indexes. If FROMLASTINCRCOPY is specified for an index space or index, COPYTOCOPY will use the last full image copy that was taken for the index, if one is available. Once again, this information is obtained by querying the DB2 Catalog.

Of course, you may choose to specify the data set name for the image copy that is to be copied by the COPYTOCOPY utility. This can be accomplished by using the FROMCOPY clause. When COPYTOCOPY is used in conjunction with a list of objects defined using the LISTDEF statement, the FROMCOPY clause is not valid.

If the FROMCOPY keyword is not used, the COPYTOCOPY utility must determine which specific image copy is to be copied. Before COPYTOCOPY can execute it may have to choose between the local site primary copy, local site backup copy, recovery site primary copy, and recovery site backup copy data sets.

COPYTOCOPY will search image copies in the following order to determine the input data set to be used:

  • If you are running COPYTOCOPY at your local site, the search order will be (1) local site primary copy, (2) local site backup copy, (3) recovery site primary copy, (4) recovery site backup copy.

  • If you are running the utility at your recovery site, the search order will be (1) recovery site primary copy, (2) recovery site backup copy, (3) local site primary copy, and finally (4) local site backup copy.

If the input data set cannot be allocated or opened, the COPYTOCOPY utility will try to use the next image copy data with the same START_RBA value in SYSIBM.SYSCOPY column, in the search order as indicated previously. When the FROMCOPY keyword is used though, only the explicitly specified data set can be used as the input to COPYTOCOPY .

An example of JCL used to run the COPYTOCOPY utility is depicted in Listing 32.4. This job is used to make a backup local image copy of table space DSN8S71E in database DSN8D71A . This will be either a full or incremental image copy, whichever was last run for this table space.

Listing 32.4. COPYTOCOPY JCL
 //DB2JOBU JOB (UTILITY),INDEX COPY',CLASS=X,MSGCLASS=X, //         NOTIFY=USER //* //**************************************************************** //* //*        DB2 COPYTOCOPY UTILITY //* //**************************************************************** //* //COPY EXEC DSNUPROC,SYSTEM=DSN,UID='C2CTS',UTPROC=" //* //DSNUPROC.COPY2   DD DSN=COPY002F.IFDY01,UNIT=SYSDA,VOL=SER=CPY02I, //         SPACE=(CYL,(15,1)),DISP=(NEW,CATLG,CATLG) //DSNUPROC.SYSIN    DD  *    COPYTOCOPY TABLESPACE DSN8D71A.DSN8S71E COPYDDN(,COPY2) /* // 

COPYTOCOPY Guidelines

Deploy the following tips and guidelines as you utilize the COPYTOCOPY utility on your DB2 data.

Avoid Terminating COPYTOCOPY

It is not recommended to use the TERM command to terminate a COPYTOCOPY step. A current restart should be done instead.

If a job step containing more than one COPYTOCOPY statement abends, do not use TERM UTILITY . Instead, you should restart the job from the last commit point using RESTART . If you terminate COPYTOCOPY in this situation you might cause inconsistencies between the ICF catalog and DB2 catalogs when generation data sets (GDGs) are used.

You cannot use RESTART(PHASE) for a COPYTOCOPY job. It is fine to use RESTART(CURRENT) if you do not use the -TERM UTILITY command to terminate a COPYTOCOPY execution. When you use RESTART(CURRENT) , COPYTOCOPY will restart from the last commit point with the same image copy data set, so be sure to specify the data set disposition to DISP=(MOD,CATLG,CATLG) on the JCL DD statements.

Inline Copy Exception

When using COPYTOCOPY to copy an inline image copy that was made by the REORG utility with the part range option, you will need to specify individual DSNUM for the partitions to be copied. The COPYTOCOPY utility does not support part range. COPYTOCOPY will copy only the specified partition data from the input inline image copy data set into the output image copy data set.

 <  Day Day Up  >  


DB2 Developers Guide
DB2 Developers Guide (5th Edition)
ISBN: 0672326132
EAN: 2147483647
Year: 2004
Pages: 388

flylib.com © 2008-2017.
If you may any questions please contact us: flylib@qtcs.net