Creating a migration file for the Copy Migration feature


The EXPORT, MIGRATE, and IMPORT commands make the task of moving the data between Db2 subsystems simpler and more accurate and support all BMC AMI Copy formats (including cabinet copies).

The tables on the source and target systems do not need to have the same number of columns and column types, but their columns must be compatible. The target table can have more columns and can assign default values if the table was created accordingly. 

For more information about which data types are compatible, see the "IBM SQL Reference" for ALTER TABLE, SET DATA TYPE, and Data Type Compatibility for Assignments and Comparisons table.

The Copy Migration feature requires one of the following valid passwords:

  • A Recovery Management for Db2 solution password
  • A BMC Database Administration for DB2 solution password

Important

For more information about the BMC AMI Recover MIGRATE and IMPORT commands, see the BMC AMI Recover for Db2 documentation.

The BMC AMI Change Manager for Db2 product also has a data migration function that handles DDL definition and OBID resolution. Change Manager also uses the Copy Migration feature (EXPORT and IMPORT only, not MIGRATE) of BMC AMI Copy and BMC AMI Recover. For more information, see the ALTER and BMC AMI Change Manager for Db2 documentation.

The benefits of the Copy Migration feature with the BMC AMI Copy EXPORT commands and BMC AMI Recover MIGRATE and IMPORT commands include:

  • Supports importing copies that use BMC proprietary formats
  • Does not require that you manage data sets to keep up with current copies
  • Does not require that you know the OBIDs from the source system
  • Imports applications and object sets as a single unit
  • Does not require the import of unchanged objects (to save time)
  • Supports the use of older migration files to back-date imports
  • Provides a less error-prone, and therefore, more accurate data migration (for example, less likely to use the wrong data set name or OBIDs).

If you use Change Manager for data migration (EXPORT and IMPORT only), you achieve the following benefits from the Copy Migration feature:

  • Simplifies the data movement process
  • Requires less JCL, and therefore, less JCL management
  • Supports DSNUM values other than 0
  • Supports multiple imports and multitasking

Important

It is prudent for migration that all table spaces are consistent. If a copy is included in an exported set and it appears to not be consistent, EXPORT issues message BMC180202.

Migration file

The migration file provides a method for transferring all types of BMC AMI Copy and IBM copies between Db2 subsystems.

The migration file contains information to streamline the import recovery process with a minimum of user-supplied knowledge and intervention. The MIGRATE and IMPORT commands of BMC AMI Recover are used to complete the transfer and integration of data using the copies.

The SYSCOPY and BMCXCOPY rows and metadata for the selected spaces are written to the designated sequential file. The metadata describes each table space with the information needed to translate OBIDs on the target system and to do checks during importing.

Each exported table space is registered in BMCXCOPY with COPY_TYPE = X. (You can use SPUFI to find data set names of the appropriate migration files.)

For XML spaces, strings are encoded, and the encoding is saved in SYSIBM.SYSSTRINGS. The encoding might be different on different Db2 subsystems. BMC AMI Copy EXPORT saves the information necessary to translate the strings in the migration file.

Example

The following example shows how you can determine the data set names of the migration files for a specific table space:

  SELECT DBNAME, IXNAME,ICDATE, ICTIME, DSNAME                   
    FROM BMCUTIL.CMN_BMCXCOPY                                    
    WHERE IXNAME = 'TS01N1'                                      
    AND   COPY_TYPE = 'X'                                        
;                                                                
---------+---------+---------+---------+---------+---------+-----
DBNAME    IXNAME    ICDATE  ICTIME  DSNAME                       
---------+---------+---------+---------+---------+---------+-----
ACPIE01   TS01N1    120820  131854  ACP.QA.DEFQ.MA0065.G0001V00  
ACPIE01   TS01N1    120820  131828  ACP.QA.DEFQ.MA0060.G0001V00  
ACPIE01   TS01N1    120820  131553  ACP.QA.DEFQ.MA0015.G0016V00  
ACPIE01   TS01N1    120820  131523  ACP.QA.DEFQ.MA0010.G0033V00  
DSNE610I NUMBER OF ROWS DISPLAYED IS 4                           
DSNE616I STATEMENT EXECUTION WAS SUCCESSFUL, SQLCODE IS 100      
---------+---------+---------+---------+---------+---------+-----

The EXPOUT option on the OUTPUT command (OUTPUT-syntax-options) indicates that BMC AMI Copy will create a migration file.

Important

The migration file replaces the need for INCOPY and OBIDXLAT syntax with BMC AMI Recover. Records written to the file identify the correct data sets to use and how to translate the OBIDs from the source subsystem to the target subsystem.

Example EXPORT syntax

In this example, the OUTPUT descriptor defines a data set for exporting. Later in the SYSIN, an EXPORT command refers to OUTPUT EXPFILE.

Example
OUTPUT XPFILE
       UNIT SYSALLDA
       EXPOUT YES
       DSNAME 'RWC.EXPORT.D&DATE.T&TIME.X&TASK'

EXPORT TABLESPACE PAYROLL.*, INVENTRY.*
       EXPORTDDN (EXPFILE)

Limitations

The EXPORT command has the following limitations:

  • No support for incremental copies
  • No support for copies of the Db2 catalog
  • No support for clone spaces or spaces that were previously in a clone relationship
  • No support for specifying DSNUM

    First, EXPORT looks for DSNUM 0 or DSNUM 1 for either the latest full copy (LASTFULLCOPY) or for an exact RBA or LRSN. If EXPORT finds DSNUM 0, it uses that copy. If EXPORT finds DSNUM 1, it looks for DSNUM 2 and each consecutive number until it does not find a match. If EXPORT stops before reaching the number of partitions in a space, it stops with an error message.

    With multi-data set non-partitioned spaces, EXPORT will look for a DSNUM 0 or DSNUM 1 full copy matching the specified RBA or LRSN, and then look for image copies of additional datasets (DSNUM 2 – DSNUM n) that were registered with the same START_RBA.

    If you are using EXPORT with multi-data set LOB table spaces, the copies should be made with RESETMOD NO. If RESETMOD YES is used with LOB table spaces, the COPY command is processed by the IBM Db2 COPY utility, and the copies of a multi-data set LOB might not be registered with the same START_RBA.

  • You cannot specify EXPORT INDEXSPACE or EXPORT INDEX syntax. However, indexes are included when you specify INDEXES YES.

 

Tip: For faster searching, add an asterisk to the end of your partial query. Example: cert*