SAP MCOD On DB2 zOS
SAP MCOD On DB2 zOS
SAP MCOD On DB2 zOS
SAP on DB2 Universal Database for OS/390 and z/OS: Multiple Components in One Database (MCOD)
Hands-on scenarios to merge SAP components into an MCOD landscape How to clone one SAP component using the Control Center Recovery considerations in an MCOD landscape
Florence Dubois Kellie Bohlsen Tim Bohlsen Bernd Kohler Gert Ruland
ibm.com/redbooks
International Technical Support Organization SAP on DB2 Universal Database for OS/390 and z/OS: Multiple Components in One Database (MCOD) February 2003
SG24-6914-00
Note: Before using this information and the product it supports, read the information in Notices on page xi.
First Edition (February 2003) This edition applies to SAP Basis Release 4.6C, 4.6D, 6.10, and 6.20, as well as all SAP products based on these SAP Basis Releases, for use with IBM DB2 Universal Database for OS/390 and z/OS.
Copyright International Business Machines Corporation 2003. All rights reserved. Note to U.S. Government Users Restricted Rights -- Use, duplication or disclosure restricted by GSA ADP Schedule Contract with IBM Corp.
Contents
Figures . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . ix Notices . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . xi Trademarks . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . xii Preface . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . xiii The team that wrote this redbook . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . xiv Become a published author . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . xvi Comments welcome . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . xvi Chapter 1. MCOD in a DB2 UDB for OS/390 and z/OS environment . . . . . . 1 1.1 Introduction . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 2 1.1.1 Motivation . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 2 1.1.2 Benefits . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 2 1.1.3 Drawbacks . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 3 1.1.4 Availability . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 4 1.2 Technical realization . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 4 1.2.1 General implementation . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 4 1.2.2 DB2-specific modifications . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 5 1.2.3 Independence of components . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 8 1.2.4 Implementation . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 9 1.3 Setup options . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 10 1.3.1 Basic setup considerations . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 10 1.3.2 Non-data sharing DB2. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 11 1.3.3 Data sharing DB2 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 12 Chapter 2. Planning for an MCOD landscape . . . . . . . . . . . . . . . . . . . . . . . 15 2.1 Planning for MCOD . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 16 2.1.1 Keep things as separate as possible . . . . . . . . . . . . . . . . . . . . . . . . 16 2.1.2 Size of the DB2 subsystem . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 16 2.1.3 Number of SAP systems in the MCOD landscape . . . . . . . . . . . . . . 17 2.1.4 Bufferpool tuning . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 18 2.1.5 Recovery of the DB2 subsystem . . . . . . . . . . . . . . . . . . . . . . . . . . . . 18 2.1.6 Resources for daily tasks . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 19 2.1.7 License key . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 19 2.1.8 Checklist . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 19 2.2 Install directly. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 20 2.3 Merging two systems. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 20 2.3.1 Three methods of merging . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 21
iii
2.3.2 Additional tasks . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 23 2.3.3 Checklist for merging . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 23 2.4 Our system configuration . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 24 Chapter 3. MCOD installation and merge using SAP tools . . . . . . . . . . . . 27 3.1 Introduction . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 29 3.1.1 SAP Basis Releases 4.6C and 4.6D . . . . . . . . . . . . . . . . . . . . . . . . . 29 3.1.2 SAP Basis Releases 6.10 and later . . . . . . . . . . . . . . . . . . . . . . . . . 30 3.2 Installing a new component. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 30 3.2.1 SAP Basis Releases 4.6C and 4.6D . . . . . . . . . . . . . . . . . . . . . . . . . 30 3.2.2 SAP Basis Releases 6.10 and later . . . . . . . . . . . . . . . . . . . . . . . . . 30 3.3 Merging components into an MCOD landscape . . . . . . . . . . . . . . . . . . . . 32 3.3.1 SAP Basis Releases 4.6C and 4.6D . . . . . . . . . . . . . . . . . . . . . . . . . 33 3.3.2 SAP Basis Release 6.10 and later . . . . . . . . . . . . . . . . . . . . . . . . . . 37 3.4 Steps after installation or merge . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 37 3.5 Minimizing migration down time . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 38 3.5.1 Incremental migration . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 38 3.5.2 Merging without moving the data . . . . . . . . . . . . . . . . . . . . . . . . . . . 39 Chapter 4. Merging SAP components without moving data . . . . . . . . . . . 41 4.1 Considerations for using this procedure . . . . . . . . . . . . . . . . . . . . . . . . . . 43 4.1.1 Reasons for choosing the merge in place procedure . . . . . . . . . . . . 43 4.1.2 Limitations . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 43 4.1.3 Tools we used . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 44 4.2 Planning considerations . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 44 4.2.1 Decide on source and target DB2 subsystem . . . . . . . . . . . . . . . . . . 44 4.2.2 Decide on naming conventions for merged system . . . . . . . . . . . . . 45 4.2.3 System availability issues . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 45 4.2.4 System backup and recovery issues. . . . . . . . . . . . . . . . . . . . . . . . . 46 4.2.5 Hardware-based backup options . . . . . . . . . . . . . . . . . . . . . . . . . . . 47 4.2.6 Merge in place procedure checklist. . . . . . . . . . . . . . . . . . . . . . . . . . 47 4.3 Merge in place scenario . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 49 4.4 Preparation steps . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 51 4.4.1 Source: Create full backup of source system . . . . . . . . . . . . . . . . . . 51 4.4.2 Target: Create full backup of catalog and directory of target . . . . . . 52 4.4.3 Source: Redefine empty tablespaces as DEFINE NO in source . . . 52 4.4.4 Source: Reorganize tablespaces . . . . . . . . . . . . . . . . . . . . . . . . . . . 52 4.4.5 Source and Target: Create and populate metadata tables . . . . . . . . 53 4.4.6 Source and Target: Define source objects in target system . . . . . . . 55 4.4.7 Target: Update metadata tables . . . . . . . . . . . . . . . . . . . . . . . . . . . . 59 4.4.8 Target: Stop newly created databases . . . . . . . . . . . . . . . . . . . . . . . 59 4.4.9 Target: Prepare RUNSTATS JCL . . . . . . . . . . . . . . . . . . . . . . . . . . . 60 4.5 Migration steps . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 60
iv
SAP on DB2 UDB for OS/390 and z/OS: Multiple Components in One Database (MCOD)
4.5.1 Source: Stop all update activity on source system . . . . . . . . . . . . . . 60 4.5.2 Source: Perform full backup of source DB2 subsystem . . . . . . . . . . 61 4.5.3 Source: Start source databases for UT access. . . . . . . . . . . . . . . . . 61 4.5.4 Source: Execute REPAIR on page set header pages. . . . . . . . . . . . 61 4.5.5 Source: Stop source DB2 subsystem . . . . . . . . . . . . . . . . . . . . . . . . 62 4.5.6 Target: Delete target data sets and rename source data sets . . . . . 62 4.5.7 Target: Start target databases in target system . . . . . . . . . . . . . . . . 63 4.5.8 Target: Execute REPAIR LEVELID on tablespaces and indexes . . . 63 4.5.9 Cold start target system (optional) . . . . . . . . . . . . . . . . . . . . . . . . . . 64 4.5.10 Target: Execute RUNSTATS . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 65 4.5.11 Target: Perform IMAGE COPY . . . . . . . . . . . . . . . . . . . . . . . . . . . . 65 4.5.12 Configure SAP application server . . . . . . . . . . . . . . . . . . . . . . . . . . 65 4.6 Post-migration steps . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 68 4.6.1 Target: Verify access to objects using RSDB2MAS (optional) . . . . . 68 4.6.2 Target: Alter the space allocations for TS and IX (optional) . . . . . . . 68 Chapter 5. Cloning one component out of an MCOD landscape . . . . . . . 69 5.1 MCOD cloning: Just another homogeneous system copy . . . . . . . . . . . . 70 5.1.1 Homogeneous system copy (HSC) . . . . . . . . . . . . . . . . . . . . . . . . . . 70 5.1.2 MCOD cloning . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 72 5.1.3 Control Center support for HSC and MCOD cloning. . . . . . . . . . . . . 72 5.2 Cloning scenario . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 73 5.3 Using the Control Center cloning wizard . . . . . . . . . . . . . . . . . . . . . . . . . . 75 5.3.1 System requirements . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 75 5.3.2 Skill requirements . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 76 5.3.3 Prepare to create a cloning session . . . . . . . . . . . . . . . . . . . . . . . . . 77 5.3.4 Running the Control Center cloning wizard. . . . . . . . . . . . . . . . . . . . 78 5.3.5 Prepare for submitting the generated JCL . . . . . . . . . . . . . . . . . . . . 95 5.3.6 XMAP member and MCOD cloning . . . . . . . . . . . . . . . . . . . . . . . . . 96 5.3.7 When do you have to regenerate JCL . . . . . . . . . . . . . . . . . . . . . . . 98 5.3.8 Running the generated JCL . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 98 5.3.9 Additional considerations . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 108 Chapter 6. PPT recovery of one system in an MCOD landscape . . . . . . 115 6.1 Different reasons for MCOD usage . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 117 6.1.1 Use of SAP MCOD for consistency. . . . . . . . . . . . . . . . . . . . . . . . . 117 6.1.2 Use of SAP MCOD for consolidation . . . . . . . . . . . . . . . . . . . . . . . 118 6.2 Recovery scenarios . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 118 6.2.1 Determination of the scope of SAP components affected. . . . . . . . 119 6.2.2 Work with the application owners . . . . . . . . . . . . . . . . . . . . . . . . . . 119 6.2.3 Determining if a DB2 recovery is needed . . . . . . . . . . . . . . . . . . . . 120 6.3 Scenario: Recovery of one component . . . . . . . . . . . . . . . . . . . . . . . . . . 121 6.3.1 Description of the cause of error . . . . . . . . . . . . . . . . . . . . . . . . . . . 122
Contents
6.3.2 Determination of recovery steps . . . . . . . . . . . . . . . . . . . . . . . . . . . 123 6.4 Additional considerations . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 125 6.4.1 Application of scenario to other applications . . . . . . . . . . . . . . . . . . 125 6.4.2 Considerations for multiple SAP component recovery . . . . . . . . . . 126 6.4.3 Testing in advance . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 126 Chapter 7. Computer Center Management System (CCMS) and MCOD 127 7.1 Setup of CCMS in an MCOD landscape . . . . . . . . . . . . . . . . . . . . . . . . . 128 7.1.1 Required patches . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 128 7.1.2 Setup of SAP collector tools saposcol and rfcoscol . . . . . . . . . . . . 128 7.1.3 Central DBA planning calendar . . . . . . . . . . . . . . . . . . . . . . . . . . . . 131 7.2 MCOD enhancements . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 133 7.2.1 Tables and indexes monitor (transaction DB02) . . . . . . . . . . . . . . . 133 7.2.2 Central DBA planning calendar (transaction DB13C) . . . . . . . . . . . 134 7.2.3 DBA planning calendar (transaction DB13): Backup . . . . . . . . . . . 135 7.2.4 Backup monitor (transaction DB12) . . . . . . . . . . . . . . . . . . . . . . . . 136 7.2.5 CCMS monitor set (transaction RZ20) . . . . . . . . . . . . . . . . . . . . . . 137 7.2.6 Database performance analysis (transaction ST04) . . . . . . . . . . . . 138 Appendix A. Database layout . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 145 Overview . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 146 General remarks . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 146 R/3 Releases 3.0F, 3.1H, 3.1I, and 4.0B . . . . . . . . . . . . . . . . . . . . . . . . . 147 R/3 Releases 4.5A and 4.5B . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 148 Basis Releases 4.6B, 4.6C, and 4.6D . . . . . . . . . . . . . . . . . . . . . . . . . . . . 149 Basis Releases 6.10 and 6.20 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 149 Rename procedure. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 150 General procedure . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 150 Mixed layouts . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 150 Appendix B. Merge in place: Working with metadata tables. . . . . . . . . . 153 Creating metadata tables . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 154 DDL for creation of ZMCODDB . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 154 DDL for creation of ZMCOD_STOGROUP . . . . . . . . . . . . . . . . . . . . . . . . 154 DDL for creation of ZMCOD_DATABASE. . . . . . . . . . . . . . . . . . . . . . . . . 155 DDL for creation of ZMCOD_TABLESPACE . . . . . . . . . . . . . . . . . . . . . . 156 DDL for creation of ZMCOD_TABLES . . . . . . . . . . . . . . . . . . . . . . . . . . . 157 DDL for creation of ZMCOD_INDEXES . . . . . . . . . . . . . . . . . . . . . . . . . . 157 Populating metadata tables . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 159 SETUPSTG . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 159 SETUPDB . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 162 SETUPTS . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 165 SETUPTAB . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 170 SETUPIX . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 173
vi
SAP on DB2 UDB for OS/390 and z/OS: Multiple Components in One Database (MCOD)
JCL to run the population REXX procedures . . . . . . . . . . . . . . . . . . . . . . 177 Moving metadata tables across systems . . . . . . . . . . . . . . . . . . . . . . . . . . . . 178 JCL to unload metadata tables on the source system . . . . . . . . . . . . . . . 178 JCL to load metadata tables into the target system . . . . . . . . . . . . . . . . . 180 JCL to reset copy pending status on tablespaces. . . . . . . . . . . . . . . . . . . 181 Working with metadata tables . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 182 DUPLICDB . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 182 JCL to run the duplicate resolution REXX procedure . . . . . . . . . . . . . . . . 188 Updating metadata tables . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 189 POSTDDL . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 189 POSTDDL2 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 192 JCL used to run the update REXX procedures . . . . . . . . . . . . . . . . . . . . . 195 Appendix C. Merge in place: Defining source objects in target system 197 Generating DDL using DB2 Admin. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 198 Invoking DB2 Admin . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 198 JCLGEN . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 199 JCLGENDB . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 205 JCLGENTS . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 207 JCLGENTB . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 210 JCLGENIX. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 212 JCL to run generation REXX procedure and submit the generated JCL . 215 Tailoring the output from DB2 Admin . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 217 TAILORTS. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 217 TAILORIX . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 219 TAILORTB. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 221 JCL to run the tailoring REXX procedures . . . . . . . . . . . . . . . . . . . . . . . . 225 Sample DDL for creating objects . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 227 Using filler tablespaces to reserve OBIDs . . . . . . . . . . . . . . . . . . . . . . . . . . . 230 Appendix D. Merge in place: Migrating the data . . . . . . . . . . . . . . . . . . . 233 Running the migration procedures . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 234 PDS libraries used . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 234 Input parameters for all migration procedures . . . . . . . . . . . . . . . . . . . . . 235 Extracting information from the metadata tables . . . . . . . . . . . . . . . . . . . . . . 236 $ZMCDBSR . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 236 $ZMCINSR . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 237 $ZMCTSSR . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 238 PQUERYTB . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 239 Issuing DB2 START and STOP DATABASE commands. . . . . . . . . . . . . . . . 241 PDSNDBST. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 241 Executing REPAIR on page set header pages . . . . . . . . . . . . . . . . . . . . . . . 244 PREPTSOB. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 244
Contents
vii
PREPINOB . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 248 Deleting created target data sets and renaming source data sets . . . . . . . . . 248 PVSATSDE . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 248 PVSAINDE . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 250 PVSATSAL . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 250 PVSAINAL. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 252 Executing REPAIR LEVELID on tablespaces and indexes . . . . . . . . . . . . . . 253 PREPTSLV . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 253 PREPINLV . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 255 Generating DDL for views . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 255 $IBMVIST . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 256 PCREATVI . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 256 Generating DDL for altering object sizes . . . . . . . . . . . . . . . . . . . . . . . . . . . . 259 $IBMTSSR . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 259 $IBMINSR . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 260 PTEPTSAL . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 261 PTEPINAL . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 264 Appendix E. Additional material . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 265 Locating the Web material . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 265 Using the Web material . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 265 How to use the Web material . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 266 Abbreviations and acronyms . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 267 Related publications . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 269 IBM Redbooks . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 269 Other References . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 269 SAP Notes. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 271 Referenced Web sites . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 272 How to get IBM Redbooks . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 272 IBM Redbooks collections . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 272 Index . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 273
viii
SAP on DB2 UDB for OS/390 and z/OS: Multiple Components in One Database (MCOD)
Figures
1-1 1-2 1-3 1-4 2-1 3-1 3-2 3-3 3-4 4-1 4-2 5-1 5-2 5-3 5-4 5-5 5-6 5-7 5-8 5-9 5-10 5-11 5-12 5-13 5-14 5-15 5-16 5-17 5-18 6-1 6-2 6-3 7-1 7-2 7-3 7-4 7-5 7-6 MCOD: Database user and schema . . . . . . . . . . . . . . . . . . . . . . . . . . . . 5 MCOD: No data exchange within the database . . . . . . . . . . . . . . . . . . . . 9 MCOD landscape with DB2 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 12 MCOD and data sharing . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 13 Our initial configuration . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 25 Installing a new dialog instance in an MCOD landscape . . . . . . . . . . . . 31 SAPinst: Specifying DB2-specific installation parameters . . . . . . . . . . . 32 Merging components with SAP tools: Initial configuration . . . . . . . . . . . 33 Merging components with SAP tools: Final configuration . . . . . . . . . . . 34 Merge in place scenario: Initial configuration . . . . . . . . . . . . . . . . . . . . . 50 Merge in place scenario: Final configuration . . . . . . . . . . . . . . . . . . . . . 51 Cloning scenario: Initial configuration . . . . . . . . . . . . . . . . . . . . . . . . . . 74 Cloning scenario: Final configuration . . . . . . . . . . . . . . . . . . . . . . . . . . . 75 Create a new session in the cloning wizard . . . . . . . . . . . . . . . . . . . . . . 79 Create cloning session wizard: Introduction . . . . . . . . . . . . . . . . . . . . . 80 Create cloning session wizard: JCL storage . . . . . . . . . . . . . . . . . . . . . 81 Create cloning session wizard: Source subsystem . . . . . . . . . . . . . . . . 82 Create cloning session wizard: Target subsystem. . . . . . . . . . . . . . . . . 83 Create cloning session wizard: Source data sets . . . . . . . . . . . . . . . . . 84 Create cloning session wizard: Target data sets . . . . . . . . . . . . . . . . . . 86 Create cloning session wizard: Copied data sets . . . . . . . . . . . . . . . . . 88 Create cloning session wizard: DB2 libraries. . . . . . . . . . . . . . . . . . . . . 89 Create cloning session wizard: Work Load Manager. . . . . . . . . . . . . . . 90 Create cloning session wizard: Execution parameters . . . . . . . . . . . . . 91 Create cloning session wizard: Job statements . . . . . . . . . . . . . . . . . . . 92 Create cloning session wizard: Summary (1/2) . . . . . . . . . . . . . . . . . . . 93 Create cloning session wizard: Summary (2/2) . . . . . . . . . . . . . . . . . . . 94 Generated JCL. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 95 Modifying the XMAP file for MCOD cloning . . . . . . . . . . . . . . . . . . . . . . 97 Important reference times required for recovery planning . . . . . . . . . . 119 Prior point in time (PPT) recovery scenario: Initial configuration . . . . . 122 Steps involved in non-disruptive recovery of one SAP component . . . 125 Transaction DB2: SAP collector settings . . . . . . . . . . . . . . . . . . . . . . . 129 Transaction DB2: Output of the bind of SAP collector . . . . . . . . . . . . . 130 Transaction SM59: Create connection. . . . . . . . . . . . . . . . . . . . . . . . . 131 Transaction SM59: Test connection . . . . . . . . . . . . . . . . . . . . . . . . . . 132 Transaction DB13C: Configuration of DBA planning calendar . . . . . . 132 Transaction DB02: Initial screen . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 133
ix
7-7 7-8 7-9 7-10 7-11 7-12 7-13 7-14 7-15 7-16
Transaction DB02: Detailed analysis output for indexes . . . . . . . . . . . 134 Transaction DB13: Backup . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 135 Transaction DB13: Log output . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 136 Transaction DB12: List of last successful backups . . . . . . . . . . . . . . . 137 Transaction ST04: Initial screen . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 138 Transaction ST04: Long-running URs . . . . . . . . . . . . . . . . . . . . . . . . . 139 Transaction ST04: Long-running URs (Detail) . . . . . . . . . . . . . . . . . . . 140 Transaction ST04: Statement Cache Statistics . . . . . . . . . . . . . . . . . . 141 Transaction ST04: Statement Cache Statistics (Details 1/2) . . . . . . . . 142 Transaction ST04: Statement Cache Statistics (Details 2/2) . . . . . . . . 143
SAP on DB2 UDB for OS/390 and z/OS: Multiple Components in One Database (MCOD)
Notices
This information was developed for products and services offered in the U.S.A. IBM may not offer the products, services, or features discussed in this document in other countries. Consult your local IBM representative for information on the products and services currently available in your area. Any reference to an IBM product, program, or service is not intended to state or imply that only that IBM product, program, or service may be used. Any functionally equivalent product, program, or service that does not infringe any IBM intellectual property right may be used instead. However, it is the user's responsibility to evaluate and verify the operation of any non-IBM product, program, or service. IBM may have patents or pending patent applications covering subject matter described in this document. The furnishing of this document does not give you any license to these patents. You can send license inquiries, in writing, to: IBM Director of Licensing, IBM Corporation, North Castle Drive Armonk, NY 10504-1785 U.S.A.
The following paragraph does not apply to the United Kingdom or any other country where such provisions are inconsistent with local law: INTERNATIONAL BUSINESS MACHINES CORPORATION PROVIDES THIS PUBLICATION "AS IS" WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESS OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF NON-INFRINGEMENT, MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE. Some states do not allow disclaimer of express or implied warranties in certain transactions, therefore, this statement may not apply to you.
This information could include technical inaccuracies or typographical errors. Changes are periodically made to the information herein; these changes will be incorporated in new editions of the publication. IBM may make improvements and/or changes in the product(s) and/or the program(s) described in this publication at any time without notice. Any references in this information to non-IBM Web sites are provided for convenience only and do not in any manner serve as an endorsement of those Web sites. The materials at those Web sites are not part of the materials for this IBM product and use of those Web sites is at your own risk. IBM may use or distribute any of the information you supply in any way it believes appropriate without incurring any obligation to you. Information concerning non-IBM products was obtained from the suppliers of those products, their published announcements or other publicly available sources. IBM has not tested those products and cannot confirm the accuracy of performance, compatibility or any other claims related to non-IBM products. Questions on the capabilities of non-IBM products should be addressed to the suppliers of those products. This information contains examples of data and reports used in daily business operations. To illustrate them as completely as possible, the examples include the names of individuals, companies, brands, and products. All of these names are fictitious and any similarity to the names and addresses used by an actual business enterprise is entirely coincidental. COPYRIGHT LICENSE: This information contains sample application programs in source language, which illustrates programming techniques on various operating platforms. You may copy, modify, and distribute these sample programs in any form without payment to IBM, for the purposes of developing, using, marketing or distributing application programs conforming to the application programming interface for the operating platform for which the sample programs are written. These examples have not been thoroughly tested under all conditions. IBM, therefore, cannot guarantee or imply reliability, serviceability, or function of these programs. You may copy, modify, and distribute these sample programs in any form without payment to IBM for the purposes of developing, using, marketing, or distributing application programs conforming to IBM's application programming interfaces.
xi
Trademarks
The following terms are trademarks of the International Business Machines Corporation in the United States, other countries, or both: CICS DB2 DB2 Universal Database DFSMSdss DRDA eServer Enterprise Storage Server FlashCopy IBM MVS OS/390 QMF RACF RAMAC Redbooks Redbooks (logo) S/390 S/390 z/OS z/VM zSeries
The following terms are trademarks of other companies: ActionMedia, LANDesk, MMX, Pentium and ProShare are trademarks of Intel Corporation in the United States, other countries, or both. Microsoft, Windows, Windows NT, and the Windows logo are trademarks of Microsoft Corporation in the United States, other countries, or both. Java and all Java-based trademarks and logos are trademarks or registered trademarks of Sun Microsystems, Inc. in the United States, other countries, or both. C-bus is a trademark of Corollary, Inc. in the United States, other countries, or both. UNIX is a registered trademark of The Open Group in the United States and other countries. SET, SET Secure Electronic Transaction, and the SET Logo are trademarks owned by SET Secure Electronic Transaction LLC. Other company, product, and service names may be trademarks or service marks of others.
xii
SAP on DB2 UDB for OS/390 and z/OS: Multiple Components in One Database (MCOD)
Preface
The Multiple Components in One Database (MCOD) feature of SAP enables a reduction in the number of DB2 systems that need to be installed and maintained. This significantly simplifies overall database administration and is considered one of the major DB2 competitive advantages. This IBM Redbook will help systems administrators, database administrators, managers, and operation staff to plan, implement, and administer an SAP MCOD landscape with DB2 Universal Database (UDB) for OS/390 and z/OS as the database management system. We describe how to merge existing systems into a single DB2 subsystem. Two different methods are developed, each of them addressing different needs. For small-to-medium SAP systems where high availability is not a requirement, we explain how to use SAP tools. For large systems, where the down time needed by SAP standard procedures is not acceptable, we document a technique to merge SAP components without moving the data. We also provide a cloning procedure using the Control Center. We show how to clone one component out of an MCOD landscape, but this cloning technique is not specific to SAP applications and can apply to any DB2 subsystem. We address the backup and recovery implications in an MCOD environment, to help database administrators plan accordingly. We also describe how to set up and use the Computer Center Management System (CCMS) in an MCOD landscape.
xiii
The book addresses an audience familiar with SAP system requirements, and for some specific topics, an in-depth knowledge of DB2 UDB for OS/390 and z/OS is assumed.
xiv
SAP on DB2 UDB for OS/390 and z/OS: Multiple Components in One Database (MCOD)
Thanks to the following people for their contributions to this project: Viviane Anavi-Chaput Richard Conway Roy Costa Mike Ebbers Vasilis Karras International Technical Support Organization, Poughkeepsie, NY, U.S. Namik Hrle IBM eServer Software Development, Boeblingen, Germany Andreas Mueller Holger Scheller Johannes Schuetzner Dietmar Stemmler IBM mySAP Technology on DB2 for z/OS Development, Walldorf, Germany Yves Tolod Peter Wansch IBM DB2 Tools & Connectivity Development, Toronto, Canada James Teng IBM DB2 for z/OS Development, Silicon Valley Lab, CA, U.S. Wilhelm Burger IBM SAP International Competence Center (ISICC), Walldorf, Germany Noel Richard IBM EMEA ATS Products and Solutions Support Center, Montpellier, France Don Geissler Michael Gordon IBM U.S. Helmut Roesner IBM/SAP Integration Center, IBM Silicon Valley Labs, U.S.
Preface
xv
Comments welcome
Your comments are important to us! We want our Redbooks to be as helpful as possible. Send us your comments about this or other Redbooks in one of the following ways: Use the online Contact us review redbook form found at:
ibm.com/redbooks
Mail your comments to: IBM Corporation, International Technical Support Organization Dept. HYJ Mail Station P099 2455 South Road Poughkeepsie, NY 12601-5400
xvi
SAP on DB2 UDB for OS/390 and z/OS: Multiple Components in One Database (MCOD)
Chapter 1.
SAP on DB2 for OS/390 and z/OS: High Availability Solution Using System Automation, SG24-6836
SAP Service Marketplace quick link MCOD at:
http://service.sap.com/mcod
You must be registered as an SAP Service Marketplace user to access this resource. To register, go to:
http://service.sap.com
1
In the rest of this book, we refer to DB2 UDB for OS/390 and z/OS using the short name of DB2.
1.1 Introduction
MCOD is a feature that enables the installation of several SAP components2 independently in one single database management system (DBMS) instance. In this section, we discuss the reasons that motivated the implementation of this feature.
1.1.1 Motivation
Without MCOD, each SAP component has to be installed in a DBMS instance of its own. On the one hand, this is advantageous, because it gives maximum flexibility in terms of scalability and choice of the operating system (OS) and database server (DB). On the other hand, there are severe drawbacks that come with the administration of separate systems. The following tasks are particularly costly and difficult to handle: Maintaining a separate DBMS instance for each SAP component Setting up high-availability solutions for business applications that use multiple SAP systems Synchronizing the backup and restore for an extended SAP system landscape
1.1.2 Benefits
Using the MCOD functionality leads to a system landscape that is leaner and easier to maintain. The advantages are as follows: Reduced costs Multiple different and independent software solutions are located in one logical and physical DBMS instance. The administrative effort is reduced considerably. Experience gained from several projects show that companies can achieve savings in the following areas: Reduction of the costs related to disk space, with fewer DB2 subsystems and associated libraries and DB2 logs. Reduction of the hardware backup costs, with fewer separate subsystems to consider.
SAP components are defined as any of the mySAP components based on the SAP Web Application Server (SAP WAS, formerly SAP R/3 Basis) technology. Presently, this includes mySAP R/3, mySAP CRM, mySAP BW, and mySAP Workplace among others. Because they are based on SAP WAS technology, their underlying database server and database layout requirements are similar.
SAP on DB2 UDB for OS/390 and z/OS: Multiple Components in One Database (MCOD)
Lower operating costs, such as managing backups or high-availability solutions. This is particularly the case where multiple, critical SAP components are located in an MCOD landscape. Here, the costs of high-availability solutions are shared by the SAP components, instead of being required separately, which would increase both costs and complexity. These savings stem from reduced overall maintenance and operating costs, as well as a streamlined process for backup and high-availability solutions and an efficient use of your available resources. System spanning consistency Point-in-time recovery of semantically related systems (for example, R/3 and CRM) is possible. There is no additional effort required for synchronization, as opposed to a single component installation. Simplified database administration, synchronized backup and recovery This reduces the effort for database administration. Note, for example, that all systems use the same DBMS release. Greater use of high availability techniques With multiple, critical components installed into one database, it is easier to implement high-availability solutions for this environment. This can include consideration of DB2 data sharing and use of a z/OS sysplex environment. In the case of DB2 data sharing, different members of a DB2 data sharing group can be configured with differing installation parameters (DSNZPARMs) appropriate for the SAP component having application servers utilizing those DB2 group members. Additive sizing approach The total sizing requirements of an MCOD installation (CPU, storage, and so on) are easily determined by adding up the requirement for each single component. Complete independence of all SAP components Some of these advantages are explored in more detail in the following sections.
1.1.3 Drawbacks
Remember, however, that there are also some drawbacks: If the DBMS instance is unavailable, all the SAP components resident in that DBMS instance are also unavailable. Therefore, MCOD may not be suitable for large installations or mission-critical applications if no failover strategy is in place. For more information, refer to SAP on DB2 for OS/390 and z/OS: High Availability Solution Using System Automation, SG24-6836.
The use of the MCOD feature can, in some circumstances, reduce flexibility. In a non-data sharing environment, the SAP components residing in one DB2 subsystem may only have their database server workload running in one z/OS logical partition (LPAR). This may be considered an advantage in some situations, and a disadvantage in others. Cloning single components is slightly more complex. This topic is covered in Chapter 5, Cloning one component out of an MCOD landscape on page 69. Backup, recovery, updating database statistics, and other utilities may take longer, although the total effort and duration will be quicker than the sum of the parts. Point-in-time recovery for a single SAP component within the MCOD landscape is possible, but much more complicated. This topic is covered in Chapter 6, PPT recovery of one system in an MCOD landscape on page 115.
1.1.4 Availability
The following can be said with respect to the availability of the MCOD feature: It is generally available on all OS/DBMS platforms supported by SAP. It is supported for selected products based on SAP Basis Release 4.6C/D and all SAP components based on SAP Basis Release 6.10 and later. For a detailed release matrix, refer to the SAP Service Marketplace quick link MCOD at:
http://service.sap.com/mcod
All future SAP components are planned to be enabled for MCOD installation. An upgrade to a supported release may be necessary before consolidating an installed system into an MCOD landscape.
SAP on DB2 UDB for OS/390 and z/OS: Multiple Components in One Database (MCOD)
Database servers support schema. Tables with the same name but different schema can coexist in a database server. In the case of DB2, the schema is also called creator. Using a one-to-one relationship between the database user and the database schema, each SAP component uses its own schema by accessing the database server with a unique dedicated database user. By that, all objects (in the case of DB2: stogroups, database, tablespaces, tables, indexes, and triggers) are clearly associated with only one SAP component. For table T100, this relationship is depicted in Figure 1-1.
Schema
Older SAP applications use the schema SAPR3 when accessing the database server. With the introduction of MCOD, the schema can now be specified during the installation procedure: For applications based on SAP Basis Release 4.6C/D, the default is still SAPR3. However, the default can be overwritten during the installation process (see 3.3.1, SAP Basis Releases 4.6C and 4.6D on page 33). For SAP Basis Releases 6.10 and later, the default is value is SAP<SID>.
All DB2 objects belonging to one SAP component must have the same creator (the one specified during the installation). Besides tables, views, and indexes, this also includes stogroups, databases, and tablespaces. Note that all SAP applications check whether the creator of a stogroup, tablespace, or database is correct before using it for the creation of a new database object.
Stogroups
Each component has its own set of stogroups: If the creator associated with the SAP component is SAPR3, the traditional naming is applied for stogroups (for example, SAPBTD and SAPSTI). Otherwise, the first three characters are substituted with the SAP System ID. For example, if the SAP System ID is PRD, the stogroups will be named PRDBTD, PRDSTI, and so forth.
VCAT name
The VCAT name is specified during the installation procedure and subsequently used as an attribute when creating the stogroups. It should be chosen differently from the DB2 system data (catalog, directory, and so forth) and each other SAP component in the MCOD installation. Then, the VCAT can be used to easily identify SAP components on a data set level, because it forms the high-level qualifier (HLQ) of the data sets created by DB2. Storage Management Subsystem (SMS) access control system (ACS) routines and storage groups can be adapted to allow each component to reside on its own pool of volumes to assist storage management. Alternatively, any combination of sharing or isolation is possible through SMS settings. This is only possible by specifying unique VCATs when installing or merging into an MCOD environment and, therefore, is highly recommended by SAP and IBM (see 2.1.1, Keep things as separate as possible on page 16).
SAP on DB2 UDB for OS/390 and z/OS: Multiple Components in One Database (MCOD)
Plan name
Previous to MCOD, by default, SAP applications used the DB2 plan names FOME<REL>P for the Integrated Call Level Interface (ICLI) server and SAPR3<REL> for the z/OS application server (<REL> is the SAP Kernel Release). In an MCOD landscape, these names cannot be applied, because each application needs an individual plan name (ICLI connections are not shared between different SAP systems). A new default naming convention has to be introduced. For details, see Table 1-1.
Table 1-1 Naming convention for plan and package names
ICLI Package Plan F<SID><REL> F<SID><REL> z/OS application server O<SID><REL> O<SID><REL>
Here are two examples: FPRD46D is the plan name of the 4.6D ICLI server related to system PRD. For an z/OS application server of system DEV and Kernel Release 6.20, we use the plan name ODEV620.
Bufferpools
By default, all SAP components in an MCOD installation use the same bufferpools (BP2, BP3, BP8K0, BP16K0, BP32K). However, the bufferpool tuning can be adjusted individually for each SAP component by activating additional bufferpools (see 2.1.4, Bufferpool tuning on page 18).
Catalog
All SAP components share the DB2 catalog and directory as a common resource. Therefore, the only locking conflict between different SAP systems can occur in the catalog, and here, only the creation of databases is a likely candidate for deadlocks. Therefore, SAP recommends not to run upgrades, add-on installations, or database installations in parallel within an MCOD landscape.
SAP on DB2 UDB for OS/390 and z/OS: Multiple Components in One Database (MCOD)
Security Because the SAP components are logically independent, they cannot influence each another. This applies to DDL and data manipulation language (DML) operations. <sid>adm users There is no change in the number of <sid>adm users needed for administration (transports and so forth). The different DB schemas are reflected in the environments and profiles of the <sid>adm users.
1.2.4 Implementation
Using the MCOD technology is as straightforward as installing a new SAP component in a separate subsystem. Therefore, no extra effort is required. Keep in mind that SAP R/3 systems need to be upgraded to mySAP.com (including the latest SAP R/3 4.6C component) or SAP R/3 Enterprise to be enabled for MCOD. For standard SAP (front-end) users, there is no difference compared to a non-MCOD installation. Even SAP Basis administrators who use stand-alone tools, such as tp, or perform upgrades are unlikely to notice any difference. Basically, MCOD is implemented entirely on a database (administration) level.
Performance
Certainly, MCOD installations need more resources for the database work than a single system, but fewer resources than the sum of all the systems within the database system. This is because the load can be better balanced when using this architecture by utilizing the facilities and features available. Usually, SAP recommends to only combine low- to mid-sized systems in an productive MCOD installation. Otherwise, you may soon reach resource limitations. Again, DB2 data sharing is a powerful tool to tackle the larger workload and, therefore, allow the combination of large systems (see 1.3.3, Data sharing DB2 on page 12).
System recommendations
Not every MCOD configuration makes sense. SAP recommends to only combine the following: Systems with semantically-related data, such as SAP R/3 and CRM Systems of the same type, for example, combinations of development or combinations of production systems
10
SAP on DB2 UDB for OS/390 and z/OS: Multiple Components in One Database (MCOD)
11
Work Proc
Work Proc
Work Proc
ICLI
DRDA
Work Proc
Work Proc
Work Proc
Bufferpools
Unicode
Database
RDBMS
12
SAP on DB2 UDB for OS/390 and z/OS: Multiple Components in One Database (MCOD)
SAP CRM
SAP R/3
New Appl.
Coupling facility
Work Proc
Work Proc
There are several advantages with this kind of setup: A very high degree of scalability can be achieved. Resource constraints can be overcome by adding additional CPUs, memory, or even LPARs. This caters to MCOD installations for large, productive SAP system landscapes. The SAP components are stored independently from each other. Therefore, there is no contention for data between the data sharing members. With DB2 data sharing, it possible to combine OLTP and OLAP systems, because the data sharing members can be set up and tuned individually.
13
14
SAP on DB2 UDB for OS/390 and z/OS: Multiple Components in One Database (MCOD)
Chapter 2.
SAP R/3 on DB2 for OS/390: Database Availability Considerations, SG24-5690 SAP on DB2 for OS/390 and z/OS: High Availability Solution Using System Automation, SG24-6836 SAP R/3 on DB2 UDB for OS/390 and z/OS: Planning Guide, 2nd Edition, SAP R/3 Release 4.6D, SC33-7966 SAP on DB2 UDB for OS/390 and z/OS: Planning Guide, SAP Web Application Server 6.20, SC33-7959 DB2 Universal Database for OS/390 Data Sharing: Planning and Administration Version 6, SC26-9007
15
2. Ask IBM to map the results of the quicksizer to the required resources on an S/390 or a zSeries box. 3. Use the sum of all components as the sizing for processors, storage, DASD, and channels. This also applies if we want to add only one new SAP system to an MCOD landscape. However, with this additive approach, we may count common resources several times. We believe that SAP AG will work on additional sizing options once it has gained more experience with controlled installations.
16
SAP on DB2 UDB for OS/390 and z/OS: Multiple Components in One Database (MCOD)
This applies to the following: Storage CPU processors I/O bandwidth We may even consider implementing a DB2 data sharing environment to relieve constraints in these areas. By using the MCOD landscape to place critical SAP components into one DB2 subsystem, we may subsequently adopt some of the advantages of DB2 on S/390 or zSeries platforms to increase availability. These actions include implementing DB2 data sharing and the high availability option for the SAP Central Instance. These topics are covered in SAP R/3 on DB2 for OS/390: Database Availability Considerations, SG24-5690 and SAP on DB2 for OS/390 and z/OS: High Availability Solution Using System Automation, SG24-6836.
17
Consistency MCOD
If you use MCOD for consistency reasons, you have to consider the complete DB2 subsystem as a unit of recovery. The normal recovery procedures apply. You have to be aware that you deal with n-times more tablespaces, as you run n SAP systems in one database. If you have to meet targets for the duration of the recovery, you have to adapt your recovery procedures to cope with that restriction.
18
SAP on DB2 UDB for OS/390 and z/OS: Multiple Components in One Database (MCOD)
Consolidation MCOD
If you use MCOD for consolidation, you want to have a possibility to recover every single SAP system to a certain point in time. This can be achieved. The process is explained in Chapter 6, PPT recovery of one system in an MCOD landscape on page 115. However, this requires the following: 1. A cloning of the DB2 system. 2. A recovery of the clone to the requested time. The recovery may only be done for the SAP system under discussion. 3. A deletion of the SAP system under discussion in the target system. 4. A merge of the SAP system out of the recovered clone to the target system. You can already see that it requires all the techniques described in this book.
2.1.8 Checklist
We summarize our considerations in Table 2-1.
Table 2-1 Planning checklist for MCOD considerations
Item Type of MCOD landscape Naming conventions Alias ICF catalog SMS storage group Volumes Considerations Consolidation or consistency. Number of SAP components. Adopt rigorous conventions. One per SAP system and one for DB2 system. One per used alias. One or more per used alias. Separate pool of volumes for each SAP component.
19
Redo bufferpool tuning. Review recovery procedures and adjust. Plan for recovery of a single component (consolidation MCOD).
Daily tasks Installing a new system into an existing one Merging two systems
Review daily jobs and adjust. Install directly on page 20. Installing a new component on page 30. Merging two systems on page 20. Merging SAP components without moving data.
License keys
20
SAP on DB2 UDB for OS/390 and z/OS: Multiple Components in One Database (MCOD)
21
22
SAP on DB2 UDB for OS/390 and z/OS: Multiple Components in One Database (MCOD)
23
Tasks Merge using DB2 tools without moving the data Additional tasks
Reference Merging SAP components without moving data on page 41. Set up the target application server on page 35. Insure that you get the new license keys. Populate the statistics for the new objects in the target system.
24
SAP on DB2 UDB for OS/390 and z/OS: Multiple Components in One Database (MCOD)
Linux 7
Linux 9
RED (6.20)
BLU (4.6C)
YEL (4.6D)
ICLI Client
ICLI Client
ICLI Client
SC49
DB7T
DB7S
DB7X
DB2-SAP Database
DB2-SAP Database
DB2-SAP Database
SAPRED
SAPBLU
DB7XU
In the following chapters, we describe how we set up the two MCOD landscapes: One using SAP tools The other by merging two systems without moving the data sets
25
26
SAP on DB2 UDB for OS/390 and z/OS: Multiple Components in One Database (MCOD)
Chapter 3.
DB2/390: Incremental Migration to DB2/390, SAP Note 353558 DB2/390: MCOD installation, SAP Note 399419 DB2/390: APAR List, SAP Note 081737 DB2/390: PTF check tool, SAP Note 183311 DB2/390: DDIC corrections (Releases 4.6A, 4.6B, 4.6C, 4.6D), SAP Note 184399
27
DB2/390: DDIC corrections (6.10, 6.20), SAP Note 407663 DB2/390: Newest version of the CCMS 4.6C, SAP Note 217468 DB2/390: Latest version of CCMS 4.6D, SAP Note 337776 DB2/390: CCMS corrections (6.10, 6.20), SAP Note 427748 DB2/390: MCOD installation tools, SAP Note 580665 The SAP installation and migration guides available on the SAP Service Marketplace quick link INSTGUIDES at:
http://service.sap.com/instguides
The following planning guides: SAP R/3 on DB2 UDB for OS/390 and z/OS: Planning Guide, 2nd Edition, SAP R/3 Release 4.6D, SC33-7966 SAP on DB2 UDB for OS/390 and z/OS: Planning Guide, SAP Web Application Server 6.20, SC33-7959
28
SAP on DB2 UDB for OS/390 and z/OS: Multiple Components in One Database (MCOD)
3.1 Introduction
There are several ways to set up an MCOD landscape: Install a new instance in a DB2 subsystem where another instance is already defined. Merge two existing components in the same DB2 subsystem. In this chapter, we describe how both tasks can be done using the standard SAP installation tools. However, we need to distinguish between 4.6x and 6.x based products, because the installation tool has changed in between. All references to an SAP Basis Release are also valid for all other SAP products based on this SAP Basis Release. For example, SAP Enterprise 4.7 is based on 6.20 technology and encapsulates all features of SAP Basis Release 6.20. Table 3-1 gives an overview.
Table 3-1 Relation between SAP Basis Releases and SAP products based on it
SAP Basis Release 4.6C 4.6D 6.10 6.20 SAP products Workplace 2.x, R/3 4.6C, BW 2.0B, BBP/CRM 2.0B Workplace 2.11, BW 2.1C, BBP/CRM 2.0C, APO 3.10 Web AS 6.10, BW 3.0A, EBP/CRM 3.0 Web AS 6.20, BW 3.0B, BW 3.10, EBP 3.5, CRM 3.1, Enterprise 4.7
Because MCOD was introduced when most of the SAP products based on Basis Release 4.6x (for example, SAP R/3 4.6C) were already shipped, most of the functionality needed for MCOD is not available immediately: In the context of this book, it is particularly important to understand that the installation tool R3SETUP and the templates shipped with the 4.6C/D installation CD-ROMs cannot be employed in general to install or migrate into an existing MCOD landscape. Usually, both R3SETUP and its templates have to be upgraded before starting the installation procedure. For details, see DB2/390: MCOD installation tools, SAP Note 580665.
29
Additional actions are also necessary to adjust all SAP systems in the MCOD installation. They are described in 3.4, Steps after installation or merge on page 37.
30
SAP on DB2 UDB for OS/390 and z/OS: Multiple Components in One Database (MCOD)
Linux 7
Linux 9
YEL (4.6D)
WHT (6.20)
ICLI Client
ICLI Client
ICLI (6040)
ICLI (6020)
DB7X
DB2-SAP Database
DB2-SAP Database
DB7XU (a)
SAPWHT (b)
NEW
We use the installation tool SAPinst and follow the procedure described in the Installation Guide SAP Web Application Server 6.20 on UNIX: IBM DB2 Universal Database for OS/390 and z/OS, available on the SAP Service Marketplace quick link INSTGUIDES at:
http://service.sap.com/instguides
The most important input screen with respect to MCOD is depicted in Figure 3-2 on page 32, where DB2 installation parameters and, in particular, the schema (in our case, SAPWHT) have to be specified. Do not forget to perform the post-installation steps described in 3.4, Steps after installation or merge on page 37.
31
32
SAP on DB2 UDB for OS/390 and z/OS: Multiple Components in One Database (MCOD)
Lin ux 7
Linux 9
B LU (4.6C )
YEL (4.6D)
W HT (6.20)
IC LI C lient
ICLI Client
ICL I Client
D B7S
DB 7X
D B2-SAP D atabase
D B 2-SAP Database
DB 2-SAP Database
SAPBLU
DB7XU (a)
SAPW HT (b)
The merge consists of the following steps: 1. Export the source system (in our case, BLU). 2. Set up the target application server (in our case, GRE). 3. Load the exported data into the target database. 4. Post-installation steps.
33
Figure 3-4 shows the final configuration after the merge. We now have one MCOD landscape consisting of three SAP components: YEL, WHT, and GRE. Note that the three components are based on different SAP Basis Releases.
Linux 7
Linux 9
BLU (4.6C)
GRE (4.6C)
YEL (4.6D)
WHT (6.20)
ICLI Client
ICLI Client
ICLI Client
ICLI Client
DB7S
DB7X
DB2-SAP Database
DB2-SAP Database
DB2-SAP Database
DB2-SAP Database
SAPBLU
SAPGRE (c)
DB7XU (a)
SAPWHT (b)
EXPORT / IMPORT
The steps are as follows: 1. Set up the export and work directory. 2. Go to the work directory and call:
/<CDMOUNT>/UNIX/INSTTOOL.SH
34
SAP on DB2 UDB for OS/390 and z/OS: Multiple Components in One Database (MCOD)
3. Only Linux for zSeries: a. Retrieve the file DBEXPORT.R3S from sapservX. b. Obtain latest R3SETUP patch from SAP Service Marketplace quick link PATCHES at:
http://service.sap.com/patches
5. Start R3SETUP:
./R3SETUP -f DBEXPORT.R3S
6. Specify all parameters as usual. 7. Continue and finish the export as usual.
3. Copy MCOD-specific R3SETUP templates from sapservX to the installation directory. For details, see DB2/390: MCOD installation tools, SAP Note 580665.
35
4. Retrieve the latest 4.6D R3SETUP patch from SAP Service Marketplace quick link PATCHES, copy it to the installation directory, and execute:
./R3SETUP -v
Check that the output is VERSION: 20020504 or later. 5. Modify MCODCE_UNIX_db2.BASE.R3S: a. Specify/add CREATOR=<SCHEMA> in section [DBCOMMONPARAMETERS_IND_xxx]. b. Specify as 1_LABEL (in most cases located in section [CDSERVERKERNELBASE_IND_xxx]) the content of LABEL.ASC of the Kernel CD, for example:
DB2forOS/390:BASIS:46D:KERNEL:Kernel:CD51017309
6. Start R3SETUP:
./R3SETUP -f MCODCE_UNIX_db2.BASE.R3S
7. Specify the input as usual. 8. Check BIND and GRANT JCLs. The plan name should be F<SID>46D. 9. Continue and finish the installation. 10.Modify the plan name (from step 8) and, optionally, the port number in the ICLI procedure or shell script. Start the ICLI server on the host. 11.Apply the latest 4.6D Kernel patches from the SAP Service Marketplace quick link PATCHES, in particular for the DBSL library. 12.Log on as <sid>adm and check whether the connection works using:
R3trans -x
13.Check that DBS_DB2_SCHEMA is set to <SCHEMA>, using the echo command. 14.Specify dbs/db2/schema=<SCHEMA> in the profile DEFAULT.PFL.
36
SAP on DB2 UDB for OS/390 and z/OS: Multiple Components in One Database (MCOD)
3. Start R3SETUP:
./R3SETUP -f MCODMIG_UNIX_db2.BASE.R3S
2. DDIC corrections Apply the latest DDIC corrections and Basis Support Packages. For details, refer to DB2/390: DDIC corrections (Releases 4.6A, 4.6B, 4.6C, 4.6D), SAP Note 184399 and DB2/390: DDIC corrections (6.10, 6.20), SAP Note 407663. 3. CCMS transports Import the latest CCMS transport available. For details, refer to DB2/390: Newest version of the CCMS 4.6C, SAP Note 217468, DB2/390: Latest version of CCMS 4.6D, SAP Note 337776, and DB2/390: CCMS corrections (6.10, 6.20), SAP Note 427748. 4. DB2 maintenance Ensure that the DB2 subsystem on the target system is at the correct preventive maintenance level. For details, refer to DB2/390: APAR List, SAP Note 081737 and DB2/390: PTF check tool, SAP Note 183311. Important: Please note that the fixes listed need to be applied to every SAP component in an MCOD installation. That also includes the one that is there before other SAP systems are merged into the subsystem.
37
For more details about the fixes that we apply to our systems, refer to 7.1.1, Required patches on page 128.
38
SAP on DB2 UDB for OS/390 and z/OS: Multiple Components in One Database (MCOD)
The complete procedure has been automated and can also be used for cross-database migrations. It is available as an add-on functionality to the SAP standard migration procedure. See DB2/390: Incremental Migration to DB2/390, SAP Note 353558 for details.
39
40
SAP on DB2 UDB for OS/390 and z/OS: Multiple Components in One Database (MCOD)
Chapter 4.
DB2/390: RSDB2MAS new version, SAP Note 330289 DB2 Universal Database for OS/390 Data Sharing: Planning and Administration Version 6, SC26-9007
41
DB2 Universal Database for OS/390 and z/OS Data Sharing: Planning and Administration Version 7, SC26-9935 DB2 UDB for OS/390 and z/OS Diagnosis Guide and Reference Version 7, LY37-3740 DB2 Universal Database for OS/390 and z/OS: Utility Guide and Reference Version 7, SC26-9945 SAP on IBM DB2 UDB for OS/390 and z/OS: Database Administration Guide, SAP Web Application Server, Release 6.20, SAP document available on the SAP Service Marketplace quick link INSTGUIDES at:
http://service.sap.com/instguides
IBM DB2 Administration Tool for z/OS Users Guide Version 4 Release 1, SC27-1601
42
SAP on DB2 UDB for OS/390 and z/OS: Multiple Components in One Database (MCOD)
4.1.2 Limitations
The following issues are not fully automated in our merge in place procedure. The handling of these issues may affect whether you decide to use the merge in place procedure or whether you decide to merge SAP components using SAP tools. The systems we merge are non-data sharing. However, the majority of the steps for the merge in place procedure is the same for data sharing or non-data sharing systems. The systems we merge contain no large objects (LOBs). This supports systems prior to and including SAP Basis Release 4.6C; however, this needs to be considered for systems later than this. The systems we merge contain a small number of partitioned tablespaces. Migration of partitioned tablespaces is addressed in our procedure although it is not fully automated. We do not automatically migrate any multi-VSAM tablespaces, that is, those with suffixes of A002, A003, and so forth.
43
SAP creates several indexes on the DB2 catalog. These indexes are not moved as part of this procedure, because we assume that the MCOD landscape that we are merging into already contains those indexes. Additionally, SAP creates tables, for example, PLAN_TABLE, DSN_STATEMENT_TABLE, and DSN_FUNCTION, that do not use the SAP storage groups and may not use the same catalog alias as other SAP objects. These tables are not migrated because they are created automatically when first using the explain function within transaction DB2.
44
SAP on DB2 UDB for OS/390 and z/OS: Multiple Components in One Database (MCOD)
All objects in the target system must be image copied. This is required for all objects in that DB2 subsystem, not just those that were merged from the source system. System availability requirements During some steps of the merge in place procedure, the source system will be unavailable. However, the target system is available most of the time throughout the entire process.
45
We perform the merge in place procedure on an SAP Basis Release 4.6C system, which contains approximately 3,300 tablespaces and 7,000 indexspaces, initially created with DEFINE NO. However, around 1,100 tablespaces and 2,700 indexspaces are not empty and have data sets defined for them. Table 4-1 shows the execution times for these steps.
Table 4-1 Execution times for merge in place steps for SAP 4.6C Basis only
Step REPAIR TABLESPACE IDCAMS ALTER TABLESPACE REPAIR LEVELID TABLESPACE REPAIR INDEX IDCAMS ALTER TABLESPACE REPAIR LEVELID INDEXSPACE Execution time (approximate) 3 min. 8 min. 3 min. 8 min. 20 min. 8 min.
Note: The execution times are only given as an indication based on our experience. These times may not be the same in your environment.
46
SAP on DB2 UDB for OS/390 and z/OS: Multiple Components in One Database (MCOD)
The flexible use of this technology is particularly useful in the case of major system changes, such as SAP updates and migrations. The different storage vendors vary in their actual implementation, and so do the tools and commands to establish, break, and re-establish mirrors. However, all share the same principles for the usage suggested in the merge in place procedure. There are two main types of split mirror backups. In the first type, the broken mirror remains only in the storage subsystem with the ability to restore the system quickly to these volume level copies. The second variation is that these copies are externalized to some other media, for example, cartridge or tape. The first type we will call a soft copy and the second, externalized copies, a hard copy. Depending on the storage subsystem type, it may be possible to establish and maintain one or more soft copy images within the subsystem depending on limits of disk storage and device address ability. For the purpose of the following exercise, the use of soft copy and hard copy backups at various points are suggested. Soft copies have the advantage that they can be restored quickly, and the disadvantages that the subsystem may only be capable of maintaining one copy or may require additional disk storage per copy, or both. Hard copies have the advantages that you can maintain as many copies as required, and that they may be kept for a long time. Hard copies have the disadvantage that they take time to externalize the mirror copy to disk, and they consume tape media resources.
Preparation steps
The steps in Table 4-2 on page 48 do not require exclusive use of the source or target systems.
47
Migration steps
The steps in Table 4-3 require exclusive use of the source system.
Table 4-3 Migration steps for the merge in place procedure
Migration steps 4.5.2, Source: Perform full backup of source DB2 subsystem on page 61 4.5.3, Source: Start source databases for UT access on page 61 4.5.4, Source: Execute REPAIR on page set header pages on page 61 4.5.5, Source: Stop source DB2 subsystem on page 62 4.5.6, Target: Delete target data sets and rename source data sets on page 62 4.5.7, Target: Start target databases in target system on page 63 4.5.8, Target: Execute REPAIR LEVELID on tablespaces and indexes on page 63 4.5.10, Target: Execute RUNSTATS on page 65 4.5.11, Target: Perform IMAGE COPY on page 65 4.5.12, Configure SAP application server on page 65
48
SAP on DB2 UDB for OS/390 and z/OS: Multiple Components in One Database (MCOD)
Post-migration steps
The steps in Table 4-4 do not require exclusive use of the source or target system.
Table 4-4 Post-migration steps for the merge in place procedure
Post-migration steps 4.6.1, Target: Verify access to objects using RSDB2MAS (optional) on page 68 4.6.2, Target: Alter the space allocations for TS and IX (optional) on page 68
49
Linux 8
Linux 7
RED (6.20)
BLU (4.6C)
ICLI Client
ICLI Client
SC42
ICLI (6010)
DB7T
DB7S
DB2-SAP Database
DB2-SAP Database
SAPRED
SAPBLU
Once this procedure completes, the BLU objects that were in DB7S are now accessed from DB7T. DB7T now contains the BLU and RED components. The final configuration is shown in Figure 4-2 on page 51.
50
SAP on DB2 UDB for OS/390 and z/OS: Multiple Components in One Database (MCOD)
Linux 8
Linux 7
RED (6.20)
BLU (4.6C)
ICLI Client
ICLI Client
SC42
DB7T
DB7S
DB2-SAP Database
DB2-SAP Database
SAPRED
SAPBLU
51
52
SAP on DB2 UDB for OS/390 and z/OS: Multiple Components in One Database (MCOD)
It is possible to determine if any tablespaces have had an ALTER performed on them since they were created with the following query, as shown in Example 4-1 on page 53.
Example 4-1 Sample SELECT statement
SELECT DBNAME, TSNAME, MAX(ALTEREDTS) FROM SYSIBM.SYSTABLES WHERE CREATOR = 'SAPR3' AND TYPE = 'T' AND ALTEREDTS <> CREATEDTS GROUP BY DBNAME, TSNAME ORDER BY DBNAME, TSNAME;
This shows the most recent ALTER TABLE within each tablespace. However, there is no way to tell from the DB2 catalog whether the ALTER consisted of adding a column.
53
54
SAP on DB2 UDB for OS/390 and z/OS: Multiple Components in One Database (MCOD)
The procedure DUPLICDB finds any clashes and tries to resolve them by regenerating the last three characters of the database name to new random values. It tries this up to 20 times for each clash, and if it cannot resolve the clash, it reports this. If this error occurs, then you will need to change the value of the target database name in the migration tables to a unique value. This action is very unlikely, and all clashes should be resolved. The JCL to move the metadata from the source to the target, the procedure DUPLICDB, as well as the JCL to submit it, are included in Working with metadata tables on page 182.
55
Before executing DB2 Admin, we add extra indexes to the DB2 catalog to improve the performance of the DDL generation program ADB2GEN. Details of these indexes are in Chapter 2, Customizing DB2 Admin, in IBM DB2 Administration Tool for z/OS Users Guide Version 4 Release 1, SC27-1601.
Source and Target: Generate DDL for DB, TS, TB, and IX
DB2 Admin is used to generate the DDL for databases, tablespaces, tables and indexes. We use a two-step process for this generation: 1. Target: Generate JCL to invoke DB2 Admin The REXX procedure JCLGEN and its subroutines JCLGENDB, JCLGENTS, JCLGENTB, and JCLGENIX produce JCL for invoking DB2 Admin. These REXX procedures use the metadata tables in the target system as parameters to generate the JCL. 2. Source: Execute JCL to invoke DB2 Admin The size of the generated JCL prevents us from using TSO SUBMIT in our system. So, once the JCL is generated, it is copied directly to the JES2 internal reader for submission. The JCL job cards contain TYPRUN=HOLD, so release the jobs (using the a action character against each job in SDSF) when you are ready to run them. The order in which these jobs are run is not important. These jobs run on the source system to extract information from the source DB2 catalog. The REXX procedure JCLGEN (and its subroutines) and the JCL to execute it and submit the generated JCL are included in Generating DDL using DB2 Admin on page 198.
56
SAP on DB2 UDB for OS/390 and z/OS: Multiple Components in One Database (MCOD)
57
Therefore, this step is only required for systems that contain multiple tablespaces per database (SAP Basis Release 6.10 and later). When this step is required, we influence which OBIDs our tablespaces use by: 1. Creating databases. 2. Creating filler tablespaces to reserve the OBIDs we want for tables within each database. 3. Creating our real tablespaces. 4. Dropping the filler tablespaces, freeing up the OBIDs we want for tables. 5. Creating our tables and other objects. The REXX procedure FILLERTS generates the DDL for creating and dropping filler tablespaces. This generated DDL must be run against the metadata tables on the target system. More information about this REXX procedure is provided in Using filler tablespaces to reserve OBIDs on page 230.
58
SAP on DB2 UDB for OS/390 and z/OS: Multiple Components in One Database (MCOD)
Before defining these objects, you should ensure that: The VCAT/alias you are using for the stogroups has been defined in the same ICF catalog as the one used for the source VCAT (to be able to rename the VSAM data sets). That SMS ACS routines are updated if stogroups are SMS managed. The creator you are using for the new objects has the authority to create objects in the target DB2 subsystem.
59
Continue only if no threads, no utilities, and no databases with spaces in restricted states are returned. Resolve stopped utilities and restricted space states before proceeding.
60
SAP on DB2 UDB for OS/390 and z/OS: Multiple Components in One Database (MCOD)
You may want to stop the DB2 subsystem and start it in restricted mode to ensure you have exclusive access to the system. Use the START DB2 ACCESS(MAINT) command for this.
61
Important: These procedures create samples for partitioned tablespaces and the partitioning index. However, these samples have to be adapted manually. These samples assume a partition size of 4 GB, thus the page number of the first page of portion 2 will be X00200000. This value is different if the partition size is different. This value can be derived from the DSSIZE field and PGSIZE field in SYSIBM.SYSTABLESPACE. In our case, the same values we use for the corresponding tablespace identifies the corresponding header pages in the respective part of the partition. The resulting jobs must run against the source DB2 subsystem! Important: It is crucial that these jobs run successfully. In case REPAIR fails on objects, you may still be able to access the data, but other tasks may fail.
4.5.6 Target: Delete target data sets and rename source data sets
When the source tablespaces and indexes are defined in the target catalog (see Source and Target: Define source objects in target system on page 55), a new VCAT name and, possibly, a new database name are used. Similarly, the index may be created with a new indexspace name. For DB2 to access the source VSAM data sets from the target DB2 subsystem, the VSAM data sets must be renamed to match the names in the target DB2 catalog.
62
SAP on DB2 UDB for OS/390 and z/OS: Multiple Components in One Database (MCOD)
When the source tablespaces and indexspaces are defined in the target catalog, a VSAM data set may have been created. We distinguish two cases: If the source tablespace or index was created with DEFINE NO, and it contains no data, no VSAM data set exists in the source system. In this case, no VSAM data set is created when the object is defined in the target system. If the source tablespace or index was created with DEFINE YES, or it contains data, the VSAM data set exists in the source system. When it is defined to the target system, a VSAM data set is created. These newly created VSAM data sets will not be used, because the existing source VSAM data sets will be reused in the target DB2 subsystem. So, it is these VSAM data sets that must be deleted The REXX procedures PVSATSDE and PVSAINDE are used to generate the DELETE statements. The REXX procedures PVSATSAL and PVSAINAL are used to generate the ALTER statements. More information about these procedures is provided in Deleting created target data sets and renaming source data sets on page 248. Important: Our procedures do not handle the multi-data set tablespaces and the multi-data set indexspaces. A simple check to see if your installation has such types is a ISPF 3.4 list datasets <svcat>.DSNDBD.*.*.A002. If you get more than the expected ones for partitions and partitioning indexes, note them and create the IDCAMS rename jobs yourself.
63
The REXX procedures PREPTSLV and PREPINLV are used to generate and tailor the REPAIR. More information about these procedures is provided in Executing REPAIR LEVELID on tablespaces and indexes on page 253.
Important: Before performing the cold start, you must do the following: Shut down all SAP application servers. Stop all ICLI servers. Verify that there is no outstanding activity on the target subsystem using the following commands:
DIS THREAD(*) DISPLAY UTILITY(*) DISPLAY DATABASE(*) SPACE(*) RESTRICT
Continue only if no threads, no utilities, and no databases with spaces in restricted states are returned. Resolve stopped utilities and restricted space states before stopping the target subsystem. After performing the cold start, you must perform an image copy on all objects in the target DB2 subsystem, not only the objects that are merged.
64
SAP on DB2 UDB for OS/390 and z/OS: Multiple Components in One Database (MCOD)
65
Attention: We strongly recommend reinstalling the application server software, as described in Set up the target application server on page 35. It is the simplest and safest means of adapting the SAP instance to the new environment. The following steps were sufficient to allow our testing to be conducted successfully, but it is much safer to use SAP installation tools, because they will perform all required actions, some of which may be missing here.
Change the .dbenv_<hostname>.sh file in $HOME for <sid>adm to contain the lines:
DBS_DB2_SCHEMA=<new schema> R3_DB2_SSID=<new DB2 SSID> DBS_DB2_SSID=<new DB2 SSID> SAPDBHOST=<DB2 hostname>
If needed, manually export the environment variables DBS_DB2_SCHEMA, R3_DB2_SSID, DBS_DB2_SSID, and SAPDBHOST. Change the .dbenv_<hostname>.csh file in $HOME for <sid>adm to contain the lines:
setenv setenv setenv setenv DBS_DB2_SCHEMA <new schema> R3_DB2_SSID <new DB2 SSID> DBS_DB2_SSID <new DB2 SSID> SAPDBHOST <DB2 hostname>
In SAP transaction STMS, change the System Transport Tool data in the Domain Controller for this system, and distribute the configuration to all members. The following values must be changed:
R3_DB2_SSID DBS_DB2_SSID DBHOST
66
SAP on DB2 UDB for OS/390 and z/OS: Multiple Components in One Database (MCOD)
After the system is started, and you can log on to the SAP system, in transaction DB2J under the Profile option, the following parameters need to be updated: DB2 load library (general tab) DB2 run library (general tab) High Level Qualifier (storage tab) Upload data set (upload tab) if required due to host change SAPOSCOL directory and DEST (saposcol tab) if required due to host change SDSF HASPINDX (console tab) if required due to host change For SAP Web Application Server Release 6.10 and later, the configuration file connect.ini has been introduced, allowing the specification of up to 10 database servers. Please refer to DB2/390: New failover support from Release 6.10, SAP Note 402078 for information to adapt this file during an MCOD merge. In the case of DB2 data sharing, the Group Attach Name should be used instead of the DB2 SSID, as documented in SAP on DB2 UDB for OS/390 and z/OS: Planning Guide, SAP Web Application Server 6.20, SC33-7959.
67
68
SAP on DB2 UDB for OS/390 and z/OS: Multiple Components in One Database (MCOD)
Chapter 5.
SAP on DB2 for z/OS and OS/390: DB2 System Cloning, SG24-6287 SAP R/3 Homogeneous System Copy, Release 4.6C SR2, material number 51013678 SAP Web Application Server 6.20: Homogeneous and Heterogeneous System Copy, SAP document available on the SAP Service Marketplace quick link INSTGUIDES at:
http://service.sap.com/instguides
Program directories: Program Directory for DB2 Management Tools Package (JDB661D), GI10-8193 Program Directory for IBM DB2 UDB Server for OS/390 and z/OS: DB2 Management Clients Package (JDB771D), GI10-8218 Program Directory for DB2 for OS/390 and z/OS: DB2 Administration Server for z/OS (HDAS810), GI10-8472
69
PSP buckets: 390 Enablement V6 (Upgrade DB2610, subset JDB661D) 390 Enablement V7 (Upgrade DB2710, subset JDB771D) DAS (for DB2/390 V7) (Upgrade DB2710, subset HDAS810)
HSC methods
The method used for HSC is determined by your operational business requirements for both the source and the target systems: If high availability is required for the source system, it is necessary to make the copy without stopping the SAP application and impacting its availability to the end users. This method is known as online copy. The definition of an online copy implies the following: Source subsystem active log activity is suspended (using DB2 SET LOG SUSPEND). Target restart method is conditional restart (skips portion of log processing). Copy is done using hardware-assisted volume level copying (ESS FlashCopy).
70
SAP on DB2 UDB for OS/390 and z/OS: Multiple Components in One Database (MCOD)
Logs need to be copied to the target and applied during restart. If high availability is not an issue for the source system, you might be able to afford stopping the source system prior to making the copy. This means the end users have accepted that the source SAP application will be unavailable in order to make a copy. This method is known as offline copy. The definition of an offline copy implies the following: The source system is stopped and quiesced prior to copying. Data is consistent at the time it is copied. Target restart method is cold start (do not process any log records). DFDSS copy/rename (to disk or tape) or ESS FlashCopy is used for copying.
Cloning process
The cloning system configuration, along with the method used for HSC, has an impact on the cloning procedure itself. However, we can define six phases for the DB2 subsystem cloning process that are common to all methods: 1. Prepare for cloning. 2. Prepare the target subsystem. 3. Check the source environment and copy the source subsystem. 4. Restore the target system and restart it. 5. Alter the target subsystem. 6. Perform post cloning activities.
Additional information
For more detailed information about HSC, refer to the following documents:
SAP on DB2 for z/OS and OS/390: DB2 System Cloning, SG24-6287 SAP R/3 Homogeneous System Copy, Release 4.6C SR2, material number 51013678
71
SAP Web Application Server 6.20: Homogeneous and Heterogeneous System Copy, available at:
http://service.sap.com/instguides
This JCL can be reused as often as you want as long as no major change occurs (see 5.3.7, When do you have to regenerate JCL on page 98).
72
SAP on DB2 UDB for OS/390 and z/OS: Multiple Components in One Database (MCOD)
Faster ESS FlashCopy methods are not supported. Cloning of large DB2 production systems may take several hours. However, the source subsystem will be down for, at most, half of the time. Furthermore, the attention of the DBA is required for only a fraction of this time to control the results of the JCL jobs. And last but not least, no special hardware feature (for example, ESS FlashCopy) is required, as opposed to the online copy method. Almost every large SAP implementation uses data sharing (which is not supported). Important: Support for data sharing and cloning to tape will be added to Control Center in an upcoming release. However, cloning to tape and cloning between data sharing systems can be accomplished even with the current Control Center support with some modifications of the JCL and the cloning instructions. An experienced DB2 system administrator will be able to do that. In 5.3.9, Additional considerations on page 108, we demonstrate with a few examples how to modify the JCL generated by the Control Center in order to perform dump and restore to and from tape and to clone in a data sharing environment. Control Center supported HSC offers a number of compelling features that make the solution very attractive over manual procedures and perfectly suited for MCOD cloning: Selective cloning (VCATs can be excluded). Application databases in the primary VCAT can be excluded. Catalog cleanup (Control Center provides a cleanup job that drops all objects from the target catalog that were excluded from cloning).
73
Linux 7
Linux 9
GRE (4.6C)
YEL (4.6D)
WHT (6.20)
ICLI Client
ICLI Client
ICLI Client
SC49
DB7W
DB7X
DB2-SAP Database
DB2-SAP Database
DB2-SAP Database
SAPGRE (c)
DB7XU (a)
SAPWHT (b)
That MCOD landscape is made up of three SAP systems, YEL, WHT, and GRE, running in a non-data sharing DB2 subsystem. The first system in the MCOD uses the same VCAT as the DB2 catalog (DB7XU). The objective of our scenario is to clone GRE and create ORA on the other LPAR, where an empty non-data sharing DB2 subsystem (DB7W) has been installed, as shown in Figure 5-2 on page 75. For the purpose of our test, we use the Control Center cloning wizard to generate the JCL.
74
SAP on DB2 UDB for OS/390 and z/OS: Multiple Components in One Database (MCOD)
Linux 7
Linux 9
ORA (4.6C)
GRE (4.6C)
YEL (4.6D)
WHT (6.20)
ICLI Client
ICLI Client
ICLI Client
ICLI Client
DB7W
DB7X
DB2-SAP Database
DB2-SAP Database
DB2-SAP Database
DB2-SAP Database
SAPORA
SAPGRE (c)
DB7XU (a)
SAPWHT (b)
CLONED
75
The Database Administration Server (DAS) for OS/390 and z/OS V8.1 (a no-charge feature of DB2 for OS/390 and z/OS V7) is installed and active on the source and target LPARs. It is possible to clone a DB2 for OS/390 and z/OS V6 subsystem provided that the DAS is installed and configured on that LPAR. The 390 Enablement (JDB661D or JDB771D) is installed and activated on both the source and target subsystem, with the most recent maintenance including the PTF for PQ68659 applied to it (see PSP bucket). Both source and target subsystem must be cataloged in the Control Center and have the utilities bound against them. The source and target subsystems do not use data sharing. The source and target subsystems are running in the same sysplex. The generated JCL supports only dumping to and restoring from DASD, not magnetic tape. All data sets are located in system managed space (SMS). Sufficient DASD space must exist to hold the dump data sets and the copied DB2 objects on the target subsystem. The cloning of the source subsystem is performed only after a normal shutdown of the source subsystem. The target subsystem will be at the same version, release, and maintenance level for DB2 and its applications as the source subsystem after the cloning process is complete. Any additional work needed to copy applications that run against the cloned subsystem, such as QMF and DB2AUG, must be performed independently. All active and valid application packages are bound on the target subsystem as part of the cloning process. The user ID that submits the batch jobs must have an OMVS segment defined. You can verify this by issuing the following TSO command:
TSO LU <userid> OMVS
The user ID that submits the batch jobs needs to have read access to the DAS LIBPATH directories and libraries.
76
SAP on DB2 UDB for OS/390 and z/OS: Multiple Components in One Database (MCOD)
You should also understand the physical representation of a DB2 subsystem. You should be able to identify: BSDS and know their use Tablespace and indexspace VSAM data sets (consisting of cluster data sets and the data set naming conventions) Active logs data sets Understand where the data sets corresponding to the DB2 directory, DB2 catalog, and the DB2 work file database reside for a subsystem You should also have a good understanding of DFSMSdss storage administration, in particular the use of the DUMP and RESTORE commands. Part of the process requires you to compile a new ZPARM and DSNHDECP member for the target subsystem. Please make sure you have the JCL required at hand. The job DSNTIJUZ, which was generated during installation, generates the DSNZPARM (or the job whose name you specified for PARAMETER MODULE on the installation panel DSNTIPO) and the DSNHDECP. For detailed information, see the DB2 Universal Database for OS/390 and z/OS V7: Installation Guide, GC26-9936. Make sure you have access to the DB2 and z/OS or OS/390 online documentation in case you run into unexpected system problems. Attention: Subsystem cloning is not trivial and data loss may occur if you do not follow the JCL instructions closely. Make sure you plan for enough time, have your system programmer available for questions, and if possible, try cloning a non-critical test system first.
Management class Storage class . Volume serial . Device type . . Data class . . . Space units . .
77
Average record unit Primary quantity . Secondary quantity Directory blocks . Record format . . . Record length . . . Block size . . . . Data set name type
. 10 5 . 50 . FB . 80 . 27920 : PDS
Before you update JCL or write new JCL into an existing library, make sure you compress it. Otherwise, an error may occur while saving the JCL. Both the source and target subsystem must be up and running in order to generate cloning JCL, because the wizard will query their catalogs for VCAT and space information. It is recommended to run STOSPACE on all source subsystem VCATs in preparation for your cloning session. Having accurate space allocation information will help you choosing a primary and secondary space for your dump data sets. To run STOSPACE in Control Center, select the Storage Groups folder, select all storage groups, and select STOSPACE from the pop-up menu.
78
SAP on DB2 UDB for OS/390 and z/OS: Multiple Components in One Database (MCOD)
79
Introduction
This panel, as shown in Figure 5-4, shows some introductory comments about the Create Cloning Session or Edit Cloning Session wizard. Continue to the next panel and begin to enter the information required for generating the subsystem cloning JCL.
80
SAP on DB2 UDB for OS/390 and z/OS: Multiple Components in One Database (MCOD)
JCL storage
On this panel, as shown in Figure 5-5, you need to specify the partitioned data set library where the cloning JCL jobs generated by the wizard will be stored. Existing members will be displayed in the members list. It is strongly recommended to manually empty the library so that you don't submit jobs from old sessions by mistake (for example, jobs that would delete a target VCAT that no longer exists on the target subsystem).
81
Source subsystem
On this panel, as shown in Figure 5-6, you enter the BSDS clusters for the source subsystem you want to clone. Specify both BSDSs. If your system only uses one BSDS, specify BSDS1 only.
82
SAP on DB2 UDB for OS/390 and z/OS: Multiple Components in One Database (MCOD)
Target subsystem
On this panel, as shown in Figure 5-7, you select the target subsystem for the cloning process. You must also specify the BSDS clusters of the target subsystem. You can specify any DB2 subsystem as the target subsystem that is cataloged on the client. If you specify a target subsystem in an LPAR with which the source subsystem does not share DASD or in a different sysplex, you have to modify the generated JCL to dump the source subsystem to tape. Control Center only checks that the source and target subsystem are different and on the same DB2 version.
83
84
SAP on DB2 UDB for OS/390 and z/OS: Multiple Components in One Database (MCOD)
For each VCAT, you can specify the number of jobs (which is also the number of dump data sets for that VCAT). For a large application, such as SAP, 5 to 8 jobs is a good choice. It allows you to run the dump jobs in parallel and shortens your source system down time. For an almost empty subsystem with just a test database, you can also specify 1. If you have run STOSPACE, the Change dialog box tells you the entire space requirements of that VCAT. Choose primary, secondary spaces, and unitcount accordingly. For example, for a VCAT with 100 MB, you may choose five jobs, leaving roughly 20 MB for each dump data sets. Then, you can use 10 MB as the primary space and 5 MB as the secondary space and a unit count of 10. The dump data sets are allocated with RLSE so that allocated but unused space will be released. Make sure that the system programmer is aware of the naming conventions for the cloning data sets. All work data sets allocated by the batch programs will have the following prefix: SVCAT.CLONE, where SVCAT is the high-level qualifier (HLQ) of the primary VCAT of the target DB2 subsystem. You should double check that there are no ACS routines set up that would force, for example, VSAM only allocation under that qualifier, or anything that may interfere with the cloning process. It is a good idea to either set up an ACS routine for SVCAT.CLONE.** to direct the cloning workfiles to a set of volumes or to use a data storage class for the same purpose. Enough space should be provided for the cloning work and dump data sets.
85
86
SAP on DB2 UDB for OS/390 and z/OS: Multiple Components in One Database (MCOD)
87
88
SAP on DB2 UDB for OS/390 and z/OS: Multiple Components in One Database (MCOD)
DB2 libraries
On this panel, as shown in Figure 5-11, you specify all subsystem-specific DB2 libraries that should be copied from source to target, including SDSNEXIT (where the ZPARMs, EDITPROCs, FIELDPROCs, and compression exits are stored), RUNLIB.LOAD (where the sample programs including DSNTIAD and DSNHDECP are stored), and DBRMLIB.DATA (where the sample program DBRMs are stored). The SDSNLOAD library may also be listed (unless it is shared and under a different HLQ). You enter the source and target subsystem HLQs, click Show Libraries, and all libraries under the source HLQ will show up in the list selected for copy by default. Note: In our environment, SDSNEXIT is under HLQ DB7X7, whereas RUNLIB.LOAD and DBRMLIB.DATA are under DB7XU. The DB2 libraries panel can handle only one HLQ, so we select DB7XU, and we will manually add SDSNEXIT to the generated JCL, as described in Step 3: Check source environment and copy subsystem on page 101.
89
90
SAP on DB2 UDB for OS/390 and z/OS: Multiple Components in One Database (MCOD)
Execution parameters
On this panel, as shown in Figure 5-13, you must enter the system libraries and plan names for the source and target subsystems. The cloning JCL executes Control Center batch programs DSNACCC1 to DSNACCC8 (which are installed in SDSNLOAD), DSNTIAD (which is installed in RUNLIB.LOAD), DSNTEP2 (which is installed in RUNLIB.LOAD), DFSMDSS utilities, such as IDCAMS and ADRDSSU that are assumed to be in the LINKLIST, and DB2 offline utilities that are installed in SDSNLOAD. What you enter here will be used to build JOBLIB and STEPLIB statements for the cloning JCL. If you have a DB2 installation that does not follow these conventions, you have to manually edit the JOBLIB and STEPLIB statements in the generated JCL.
91
Job statements
On this panel, as shown in Figure 5-14, you specify a job card statement for each job that will be created by the generated cloning JCL. These job cards will be saved to the JOBCARD library that you created before you started the new cloning session. You do not have to edit the job card for each job. Edit the job card for the very first job PADELET1 so that it is a valid job card in your environment, as shown in Example 5-2. Select Use this jobcard for all jobs, and select OK.
Example 5-2 Create a job card
//PADELET1 // JOB (999,POK),'SAPRES1',CLASS=A,MSGLEVEL=(1,1), MSGCLASS=T,NOTIFY=&SYSUID,REGION=0M
92
SAP on DB2 UDB for OS/390 and z/OS: Multiple Components in One Database (MCOD)
Summary
After clicking Next on the job statements panel, the JCL jobs will be generated so that you can review them before saving them. Generating the jobs may take a few minutes. You will receive a message saying, All JCL jobs were generated successfully as shown in Figure 5-15.
Select Finish to actually save the JCL jobs and job cards to the specified libraries and to save the cloning session. If you cancel the dialog here, you will have to start all over again. Saving the job cards to the library will take a few minutes. Make sure that before you select Finish, the two libraries (for JCL and job cards) are not allocated (for example, you are not browsing them in a TSO session). Otherwise, the JCL save will fail.
93
Your JCL has been generated successfully only if you see a message like the one shown in Figure 5-16. Do not use the JCL if you do not get this message. The JCL may be incomplete.
94
SAP on DB2 UDB for OS/390 and z/OS: Multiple Components in One Database (MCOD)
Menu Functions Confirm Utilities Help sssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssss BROWSE SAPRES1.CLONE.JCL.CNTL Row 00001 of 00024 Command ===> Scroll ===> CSR Name Prompt Size Created Changed ID _________ PADELET1 _________ PADELET2 _________ PBBLDJ01 _________ PFLSTCAT _________ SAADSPLY _________ SAALTIDX _________ SAALTQRY _________ SAALTUSR _________ SDPRTLOG _________ SFBLDJ01 _________ SFBLDJ02 _________ TBSYSLIB _________ TLCHGLOG _________ WBALTSGP _________ WCALTUIX _________ WEWORKFL _________ WGALTDB2 _________ WIALTDB2 _________ WKALTDB2 _________ WLALTUSR _________ WNALTWLM _________ WSCLNUPT _________ WTVRFALT _________ XMAP **End**
95
96
SAP on DB2 UDB for OS/390 and z/OS: Multiple Components in One Database (MCOD)
Menu Utilities Compilers Help sssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssss BROWSE SAPRES1.CLONE.JCL.CNTL(XMAP) Line 00000000 Col 001 080 Command ===> Scroll ===> CSR ********************************* Top of Data ****************************** 3 DB7XU DB7WU SAPGRE SAPORA SAPWHT _EXCLUDED_ 24 "ICM"."DSNAICUG" DB7WWLM "SQLJ"."INSTALL_JAR" DB7WWLM "SQLJ"."REMOVE_JAR" DB7WWLM "SQLJ"."REPLACE_JAR" DB7WWLM "SYSPROC"."DSNACCAV" DB7WWLM "SYSPROC"."DSNACCDD" DB7WWLM "SYSPROC"."DSNACCDE" DB7WWLM "SYSPROC"."DSNACCDL" DB7WWLM "SYSPROC"."DSNACCDR" DB7WWLM "SYSPROC"."DSNACCDS" DB7WWLM "SYSPROC"."DSNACCMD" DB7WWLM "SYSPROC"."DSNACCMG" DB7WWLM "SYSPROC"."DSNACCMO" DB7WWLMC "SYSPROC"."DSNACCOR" DB7WWLM "SYSPROC"."DSNACCQC" DB7WWLM "SYSPROC"."DSNACCSI" DB7WWLM "SYSPROC"."DSNACCSS" DB7WWLM "SYSPROC"."DSNACCST" DB7WWLM "SYSPROC"."DSNACICS" DB7WWLM "SYSPROC"."DSNTBIND" DB7WWLM "SYSPROC"."DSNTJSPP" DB7WWLM "SYSPROC"."DSNTPSMP" DB7WWLM "SYSPROC"."DSNUTILS" DB7WWLM "SYSPROC"."WLM_REFRESH" DB7WWLM 1 DB7XU
This identifies the primary VCAT of the source subsystem. Remember to add these lines whenever you regenerate JCL (see 5.3.7, When do you have to regenerate JCL on page 98), because the wizard will overwrite the XMAP file every time. If you want to include primary VCAT application databases, you can optionally add them after the primary VCAT entry, as shown in Example 5-3 on page 98.
97
Example 5-3 Include additional primary VCAT databases other than DSN* or CC390
2 MYDB1 MYDB2
Selectively cloning the primary VCAT will reduce the space requirements for the dump and target DB2 data sets, as well as shorten the cloning time. The cleanup job will make sure that all objects that were excluded from cloning will be dropped from the target catalog.
98
SAP on DB2 UDB for OS/390 and z/OS: Multiple Components in One Database (MCOD)
The job names have been chosen so that their alphabetical order reflects the order in which they have to be submitted. Make sure you submit all the jobs in the right sequence and not in parallel (unless stated otherwise). It is important that you precisely follow the cloning instructions. Do not ignore non-zero return codes, unless it is specifically documented that they are acceptable. For troubleshooting, refer to the online help of the Control Center cloning wizard.
Naming convention
When examples are given, the naming convention shown in Table 5-1 is used.
Table 5-1 Naming convention
Abbreviation SSID TSID SVCAT TVCAT SSAPSID TSAPSID SCHEMA Our value DB7X DB7W DB7XU DB7WU GRE ORA SAPGRE Description Subsystem name for the source DB2 subsystem Subsystem name for the target DB2 subsystem HLQ of the catalog data sets for the source DB2 subsystem HLQ of the catalog data sets for the target DB2 subsystem Source SAP system name Target SAP system name Creator/schema of the SAP objects
99
Skip these two jobs if you are cloning for the first time. Otherwise, you will receive a JCL error on PADELET1 and an RC=4 on PADELET2. a. Submit PADELET1 to delete JCL library members called PDVTjjnn, SHVTjjnn, and TEVTjjnn that have been dynamically created by the PBBLDJnn and SFBLDJnn jobs in any previous cloning session. Verify that RC=0. b. Submit PADELET2 to delete work files under the TVCAT.CLONE high-level qualifier that were created in any previous cloning session. Verify that RC=0.
2 You have one PBBLDJjj job for every target VCAT to be deleted. PBBLDJjj uses a DLL in HFS, so you need to make sure that the user ID under which you submit the job has an OMVS segment defined and read access to all the DLLs that are in the libpath of the user under which the DAS is running (for example, dasuser), as well as read access to /var/db2/global.reg. If one of these prerequisites is not met, the job will abend. If you did not create links to the DAS DLLs in /usr/lib during the DAS activation process, you have to replace any occurrence of /usr/lib in the JCL job with the direct path (for example, /u/dasuser/das/lib). 3 As mentioned in Copied data sets on page 87, it is also your responsibility to define any non-existing VCATs before submitting the jobs.
100
SAP on DB2 UDB for OS/390 and z/OS: Multiple Components in One Database (MCOD)
5. Submit PDVTjjnn jobs to delete DB2 indexspace and tablespace data sets associated with the target subsystem. These jobs can be submitted in parallel. Verify that RC=0. If RC=8, and some data sets failed serialization, make sure that the target subsystem is completely stopped and resubmit the job. Verify that the resubmitted job returns RC=0 or RC=4. Submit them as often as required until you get RC=0 or RC=4 (typically, because all data sets have been deleted). 6. Submit PFLSTCAT to list all data sets under the target subsystem VCAT name and all VCAT names that were selected for deletion. Verify that RC=0 or RC=4 and that no DB2 indexspace or tablespace data sets are listed (with DSNDBC as their second-level qualifier). The only VSAM cluster data sets that should remain under the target VCAT name are the BSDS and the log data sets. If you accidentally deleted a set of BSDS on the target system, do not proceed. You have to recover them to proceed.
101
the system administrator who performs the cloning. If MMCGRTS is Y, the SQL ID will be set to the actual creator of the storage group on the source subsystem, before the storage group is created on the target subsystem. It is recommended to keep the default setting, because the original creator of a storage group on the source subsystem may not be set up as a user or have the required authority on the target system. Tip: All the DB2 objects, including storage groups, that belong to an SAP component must have the same creator. Therefore, we recommend that MMCGRTS is set to Y when cloning an SAP system. This will create SET CURRENT SQLID statements in the data set TVCAT.CLONE.SAALTQRY.OUTDB26. It is your responsibility to check that the original creator of a storage group on the source subsystem is set up as a user and has the required authority on the target system. In particular, a group ID <SCHEMA> (for example, SAPGRE in our scenario) must exist on the target system. If any of the SAALTIDX, SAALTQRY, or SAALTUSR jobs abends, or there is a problem (for example, DBRMs not bound), make sure you manually delete the corresponding cloning data sets before you resubmit them. The third level is always the job name. For example: TVCAT.CLONE.SAALTQRY.** 4. Issue DISPLAY THREAD(*). Verify that no connections are returned. If connections are found, manually delete the data sets created by the SAALTIDX, SAALTQRY, and SAALTUSR jobs. Make sure all activity ceases and start Step 3: Check source environment and copy subsystem again. 5. Issue STOP DB2 MODE(QUIESCE) to stop the source subsystem in a consistent mode. Verify that the source subsystem is stopped by checking that the following message is printed to the console:
DSN3100I ssid DSN3EC0X - SUBSYSTEM ssid READY FOR START COMMAND
6. Submit SDPRTLOG to: Run the Print Log Map utility (DSNJU004) against the quiesced BSDS of the source DB2 subsystem to identify the last checkpoint RBA (and save it for later use in the cloning process). Ensure that the source DB2 subsystem was properly quiesced using the DSN1LOGP utility with the options SUMMARY(YES) and the STARTRBA and ENDRBA of the last DB2 checkpoint taken from the output of the Print Log Map utility from the previous step. Verify that RC=0. If SDPRTLOG returns RC=12, you have submitted the job too early, and the BSDS was still allocated by the master address space.
102
SAP on DB2 UDB for OS/390 and z/OS: Multiple Components in One Database (MCOD)
7. Submit SFBLDJjj jobs to dynamically create the SHVTjjnn (dump) and TEVTjjnn (restore) jobs. Verify that RC=0 or RC=4. If a SFBLDJjj job returns RC=4, non-DB2 data sets have been found under the corresponding DSNDBC second-level qualifier, and their VSAM cluster data set names have been written to an exception filter card named TVCAT.CLONE.SFBLDJCL.SHVTjjEX.FILTDD. In most cases, the system administrator will review them and delete them by manually creating a delete job for the exception filter card. These data sets are typically temporary DB2 data sets that were not cleaned up after an abnormal utility termination. Refresh your member list to see the generated jobs. 8. Submit SHVTjjnn jobs in parallel to dump the DB2 indexspace and tablespace data sets of the selected source subsystem VCAT names to sequential data sets. These sequential files are later used in the cloning process to restore the DB2 tablespace and indexspace data sets to the target subsystem under a different VCAT name. Verify that RC=0. If you run out of space here, delete the SVCAT.CLONE.**.DUMP data set and start over again. You may have to adjust the space allocation or other DD parms in the JCL. The DUMP may fail for a number of reasons. Make sure you are comfortable resolving these problems or involve your system programmer. Tip: If you do not have enough space to hold all dump data sets and the restored DB2 data sets, you may want to submit a SFVTjjnn job, submit the corresponding TEVTjjnn job to restore the DB2 data sets, and then delete the dump data set to free allocated space. In this scenario, you can submit TBSYSLIB when you have restored all DB2 data sets on the target subsystem. 9. Submit TBSYSLIB to copy user-specified source subsystem library data sets to the target subsystem. STEP01 attempts to delete these data sets under the target subsystem VCAT name first. If you want to save certain members or the entire data set, you must do so before you run this job. Verify the return code of STEP02 and STEP03 is RC=0. STEP01 may return RC=8 if a data set to be deleted from the target subsystem did not exist. STEP03 may return RC=4 if a copied library was empty. If you need to copy other data sets that are not included in this job, you can add them manually to this job. In our environment, for example, we had to manually add the data set DB7X7.SDSNEXIT to TBSYSLIB, as shown in Example 5-4 on page 104.
103
104
SAP on DB2 UDB for OS/390 and z/OS: Multiple Components in One Database (MCOD)
Note: This is not relevant in the case of MCOD cloning. 3. Submit TLCHGLOG to update the STARTRBA and ENDRBA values of the BSDS with the highest RBA at the time the source subsystem was stopped (rounded up to the nearest 4 K). Verify that RC=0. 4. Create a temporary ZPARM member that will be used for the initial start of the target DB2 subsystem. Use the original DSNTIJUZ job that compiles (step DSNTIZA) and link edits (step DSNTIZL) the DSNZPARM member of the target DB2 subsystem and change the SYSADM and SYSADM2 values to the user ID of the system administrator performing the cloning. Compile (step DSNTIZP) and link edit (step DSNTIZQ) the DSNHDECP member. Verify that the new DSNZPARM and DSNHDECP members have been compiled and link edited with RC=0 into the SDSNEXIT library of the target subsystem. Important: The source and target DSHDECP members should be identical (apart from SSID). In particular, the source and target values for CCSIDs, SQLDELI, and DECIMAL must be identical. 5. Issue START DB2 PARM(DSNZTEMP) ACCESS(MAINT) to start the target DB2 subsystem in maintenance mode. DSNZTEMP stands for the name of the temporary ZPARM member you created in the previous step. Starting DB2 in maintenance mode prohibits the connection of any authorization IDs other then Install SYSADM and Install SYSOPR. Because DB2 will detect that a cold start is requested, you will be asked to reply Y to continue the DB2 start process. Verify that the target subsystem was started by checking that the following message is printed to the console:
DSN9022I -ssid DSNYASCP 'START DB2' NORMAL COMPLETION
105
Proceed as follows: 1. Submit WBALTSGP to alter the buffer pools on the target subsystem according to the source subsystem and to create a temporary storage group for the cloning process. Verify that RC=0. 2. Submit WCALTUIX (only if SAALTIDX in step 3 returned RC=0) to alter application-defined indexes on the catalog. Verify that RC=0. 3. Submit WEWORKFL to drop and recreate the work file database. Verify that RC=0. 4. Submit WGALTDB2 to alter all DB2 managed tablespaces and indexspaces to use the temporary storage group. Verify that RC=0. 5. Submit WIALTDB2 to drop and create storage groups on the target subsystem using the corresponding target subsystem VCAT names and to grant use of the storage groups to the same user IDs as on the source subsystem. Verify that RC=0. Note: In the case of MCOD cloning, the names of the storage groups created on the target subsystem must match the following naming convention <TSAPSID>XXX (for example, ORABTD in our scenario). Therefore, you must manually update the CREATE statements in the file TVCAT.CLONE.SAALTQRY.OUTDB26 to reflect this requirement. 6. Submit WKALTDB2 to alter all DB2-managed tablespaces and indexspaces to use the original storage group. Verify that RC=0. Note: In the case of MCOD cloning, you must manually update the ALTER statements in the file TVCAT.CLONE.SAALTQRY.OUTDB28 to use the correct storage groups (that is, <TSAPSID>XXX instead of <SSAPSID>XXX). 7. Submit WLALTUSR (only if SAALTUSR in step 3 returned RC=0) to alter user-managed objects to their corresponding target VCAT name. Verify that RC=0. Note: All objects in the catalog, even the ones that were excluded from the cloning process, are altered to a target system VCAT so that when they are dropped by the cleanup job, the data sets in the primary subsystem are not deleted. At this point in the procedure, there must be no source subsystem VCAT in the SYSIBM.SYSTABLEPART, SYSIBM.SYSINDEXPART, and SYSIBM.SYSSTOGROUP catalog tables.
106
SAP on DB2 UDB for OS/390 and z/OS: Multiple Components in One Database (MCOD)
8. Submit WNALTWLM to alter the WLM application environment of stored procedures and user-defined functions on the target subsystem. Verify that RC=0. 9. Submit WSCLNUPT to drop DB2 objects that were temporarily used or excluded from the cloning process. Verify that RC=0. Note: WSCLNUPT only drops the storage groups that refer to an excluded VCAT. Therefore, the storage groups for the SAP system using the primary VCAT are not dropped automatically. It is your responsibility to do so. 10.Submit WTVRFALT to check the DB2 catalog tables for any references to VCAT names from the source subsystem. Verify that no rows are returned. 11.Stop and start the DB2 subsystem with the original ZPARM member. From a DB2 point of view, the system is now successfully copied.
107
108
SAP on DB2 UDB for OS/390 and z/OS: Multiple Components in One Database (MCOD)
Submit SFBLDJjj jobs to generate the SHVTjjnn jobs. Before you submit the dump jobs, make sure that you edit OUTDD1 DDDEF so that the data set is put on tape. Submit the SHVTjjnn jobs in the same sequence as they have been placed into the library. Do not submit them in parallel. Before you run TBSYSLIB, remove the delete step and the restore step. Change the DDDEF for OUTDD1 so that the TVCAT.CLONE.TBSYSLIB.STEP02.DUMP is dumped on tape.
109
The last two commands have a global scope. However, it is your responsibility to issue the command DISPLAY THREAD(*) on all the members of the source data sharing group and verify that there is no outstanding activity. All members of the source data sharing group must be stopped before you can submit SDPRTLOG. You can modify SDPRTLOG, as shown in Example 5-6 on page 111, to take into account the BSDS of all members in the source data sharing group. STEP02 and STEP03 will not work properly in a data sharing environment (DSNACCC6 parses the log map report for RBA instead of LRSN). Therefore, you should remove these steps from the JCL. It is your responsibility to make sure that all the members of the source data sharing group were properly quiesced.
110
SAP on DB2 UDB for OS/390 and z/OS: Multiple Components in One Database (MCOD)
111
You can then modify TLCHGLOG, as shown in Example 5-8, to create the conditional restart control record in the BSDS of the target subsystem.
Example 5-8 Modifying TLCHGLOG in a data sharing environment
... //TLCHGLOG PROC //STEP01 EXEC PGM=IEFBR14 //* //STEP02 EXEC PGM=DSNJU003 //SYSUT1 DD DISP=SHR,DSN=&BSDS1. //SYSUT2 DD DISP=SHR,DSN=&BSDS2. //SYSPRINT DD SYSOUT=* //SYSUDUMP DD SYSOUT=* //SYSIN DD * CRESTART CREATE,STARTRBA=B88780E26000,ENDRBA=B88780E26000,BACKOUT=NO //* //STEP03 EXEC PGM=DSNJU004 //SYSUT1 DD DISP=SHR,DSN=&BSDS1. //SYSPRINT DD SYSOUT=* //SYSUDUMP DD SYSOUT=* // PEND //*--------------------------END OF PROC------------------------------//JOBLIB DD DSN=DB7W7.SDSNLOAD,DISP=SHR //GO EXEC TLCHGLOG, // BSDS1=DB7WU.BSDS01, // BSDS2=DB7WU.BSDS02 //*--------------------------END OF STEP-------------------------------
112
SAP on DB2 UDB for OS/390 and z/OS: Multiple Components in One Database (MCOD)
You must remove these work databases and recreate DSNDB07 (including the associated VSAM data sets as they were dropped in a previous step), as shown in Example 5-9.
Example 5-9 Dropping the source work databases and recreating DSNDB07
//JOBLIB DD DISP=SHR,DSN=DB7W7.SDSNLOAD //DSNTIC PROC //* ***************************************************************** */ //* DIRECTORY/CATALOG AMS INVOCATION INSTREAM JCL PROCEDURE */ //* ***************************************************************** */ //DSNTIC EXEC PGM=IDCAMS //SYSPRINT DD SYSOUT=* //SYSUDUMP DD SYSOUT=* //DSNTIC PEND //* //DSNTIAS EXEC PGM=IKJEFT01,DYNAMNBR=20 //SYSTSPRT DD SYSOUT=* //SYSPRINT DD SYSOUT=* //SYSUDUMP DD SYSOUT=* //SYSTSIN DD * DSN SYSTEM(DB7W) -STOP DATABASE(WKDBD7X1) -STOP DATABASE(WKDBD7X2) RUN PROGRAM(DSNTIAD) PLAN(DSNTIA71) PARM('RC0') LIB('DB7WU.RUNLIB.LOAD') //SYSIN DD * DROP DATABASE WKDBD7X1 ; DROP DATABASE WKDBD7X2 ; /* //DSNTICR EXEC PGM=IKJEFT01,DYNAMNBR=20,COND=(4,LT,DSNTIAS) //SYSTSPRT DD SYSOUT=* //SYSPRINT DD SYSOUT=* //SYSUDUMP DD SYSOUT=* //SYSTSIN DD * DSN SYSTEM(DB7W) RUN PROGRAM(DSNTIAD) PLAN(DSNTIA71) PARM('RC0') LIB('DB7WU.RUNLIB.LOAD') //SYSIN DD * CREATE DATABASE DSNDB07 ; //* //DSNTTMP EXEC DSNTIC,COND=((4,LT,DSNTIAS),(4,LT,DSNTICR)) //SYSIN DD * DEFINE CLUSTER ( NAME(DB7WU.DSNDBC.DSNDB07.DSN4K01.I0001.A001) LINEAR REUSE VOLUMES(DB7W03) CYLINDERS(300 10) -
113
SHAREOPTIONS(3 3) ) DATA ( NAME(DB7WU.DSNDBD.DSNDB07.DSN4K01.I0001.A001) ) CATALOG(DB7WU) DEFINE CLUSTER ( NAME(DB7WU.DSNDBC.DSNDB07.DSN32K01.I0001.A001) LINEAR REUSE VOLUMES(DB7W03) CYLINDERS(30 30) SHAREOPTIONS(3 3) ) DATA ( NAME(DB7WU.DSNDBD.DSNDB07.DSN32K01.I0001.A001) ) CATALOG(DB7WU) //DSNTIST EXEC PGM=IKJEFT01,DYNAMNBR=20, // COND=((4,LT,DSNTIAS),(4,LT,DSNTICR),(4,LT,DSNTTMP.DSNTIC)) //SYSTSPRT DD SYSOUT=* //SYSPRINT DD SYSOUT=* //SYSUDUMP DD SYSOUT=* //SYSTSIN DD * DSN SYSTEM(DB7W) -STOP DATABASE(DSNDB07) RUN PROGRAM(DSNTIAD) PLAN(DSNTIA71) LIB('DB7WU.RUNLIB.LOAD') -START DATABASE(DSNDB07) END //SYSIN DD * CREATE TABLESPACE DSN4K01 IN DSNDB07 BUFFERPOOL BP1 CLOSE NO USING VCAT DB7WU; CREATE TABLESPACE DSN32K01 IN DSNDB07 BUFFERPOOL BP32K1 CLOSE NO USING VCAT DB7WU; //*
114
SAP on DB2 UDB for OS/390 and z/OS: Multiple Components in One Database (MCOD)
Chapter 6.
SAP on IBM DB2 UDB for OS/390 and z/OS: Database Administration Guide, SAP Web Application Server, Release 6.20, SAP document available on the SAP Service Marketplace quick link INSTGUIDES at:
http://service.sap.com/instguides
SAP R/3 on DB2 for OS/390: Database Availability Considerations, SG24-5690 Storage Management for SAP and DB2 UDB: Split Mirror Backup/Recovery with IBMs Enterprise Storage Server (ESS), white paper by Sanjoy Das, Siegfried Schmidt, Jens Claussen, and BalaSanni Godavari, available at:
http://www.storage.ibm.com/hardsoft/products/sap/smdb2.pdf
The most important and current of these documents is SAP on IBM DB2 UDB for OS/390 and z/OS: Database Administration Guide, SAP Web Application Server, Release 6.20. Please note that this document contains information previously
115
found in DB2/390: Backup and Recovery Options, SAP Note 083000 and will contain the most up-to-date information about the topic of backup and recovery. The most challenging issues to be addressed in an SAP on DB2 environment is obtaining points of consistency in a highly active SAP system environment. This challenge stems from both the sheer number of objects in an SAP system and the fact that all database objects must be considered interrelated, and hence, one combined unit of recovery. Making use of the MCOD feature does not change the nature of these challenges. However, it does make one significant change in underlying assumptions: The DB2 subsystem is now no longer necessarily considered a unit of recovery in its own right. Depending on the SAP components contained in the MCOD DB2 subsystem, the correct definition is now that each component is a unit of recovery. As each component is installed with a unique schema, the units of recovery are now the sets of objects created under each schema.
116
SAP on DB2 UDB for OS/390 and z/OS: Multiple Components in One Database (MCOD)
117
In this Consistency Scenario, it is unlikely that there will be a requirement to recover a subset of components. Doing so will violate the requirements for consistency that led to the adoption of an MCOD environment. However, for every rule, there is an exception. In the case where all application owners and the technical staff agree that the best course of action is to recover one or more components to different points in time than the remaining components, then 6.2, Recovery scenarios on page 118 should be followed.
118
SAP on DB2 UDB for OS/390 and z/OS: Multiple Components in One Database (MCOD)
b. Determine the appropriate recovery technique to be used. c. Plan the coordination required for affected parties. d. Perform the recovery actions.
D
DEV1 DEV2 DEV3
B
Error in DEV2
A B C D
: Time where error condition is determined. : First time definitely prior to introduction of error. : Prior time with definite SAP component consistency (QUIESCE). : Prior time with DB2/Volume backup of component.
119
Important: The corrective measures discussed are examples of common causes and possible recovery methods that may be available. Any action taken must be performed with full cooperation of the application owners team.
Point A
This is where the error condition is discovered. This point has no use from a recovery standpoint, because any recovery to this point will result in the error still existing. It does, however, define the point at which other actions may take place. These can include stopping the system to prevent further corruption or stopping users from taking action based on bad data.
Point B
This is the time determined to be the most recent time at which point the error condition did not exist in the system in question. In some circumstances, this can be defined exactly, such as the commencement of a SAP transport causing the error, with exact times available from logs. In other cases, the exact determination of Point B will be harder, for example, where SAP customizing activity over a period of time introduced the error, and the people performing this work are not aware of the exact step that caused the error.
Point C
Once Point B has been determined, either exactly or in the best manner possible, we determine the first point in time before this where a point of consistency exists for all objects in the SAP component. Typically, this will be a QUIESCE point that was obtained during the normal operation of administrative tasks. It is also possible to establish RBA/LRSN points by examining the DB2 log or logs where no units of work are in flight. A suitable tool is usually used for this purpose.
120
SAP on DB2 UDB for OS/390 and z/OS: Multiple Components in One Database (MCOD)
Point D
This is a point in time prior to Points A through C where a full copy of the DB2 subsystem has been made. Typically, most customers will perform this action using DASD subsystem tools acting at the media level, including RVA Snapshot, ESS FlashCopy, or EMC Timefinder. This point may also include an offline backup of DB2, where DB2 was stopped, or all databases are stopped or made read only, and DB2 COPY was used to establish a consistent copy of all data. There is a wide spectrum of times possible based on the exact problem being addressed. In the case of a simple SAP transport caused problem, Points A through D may all lie within a 24 hour, or shorter, period. It is also possible that the issue being addressed is the slow corruption of a development system over a long period of time to the point where it is no longer usable. In this case, the determination of Point B may be difficult, or lie prior to the retention of suitable backups. There are, of course, a wide range of intermediate possibilities between these extremes.
121
Linux 9
G RE (4.6C)
YEL (4.6D)
WHT (6.20)
ICLI Client
ICLI Client
ICLI Client
SC49
DB7X
DB2-SAP Database
DB2-SAP Database
DB2-SAP Database
SAPGRE (c)
DB7XU (a)
SAPW HT (b)
CLONED
Figure 6-2 Prior point in time (PPT) recovery scenario: Initial configuration
122
SAP on DB2 UDB for OS/390 and z/OS: Multiple Components in One Database (MCOD)
123
4. Use the merging techniques (either SAP export/import or merge in place) described in Chapter 3, MCOD installation and merge using SAP tools on page 27 and Chapter 4, Merging SAP components without moving data on page 41.
124
SAP on DB2 UDB for OS/390 and z/OS: Multiple Components in One Database (MCOD)
D B 2 S S ID : P R O D
C o m p o n e n ts n o t a ffe c te d
C o m p o n e n ts re q u irin g re s to re
X
1
D e ter m in e a p p ro p ria te re c ov e ry p o in t to re s olv e e rro r c o n d itio n
D B 2 S S ID : T E M P
C lo n e s y s te m w ith F la s hC o p y o r o th er c lo n in g m e th o d
125
The choice of techniques, such as object-level recovery and conditional restart, in the cloned system is then subject to the requirements of the recovery. For SAP components, SAP on IBM DB2 UDB for OS/390 and z/OS: Database Administration Guide, SAP Web Application Server, Release 6.20 provides guidance and a discussion of the considerations. For non-SAP applications, the same general philosophies discussed in this guide also apply. The merge back into the original DB2 subsystem restores the original configuration with no down time required for the applications residing there aside from any required for the cloning technique employed.
126
SAP on DB2 UDB for OS/390 and z/OS: Multiple Components in One Database (MCOD)
Chapter 7.
DB2/390: Installing saposcol manually, SAP Note 103135 DB2/390: DB Performance Monitor/IFI Data Collector, SAP Note 426863 SAP on IBM DB2 UDB for OS/390 and z/OS: Database Administration Guide, SAP Web Application Server, Release 6.20, SAP document available on the SAP Service Marketplace quick link INSTGUIDES at:
http://service.sap.com/instguides
127
Basis support package DDIC correction CCMS transport disp+work DBSL tp R3trans
SAPKB46C24 SAPK46COSA M5CK000114 4.6D / 1347 4.6D / 1314 4.6D / 1352 4.6D / 1342
SAPKB62015 SAPKB62015 SAPK620OC6 6.20 / 480 6.20 / 424 6.20 / 484 6.20 / 450
128
SAP on DB2 UDB for OS/390 and z/OS: Multiple Components in One Database (MCOD)
2. Bind rfcoscol using transaction DB2 (select Checks/Settings and then SAP Collector Settings). Figure 7-1 shows our input. Figure 7-2 on page 130 lists the resulting output.
129
For more details, refer to the following documents: Chapter 4 in SAP on IBM DB2 UDB for OS/390 and z/OS: Database Administration Guide, SAP Web Application Server, Release 6.20, available at:
http://service.sap.com/instguides
DB2/390: Installing saposcol manually, SAP Note 103135 and DB2/390: DB Performance Monitor/IFI Data Collector, SAP Note 426863
130
SAP on DB2 UDB for OS/390 and z/OS: Multiple Components in One Database (MCOD)
131
4. Call transaction DB13C. 5. Select Test connection to verify that the connection works, as shown in Figure 7-4.
132
SAP on DB2 UDB for OS/390 and z/OS: Multiple Components in One Database (MCOD)
In the following sections, we introduce some of the transactions that now have an MCOD flavor added.
133
Unfortunately, at the time of writing this book, the respective functionality for tablespaces does not yet provide any information about the related SAP component. However, this may change with future CCMS patches.
134
SAP on DB2 UDB for OS/390 and z/OS: Multiple Components in One Database (MCOD)
4. Continue as usual. The log output is shown in Figure 7-9 on page 136.
135
136
SAP on DB2 UDB for OS/390 and z/OS: Multiple Components in One Database (MCOD)
137
138
SAP on DB2 UDB for OS/390 and z/OS: Multiple Components in One Database (MCOD)
Alerts
All alerts within the MCOD landscape (deadlock, time-out, long-running units of recovery, log shortage, and extents) are visible. A sample output of Long-Running URs is depicted in Figure 7-12.
139
Select Detail, and in the output, the related SAP component can be identified by its plan name, as shown in Figure 7-13.
140
SAP on DB2 UDB for OS/390 and z/OS: Multiple Components in One Database (MCOD)
2. Select Statement Cache Statistics. We focus on the two ADMI_RUN tables. The output is shown in Figure 7-14.
141
142
SAP on DB2 UDB for OS/390 and z/OS: Multiple Components in One Database (MCOD)
4. For the second ADMI_RUN table, we obtained the output shown in Figure 7-16. The SAP component can be easily identified. The parameter Unqual tab names displays the associated schema/creator.
143
144
SAP on DB2 UDB for OS/390 and z/OS: Multiple Components in One Database (MCOD)
Appendix A.
Database layout
This appendix covers the following topics: Description of the database layout Historic overview about how the database layout has developed since SAP Release 3.0F Discussion of the rename procedure For additional information, refer to the various release-dependent database administration guides: BC SAP Database Administration Guides: DB2 for OS/390 SAP Release 3.1I: material number 51002788 SAP Release 4.0B: material number 51002661 SAP Release 4.5B: material number 51006377 SAP Release 4.6C: material number 51009638 SAP Releases 6.10/6.20: SAP on IBM DB2 UDB for OS/390 and z/OS: Database Administration Guide, SAP Web Application Server, Release 6.20, available on the SAP Service Marketplace quick link INSTGUIDES at:
http://service.sap.com/instguides
145
Overview
Following is a short overview about how the database layout has developed since SAP Release 3.0F (when DB2/390 was first supported). The overview serves the following purposes: To better understand the enhancements, described in 1.2.2, DB2-specific modifications on page 5 To handle the merge of historically grown systems In the case of systems with mixed layouts, the rename procedure described in Chapter 4, Merging SAP components without moving data on page 41 may be modified to clean up the layout mixture. Possible solutions are discussed in Rename procedure on page 150.
General remarks
We do not describe the SAP technical settings (data class, buffering, and size category) here. For this and for a more detailed description of the database layout, refer to the administration guides listed in Related publications on page 269. Table A-1 may serve as an useful reference in the following release-dependent sections (<NN> = two-digit number; <SID> = SAP System ID; the other two patterns <SB> and <ABC> are described as follows).
Table A-1 Comparison of database and stogroup names for SAP releases
3.0F, 3.1H, 3.1I, 4.0B Data class Data stogroup Database 4.6C/D, 6.10, 6.20 Data stogroup Database
146
SAP on DB2 UDB for OS/390 and z/OS: Multiple Components in One Database (MCOD)
147
Number of database objects In a 4.0B R/3 system, there are approximately 400 databases and tablespaces, 800 stogroups, 13,000 tables, 3,000 views, and 15,000 indexes. Slightly more than 200 tables are located in a single-table tablespace.
Where the parameters have the following meaning: <STORID> = SAP data class identified by two characters <SB> = Two digits that represent: SAP size category (1 digit: 0, 1, 2, 3, and so on) SAP buffering on application server (1 digit: 0 - no buffering, 1 - full buffering, 2 - generic buffering, 3 - single record buffering)
<ABC> = Three random characters There is a placeholder (#) for future developments (for SAP Basis Release 4.6B and later, the placeholder becomes X). Typical database names are A001#B35, CL10#Y94, and DI22#2H3. Multi-table tablespaces All tables that are SAP buffered on the application server are placed into multi-table tablespaces. The name #SAP is assigned to this type of tablespace (for SAP Basis Release 4.6B and later the default name XSAP is used). Single-table tablespaces Tables that are not SAP buffered are put into a single-tablespace. The name of the tablespace is derived from the tables name. Stogroups There is a fixed number of stogroups defined for an SAP component. They are closely related to the data class. The relation is specified in tables TADB2 and IADB2 for data and index stogroups, respectively.
148
SAP on DB2 UDB for OS/390 and z/OS: Multiple Components in One Database (MCOD)
Number of database objects In a 4.5B R/3 system, we have approximately 16,000 tables, 19,000 indexes, and 4,000 views. These objects are stored in 32 stogroups, 7,400 databases, 200 multi-table tablespaces, and 7,200 single-table tablespaces.
149
Number of database objects For a newly installed SAP Enterprise 4.7 system (which is based on SAP Basis Release 6.20), the number of databases drops to around 1,000 (from 12,000 with R/3 4.6C SR2). There are approximately 33,000 tables and 5,700 views.
Rename procedure
When merging SAP components, we need to ensure the uniqueness of database and stogroup names. It is very likely that database names of SAP installations in different subsystems (that is, two non-MCOD installations) use identical names for the databases.
General procedure
In theory, the naming conflicts could be resolved manually: 1. Create a list of all databases in the source subsystem. 2. For each database name, find out whether it already exists in the target subsystem. 3. Determine a new unique database name if necessary. In reality, this approach is not feasible. SAP components typically contain several thousands of databases and resolving the naming conflicts manually would take several days if not weeks. Therefore, we use an algorithm in this book (see Chapter 4, Merging SAP components without moving data on page 41) that automatically resolves the naming conflicts: The first three characters of the stogroup names are substituted by the SAP System ID. Database naming conflicts are removed by replacing the last three characters by random characters.
Mixed layouts
In our case (4.6C/D and 6.20 systems), the rename procedure is perfect. The algorithm also works (more or less) for mixed layouts (for example, 4.0B and 4.6C). However, the new names created from 4.0B and earlier database objects are a little bit awkward. For example: Database name STAB01 may become STAZ83 or STAB0Z83 (in case of a naming conflict). Stogroup name DSTAB01 transfers to PRDAB01 (with SAP System ID PRD).
150
SAP on DB2 UDB for OS/390 and z/OS: Multiple Components in One Database (MCOD)
One should take the opportunity to adjust the 4.0B database objects to a more 4.6x/6.x like database layout. This can be done by modifying the entries of the metadata tables described in Appendix B, Merge in place: Working with metadata tables on page 153. Here are some suggestions: Apply new stogroup names, for example, map DSTAB01, DSTAB02, and DSTAB03 to <SID>STD and ISTAB01, ISTAB02, and so on to <SID>STI. The relation can be retrieved from Table A-1 on page 146. Similarly, the database names can be renamed (for example, STAB01 to A000XABC, DDDIC02 to DI00XCDE). For tables in single-table tablespaces, the handling is more difficult because the data class cannot be retrieved directly from the names of the database and tablespace. Instead, you may use ABAP function module DD_GET_STORAGE_CLASS in a little self-written ABAP program to determine the setting and store it in an additional metadata table.
151
152
SAP on DB2 UDB for OS/390 and z/OS: Multiple Components in One Database (MCOD)
Appendix B.
153
154
SAP on DB2 UDB for OS/390 and z/OS: Multiple Components in One Database (MCOD)
FREEPAGE 10 PCTFREE 10 GBPCACHE CHANGED BUFFERPOOL BP3 PIECESIZE 2097152 K CLUSTER ; ALTER TABLE "ZMCOD_STOGROUP" ADD PRIMARY KEY ("SRCSTOGROUP", "SRCVCAT") ;
155
156
SAP on DB2 UDB for OS/390 and z/OS: Multiple Components in One Database (MCOD)
157
158
SAP on DB2 UDB for OS/390 and z/OS: Multiple Components in One Database (MCOD)
SETUPSTG
In Example B-7, we provide the REXX procedure used to populate the metadata table ZMCOD_STOGROUP.
Example: B-7 REXX to populate ZMCOD_STOGROUP
/*******************************************************************/ /* DB2 INITIALISATION - Populate MCOD Stogroup Table */ /* VERBOSE - Print all SQL Return codes */ /* PREDELETE - Delete table contents prior to run, allow reruns */ /*******************************************************************/ PARSE ARG SRCSSID SRCSCHEMA SRCVERSION, TRGSSID TRGSCHEMA TRGVERSION, TRGVCAT TRGSTOGRPPRE VERBOSE = N PREDELETE = Y /* Add DSNREXX to the host command environment table if not there. */ 'SUBCOM DSNREXX' IF RC THEN , S_RC = RXSUBCOM('ADD','DSNREXX','DSNREXX') ADDRESS DSNREXX /*******************************************************************/ /* Connect to DB2 */ /*******************************************************************/ 'CONNECT' 'DB7S' /*******************************************************************/ /* Initialize hardcoded variable values */ /*******************************************************************/ /* TRGVCAT = "MCDBLU" TRGSTOGRPPRE = "BLU" */ /*******************************************************************/ 00010004 00020004 00021004 00022004 00030004 00031003 00031212 00031312 00031512 00032011 00033015 00040015 00041003 00050000 00051000 00052000 00053000 00054000 00055000 00056000 00057004 00057104 00057204 00057304 00058013 00060004 00070004 00080004 00081004 00082008 00090006 00100006 00122508 00122704
159
/* For rerunning this procedure, to prevent duplicates, set flag */ /* PREDELETE to delete table contents before populating table */ /*******************************************************************/
00122804 00122904 00123004 00123204 IF PREDELETE = Y THEN DO 00123303 "EXECSQL DELETE FROM "SRCSCHEMA".ZMCOD_STOGROUP" 00123407 Say "SQL from delete is "SQLCODE 00123504 END 00123604 00123704 /*******************************************************************/ 00123804 /* Setup Fetch SQL statement, declare cursor, prepare statement */ 00123904 /* This cursor remains open and loops through SYSSTOGROUP rows */ 00124004 /*******************************************************************/ 00124104 00124204 SQLSTMT = "SELECT NAME, ", 00124300 "VCATNAME ", 00124400 " FROM SYSIBM.SYSSTOGROUP ", 00124500 " WHERE CREATOR = '"SRCSCHEMA"'" 00124608 "EXECSQL DECLARE C1 CURSOR FOR S1" 00124700 "EXECSQL PREPARE S1 INTO :OUTREC FROM :SQLSTMT" 00124800 IF VERBOSE = Y THEN 00124903 SAY "SQLCODE from Select PREPARE is "SQLCODE 00125004 00126004 /*******************************************************************/ 00127004 /* Setup and PREPARE INSERT statement for ZMCOD_STOGROUP */ 00127104 /*******************************************************************/ 00127304 00127404 ISRT_STMT = "INSERT INTO "SRCSCHEMA".ZMCOD_STOGROUP (", 00128007 "SRCSTOGROUP, ", 00129001 "SRCVCAT, ", 00130000 "TRGSTOGROUP, ", 00131000 "TRGVCAT ", 00132000 ") ", 00160000 "VALUES (?,?,?,?)" 00170000 "EXECSQL PREPARE S2 FROM :ISRT_STMT" 00180000 IF VERBOSE = Y THEN 00181003 SAY "SQLCODE from Insert PREPARE is "SQLCODE 00190004 00193000 /***************************************************************/ 00194000 /* Open Cursors for Fetch */ 00195000 "EXECSQL OPEN C1" 00196000 IF VERBOSE = Y THEN 00196103 SAY "SQLCODE from Select OPEN is "SQLCODE 00197004 00198004 /*******************************************************************/ 00199004 /* Open Cursor for reading through SYSSTOGROUP and fetch */ 00199104 /* the first row. */ 00199204 /*******************************************************************/ 00199304 00199404
160
SAP on DB2 UDB for OS/390 and z/OS: Multiple Components in One Database (MCOD)
"EXECSQL FETCH C1 USING DESCRIPTOR :OUTREC " IF VERBOSE = Y THEN SAY "SQLCODE from select FETCH is "SQLCODE /*******************************************************************/ /* Set loop counter and loop while rows are found */ /*******************************************************************/ loopctr = 1 DO WHILE SQLCODE = 0 /*******************************************************************/ /* Setup variables from SYSSTOGROUP fetch for inserting, */ /* including replacing the first 3 chars of the STOGROUP name. */ /*******************************************************************/ SRCSTOGROUP = OUTREC.1.SQLDATA TRGSTOGROUP = TRGSTOGRPPRE||substr(OUTREC.1.SQLDATA,4,3) SRCVCAT = OUTREC.2.SQLDATA /*******************************************************************/ /* Execute insert statement, and check RC */ /*******************************************************************/ "EXECSQL EXECUTE S2 USING ", ":SRCSTOGROUP, ", ":SRCVCAT, ", ":TRGSTOGROUP, ", ":TRGVCAT " IF VERBOSE = Y THEN SAY "SQLCODE from Insert is "SQLCODE /*******************************************************************/ /* Fetch next SYSTABLESPACE record, increment counter */ /*******************************************************************/ "EXECSQL FETCH C1 USING DESCRIPTOR :OUTREC " IF VERBOSE = Y THEN SAY "SQLCODE from FETCH is "SQLCODE loopctr=loopctr+1 END /*******************************************************************/ /* Close main cursor and exit */ /*******************************************************************/ SAY "----------------------------------"
00200000 00201003 00210004 00220004 00230004 00231004 00232004 00233004 00240001 00250000 00260004 00261004 00262004 00263004 00264004 00265004 00270000 00271001 00280000 00290004 00300004 00310004 00320004 00330004 00373000 00374000 00375000 00376000 00379700 00379803 00379904 00381000 00381204 00381304 00381404 00381504 00382400 00382503 00382604 00382704 00382804 00382900 00383000 00383100 00383304 00383404 00383504 00383604 00383703
161
SAY "Total stogroups processed "loopctr SAY "----------------------------------" "EXECSQL CLOSE C1" SAY"SQLCODE from CLOSE is "SQLCODE S_RC = RXSUBCOM('DELETE','DSNREXX','DSNREXX')
SETUPDB
In Example B-8, we provide the REXX procedure used to populate the metadata table ZMCOD_DATABASE.
Example: B-8 REXX to populate ZMCOD_DATABASE
/*******************************************************************/ /* DB2 INITIALISATION - Populate MCOD Database Table */ /* VERBOSE - Print all SQL Return codes */ /* PREDELETE - Delete table contents prior to run, allow reruns */ /*******************************************************************/ /*******************************************************************/ /* */ /* Initialize variables passed to program */ /* Name Description */ /* SRCSSID Source DB2 Subsystem ID */ /* SRCSCHEMA Source DB2 Owner of SAP Objects */ /* SRCRELEASE Source DB2 Version Number */ /* TRGSSID Target DB2 Subsystem ID */ /* TRGSCHEMA Target DB2 Owner of SAP Objects */ /* TRGRELEASE Target DB2 Version Number */ /* TRGVCAT Target DB2 VCAT name */ /* TRGSTOGRPPRE Target DB2 Storage Group Prefix (1st 3 Characters)*/ /* */ /*******************************************************************/ PARSE ARG SRCSSID SRCSCHEMA SRCRELEASE, TRGSSID TRGSCHEMA TRGRELEASE, TRGVCAT TRGSTOGRPPRE VERBOSE = N PREDELETE = Y /* Add DSNREXX to the host command environment table if not there. */ 'SUBCOM DSNREXX' IF RC THEN , S_RC = RXSUBCOM('ADD','DSNREXX','DSNREXX') ADDRESS DSNREXX 00010014 00020014 00030014 00040014 00040114 00040220 00040422 00040522 00040622 00040722 00040822 00040922 00041022 00041122 00041222 00041322 00041422 00041522 00041622 00041722 00041822 00041922 00042022 00042122 00042222 00042325 00042422 00043022 00050000 00051009 00060000 00070000 00080000 00090000 00100014
162
SAP on DB2 UDB for OS/390 and z/OS: Multiple Components in One Database (MCOD)
00101014 00102014 00103014 00104014 'CONNECT' SRCSSID 00110018 /* trace i */ 00120008 00120114 /*******************************************************************/ 00125314 /* For rerunning this procedure, to prevent duplicates, set flag */ 00125414 /* PREDELETE to delete table contents before populating table */ 00125514 /*******************************************************************/ 00125614 00125714 IF PREDELETE = Y THEN DO 00126113 "EXECSQL DELETE FROM "SRCSCHEMA".ZMCOD_DATABASE" 00127018 Say "SQL from delete is "SQLCODE 00128013 END 00129013 00130014 /*******************************************************************/ 00140014 /* Setup Fetch SQL statement, declare cursor, prepare statement */ 00141014 /* This cursor remains open and loops through SYSDATABASE rows */ 00142014 /*******************************************************************/ 00143014 00144014 SQLSTMT = "SELECT NAME, STGROUP, CREATOR ", 00150008 " FROM SYSIBM.SYSDATABASE ", 00160008 " WHERE CREATOR = '"SRCSCHEMA"' " 00170018 "EXECSQL DECLARE C1 CURSOR FOR S1" 00190002 "EXECSQL PREPARE S1 INTO :OUTREC FROM :SQLSTMT" 00200006 IF (VERBOSE = Y) | (SQLCODE <> 0) THEN 00201024 SAY "SQLCODE from Select PREPARE is "SQLCODE 00210014 00211014 /*******************************************************************/ 00212014 /* Setup and PREPARE INSERT statement for ZMCOD_DATABASE */ 00213014 /*******************************************************************/ 00214014 00215014 ISRT_STMT = " INSERT INTO "SRCSCHEMA".ZMCOD_DATABASE ", 00220018 "(SRCSSID, SRCRELEASE, SRCDBNAME, ", 00221008 "SRCSCHEMA, SRCSTOGROUP, ", 00221108 "TRGSSID, TRGRELEASE, TRGDBNAME, ", 00221208 "TRGSCHEMA, TRGSTOGROUP) ", 00221308 "VALUES (?,?,?,?,?,?,?,?,?,?)" 00223008 "EXECSQL PREPARE S2 FROM :ISRT_STMT" 00225008 IF (VERBOSE = Y) | (SQLCODE <> 0) THEN 00225124 SAY "SQLCODE from Insert PREPARE is "SQLCODE 00226014 00227014 /*******************************************************************/ 00228014 /* Open Cursor for reading through SYSDATADASE and fetch */ 00229014 /* the first row. */ 00230014 /*******************************************************************/ 00240014 00241014
163
"EXECSQL OPEN C1" IF (VERBOSE = Y) | (SQLCODE <> 0) THEN SAY "SQLCODE from Select OPEN is "SQLCODE "EXECSQL FETCH C1 USING DESCRIPTOR :OUTREC " IF (VERBOSE = Y) | (SQLCODE <> 0) THEN SAY "SQLCODE from select FETCH is "SQLCODE /*******************************************************************/ /* Set loop counter and loop while rows are found */ /*******************************************************************/ loopctr = 0 DO WHILE SQLCODE = 0 /*******************************************************************/ /* Setup variables from SYSDATABASE fetch for inserting, */ /* including replacing the first 3 chars of the STOGROUP name. */ /*******************************************************************/ SRCDBNAME = OUTREC.1.SQLDATA SRCSTOGROUP = OUTREC.2.SQLDATA SRCSCHEMA = OUTREC.3.SQLDATA TRGDBNAME = OUTREC.1.SQLDATA IF LENGTH(STRIP(OUTREC.2.SQLDATA)) = 6 THEN TRGSTOGROUP = TRGSTOGRPPRE||substr(OUTREC.2.SQLDATA,4,3) ELSE TRGSTOGROUP = OUTREC.2.SQLDATA /*******************************************************************/ /* Execute insert statement, and check RC */ /*******************************************************************/ "EXECSQL EXECUTE S2 USING ", ":SRCSSID, :SRCRELEASE, :SRCDBNAME, ", ":SRCSCHEMA, :SRCSTOGROUP, ", ":TRGSSID, :TRGRELEASE, :TRGDBNAME, ", ":TRGVCAT, :TRGSTOGROUP " IF (VERBOSE = Y) | (SQLCODE <> 0) THEN SAY "SQLCODE from Insert is "SQLCODE /*******************************************************************/ /* Fetch next SYSDATABASE record, increment counter */ /*******************************************************************/ "EXECSQL FETCH C1 USING DESCRIPTOR :OUTREC " IF (VERBOSE = Y) | (SQLCODE <> 0) THEN SAY "SQLCODE from FETCH is "SQLCODE loopctr=loopctr+1
00250000 00251024 00260014 00300006 00301024 00310014 00320014 00330014 00331014 00332014 00333014 00340000 00350000 00360014 00361014 00361114 00361214 00361314 00361414 00362008 00363008 00364008 00365008 00365223 00366022 00366122 00366222 00367014 00368014 00369014 00370014 00380014 00384308 00384408 00384508 00384608 00384721 00384824 00384914 00385014 00386014 00387014 00388014 00389014 00441007 00442024 00460014 00470000 00471014
164
SAP on DB2 UDB for OS/390 and z/OS: Multiple Components in One Database (MCOD)
END /*******************************************************************/ /* Close main cursor and exit */ /*******************************************************************/ SAY "----------------------------------" SAY "Total databases processed "loopctr SAY "----------------------------------" "EXECSQL CLOSE C1" SAY"SQLCODE from CLOSE is "SQLCODE S_RC = RXSUBCOM('DELETE','DSNREXX','DSNREXX')
00472014 00472114 00472214 00473014 00474014 00475014 00476014 00481013 00482013 00490013 00510000 00520000 00530000
SETUPTS
In Example B-9, we provide the REXX procedure used to populate the metadata table ZMCOD_TABLESPACE.
Example: B-9 REXX to populate ZMCOD_TABLESPACE
/*******************************************************************/ /* DB2 INITIALISATION - Populate MCOD Tablespace Table */ /* VERBOSE - Print all SQL Return codes */ /* PREDELETE - Delete table contents prior to run, allow reruns */ /*******************************************************************/ VERBOSE = N PREDELETE = Y /*******************************************************************/ /* */ /* Initialize variables passed to program */ /* Name Description */ /* SRCSSID Source DB2 Subsystem ID */ /* SRCSCHEMA Source DB2 Owner of SAP Objects */ /* SRCRELEASE Source DB2 Version Number */ /* TRGSSID Target DB2 Subsystem ID */ /* TRGSCHEMA Target DB2 Owner of SAP Objects */ /* TRGRELEASE Target DB2 Version Number */ /* TRGVCAT Target DB2 VCAT name */ /* TRGSTOGRPPRE Target DB2 Storage Group Prefix (1st 3 Characters)*/ /* */ /*******************************************************************/ PARSE ARG SRCSSID SRCSCHEMA SRCRELEASE, TRGSSID TRGSCHEMA TRGRELEASE, TRGVCAT TRGSTOGRPPRE 00010010 00020010 00021010 00022010 00030010 00031024 00031125 00031225 00031325 00031425 00031525 00031625 00031725 00031825 00031925 00032025 00032125 00032225 00032325 00032425 00032525 00032625 00032725 00032825 00032922 00033022 00033122
165
00033222 00033325 00050000 00051025 00060000 'SUBCOM DSNREXX' 00070000 IF RC THEN , 00080000 S_RC = RXSUBCOM('ADD','DSNREXX','DSNREXX') 00090000 ADDRESS DSNREXX 00100000 00110000 /*******************************************************************/ 00120006 /* Connect to DB2 */ 00130006 /*******************************************************************/ 00140006 00150006 'CONNECT' SRCSSID 00160022 /* trace i */ 00170006 00180006 /*******************************************************************/ 00190006 /* Initialize hardcoded variable values */ 00200006 /*******************************************************************/ 00210006 /* 00220022 SRCSSID = "DB7S" 00230000 SRCRELEASE = "710" 00240002 TRGSSID = "DB7T" 00250000 TRGRELEASE = "710" 00260002 TRGSCHEMA = "SAPBLU" 00270021 TRGSTOGRPPRE = "BLU" 00280021 TRGVCAT = "MCDBLU" 00290021 */ 00320022 /*******************************************************************/ 00320110 /* For rerunning this procedure, to prevent duplicates, set flag */ 00320210 /* PREDELETE to delete table contents before populating table */ 00320310 /*******************************************************************/ 00320410 00321010 IF PREDELETE = Y THEN DO 00330008 "EXECSQL DELETE FROM "SRCSCHEMA".ZMCOD_TABLESPACE" 00340022 Say "SQL from delete is "SQLCODE 00350008 END 00360008 00380006 /*******************************************************************/ 00390006 /* Setup Fetch SQL statement, declare cursor, prepare statement */ 00400006 /* This cursor remains open and loops through SYSTABLESPACE rows */ 00410010 /*******************************************************************/ 00420006 00430006 SQLSTMT = "SELECT ", 00440000 "TS.NAME, ", 00450006 "TS.CREATOR, ", 00460006 "TS.DBNAME, ", 00470006 "TS.DBID, ", 00480006 /*******************************************************************/ /* Add DSNREXX to the host command environment table if not there. */ /*******************************************************************/
166
SAP on DB2 UDB for OS/390 and z/OS: Multiple Components in One Database (MCOD)
"TS.PSID, ", 00490006 "TSP.STORNAME, ", 00500006 "TSP.VCATNAME, ", 00510006 "TSP.IPREFIX, ", 00520006 "TSP.SPACE, ", 00530009 "TSP.PARTITION ", 00531009 " FROM SYSIBM.SYSTABLESPACE TS JOIN SYSIBM.SYSTABLEPART TSP", 00540002 " ON TS.NAME = TSP.TSNAME AND TS.DBNAME = TSP.DBNAME ", 00550002 " WHERE TS.CREATOR = '"SRCSCHEMA"'" 00560022 "EXECSQL DECLARE C1 CURSOR FOR S1" 00570002 "EXECSQL PREPARE S1 INTO :OUTREC FROM :SQLSTMT" 00580002 IF (VERBOSE = Y) | (SQLCODE <> 0) THEN 00581026 SAY "SQLCODE from S1 PREPARE is "SQLCODE 00590010 00600000 /*******************************************************************/ 00610006 /* Open Cursor for reading through SYSTABLESPACE and fetch */ 00620006 /* the first row. */ 00630006 /*******************************************************************/ 00640006 00650006 "EXECSQL OPEN C1" 00660000 IF (VERBOSE = Y) | (SQLCODE <> 0) THEN 00661026 SAY "SQLCODE from MAINLOOP FETCH OPEN is "SQLCODE 00670011 "EXECSQL FETCH C1 USING DESCRIPTOR :OUTREC " 00680000 IF (VERBOSE = Y) | (SQLCODE <> 0) THEN 00681026 SAY "SQLCODE from MAINLOOP FETCH is "SQLCODE 00690011 00700000 /*******************************************************************/ 00710006 /* Set loop counter and loop while rows are found */ 00720006 /*******************************************************************/ 00730006 00740006 loopctr = 0 00750011 DO WHILE SQLCODE = 0 00760000 00770000 /*******************************************************************/ 00780006 /* Setup variables from SYSTABLESPACE fetch for inserting, */ 00790006 /* including replacing the first 3 chars of the STOGROUP name. */ 00800010 /*******************************************************************/ 00810006 00820006 SRCTSNAME = OUTREC.1.SQLDATA 00830006 TRGTSNAME = OUTREC.1.SQLDATA 00840006 SRCSCHEMA = OUTREC.2.SQLDATA 00850006 SRCDBNAME = OUTREC.3.SQLDATA 00860006 TRGDBNAME = OUTREC.3.SQLDATA 00870006 SRCDBID = OUTREC.4.SQLDATA 00880006 TRGDBID = OUTREC.4.SQLDATA 00890006 SRCPSID = OUTREC.5.SQLDATA 00900006 TRGPSID = OUTREC.5.SQLDATA 00910006 SRCSTOGROUP = OUTREC.6.SQLDATA 00920006 TRGSTOGROUP = TRGSTOGRPPRE||substr(OUTREC.6.SQLDATA,4,3) 00930006
167
= = = = =
/*******************************************************************/ /* Setup insert statement string */ /*******************************************************************/ INSERTSQL = "INSERT INTO "SRCSCHEMA".ZMCOD_TABLESPACE (", ||"SRCTSNAME,", ||"SRCSSID,", ||"SRCDBNAME,", ||"SRCDBID,", ||"SRCRELEASE,", ||"SRCIPREFIX,", ||"SRCPSID,", ||"SRCSCHEMA,", ||"SRCSTOGROUP,", ||"SRCVCAT,", ||"SRCSPACE,", ||"SRCPART,", ||"TRGTSNAME,", ||"TRGSSID,", ||"TRGRELEASE,", ||"TRGDBID,", ||"TRGDBNAME,", ||"TRGIPREFIX,", ||"TRGPSID,", ||"TRGSCHEMA,", ||"TRGSTOGROUP,", ||"TRGVCAT", ||") ", " VALUES('"SRCTSNAME"','", ||SRCSSID"','", ||SRCDBNAME"','", ||SRCDBID"','", ||SRCRELEASE"','", ||SRCIPREFIX"',", ||SRCPSID",'", ||SRCSCHEMA"','", ||SRCSTOGROUP"','", ||SRCVCAT"',", ||SRCSPACE",", ||SRCPART",'", ||TRGTSNAME"','", ||TRGSSID"','", ||TRGRELEASE"','",
00940006 00950006 00960006 00970006 00971009 00980005 00990006 01000006 01010006 01020006 01030022 01040002 01050002 01060002 01070002 01080002 01090002 01100002 01110002 01120002 01130002 01140005 01141009 01150005 01160005 01170005 01180005 01190005 01200005 01210005 01220005 01230005 01240005 01250005 01260005 01270005 01280005 01290005 01300005 01310005 01320005 01330005 01340005 01350005 01360009 01361009 01370005 01380005 01390005
168
SAP on DB2 UDB for OS/390 and z/OS: Multiple Components in One Database (MCOD)
||TRGDBID"','", ||TRGDBNAME"','", ||TRGIPREFIX"',", ||TRGPSID",'", ||TRGSCHEMA"','", ||TRGSTOGROUP"','", ||TRGVCAT"') " /*******************************************************************/ /* Execute insert statement, and check RC */ /*******************************************************************/ "EXECSQL "INSERTSQL IF (VERBOSE = Y) | (SQLCODE <> 0) THEN SAY "SQLCODE from INSERT is "SQLCODE SQLERRMC SQLERRP /*******************************************************************/ /* Fetch next SYSTABLESPACE record, increment counter */ /*******************************************************************/ "EXECSQL FETCH C1 USING DESCRIPTOR :OUTREC " IF (VERBOSE = Y) | (SQLCODE <> 0) THEN SAY "SQLCODE from FETCH is "SQLCODE loopctr=loopctr+1 END /*******************************************************************/ /* Close main cursor and exit */ /*******************************************************************/ SAY "----------------------------------" SAY "Total tablespaces processed "loopctr SAY "----------------------------------" "EXECSQL CLOSE C1" SAY"SQLCODE from CLOSE is "SQLCODE S_RC = RXSUBCOM('DELETE','DSNREXX','DSNREXX')
01400005 01410005 01420005 01430005 01440005 01450005 01460005 01470006 01480006 01490010 01500006 01510006 01520018 01521026 01522016 01523018 01524010 01525010 01526010 01527010 01560006 01561026 01570010 01570108 01571008 01580006 01590006 01600006 01610006 01620006 01630006 01640006 01650006 01660006 01670006 01680006 01690006 01700006
169
SETUPTAB
In Example B-10, we provide the REXX procedure used to populate the metadata table ZMCOD_TABLES.
Example: B-10 REXX to populate ZMCOD_TABLES
/***************************************************************/ /* DB2 INITIALISATION - Populate MCOD Tables Table */ /***************************************************************/ VERBOSE = N PREDELETE = Y /*******************************************************************/ /* Initialize variables passed to program */ /* Name Description */ /* SRCSSID Source DB2 Subsystem ID */ /* SRCSCHEMA Source DB2 Owner of SAP Objects */ /* SRCRELEASE Source DB2 Version Number */ /* TRGSSID Target DB2 Subsystem ID */ /* TRGSCHEMA Target DB2 Owner of SAP Objects */ /* TRGRELEASE Target DB2 Version Number */ /* TRGVCAT Target DB2 VCAT name */ /* TRGSTOGRPPRE Target DB2 Storage Group Prefix (1st 3 Characters)*/ /* */ /*******************************************************************/ PARSE ARG SRCSSID SRCSCHEMA SRCRELEASE, TRGSSID TRGSCHEMA TRGRELEASE, TRGVCAT TRGSTOGRPPRE /*******************************************************************/ /* Add DSNREXX to the host command environment table if not there. */ /*******************************************************************/ 'SUBCOM DSNREXX' IF RC THEN , S_RC = RXSUBCOM('ADD','DSNREXX','DSNREXX') ADDRESS DSNREXX /*Connect to DB2 */ 'CONNECT' SRCSSID /* trace i */ /* Initialize Variables SRCSSID = "DB7S" SRCRELEASE = "710" TRGSSID = "DB7T" 00010000 00020000 00030000 00040000 00040112 00040212 00040312 00040412 00040612 00040712 00040812 00040912 00041012 00041112 00041212 00041312 00041412 00041512 00041612 00041712 00041812 00041909 00042009 00042109 00042209 00042312 00050000 00051012 00060000 00070000 00080000 00090000 00100000 00110000 00120000 00130009 00140000 00150000 00160009 00170000 00180004 00190000
170
SAP on DB2 UDB for OS/390 and z/OS: Multiple Components in One Database (MCOD)
TRGRELEASE = "710" TRGSCHEMA = "SAPBLU" */ IF PREDELETE = 'Y' THEN DO "EXECSQL DELETE FROM "SRCSCHEMA".ZMCOD_TABLES" Say "SQL from delete is "SQLCODE END /* Setup Fetch SQL statement, declare cursor, prepare statement */ SQLSTMT = "SELECT CREATOR,", "NAME,", "DBNAME,", "TSNAME,", "OBID", " FROM SYSIBM.SYSTABLES ", " WHERE CREATOR = '"SRCSCHEMA"' AND TYPE = 'T'" "EXECSQL DECLARE C1 CURSOR FOR S1" "EXECSQL PREPARE S1 INTO :OUTREC FROM :SQLSTMT" IF VERBOSE = Y THEN SAY "SQLCODE from Select PREPARE is "SQLCODE /***************************************************************/ /* Open Cursors for Fetch */ "EXECSQL OPEN C1" IF VERBOSE = Y THEN SAY "SQLCODE from Select OPEN is "SQLCODE /* Fetch the first record into host vars */ "EXECSQL FETCH C1 USING DESCRIPTOR :OUTREC " IF VERBOSE = Y THEN SAY "SQLCODE from select FETCH is "SQLCODE /* While the fetches are OK, continue to loop */ loopctr = 0 DO WHILE SQLCODE = 0 SRCSCHEMA SRCTABLE TRGTABLE SRCDBNAME TRGDBNAME SRCTSNAME TRGTSNAME SRCTABOBID TRGTABOBID = = = = = = = = = OUTREC.1.SQLDATA OUTREC.2.SQLDATA OUTREC.2.SQLDATA OUTREC.3.SQLDATA OUTREC.3.SQLDATA OUTREC.4.SQLDATA OUTREC.4.SQLDATA OUTREC.5.SQLDATA OUTREC.5.SQLDATA
00200004 00202004 00210009 00211007 00212009 00213007 00213107 00214006 00220000 00230004 00240004 00250004 00260004 00270004 00280000 00290009 00300000 00310000 00311007 00320008 00330000 00340000 00350000 00360000 00361007 00370008 00380000 00390000 00400000 00401007 00410008 00430000 00440000 00450000 00460004 00470004 00480004 00490004 00500004 00510004 00520004 00530004 00540004 00550004 00560000 00570009 00580004 00590004 00600004
171
||"SRCSSID,", ||"SRCRELEASE,", ||"SRCTABOBID,", ||"SRCTSNAME,", ||"TRGSCHEMA,", ||"TRGSSID,", ||"TRGRELEASE,", ||"TRGDBNAME,", ||"TRGTABOBID,", ||"TRGTSNAME", ||") ", " VALUES('"SRCSCHEMA"','", ||SRCTABLE"','", ||SRCDBNAME"','", ||SRCSSID"','", ||SRCRELEASE"','", ||SRCTABOBID"','", ||SRCTSNAME"','", ||TRGSCHEMA"','", ||TRGSSID"','", ||TRGRELEASE"','", ||TRGDBNAME"','", ||TRGTABOBID"','", ||TRGTSNAME"') " "EXECSQL "INSERTSQL IF VERBOSE = Y THEN SAY loopctr "INSERTSQL is "SQLCODE loopctr=loopctr+1 "EXECSQL FETCH C1 USING DESCRIPTOR :OUTREC " IF VERBOSE = Y THEN SAY "SQLCODE from FETCH is "SQLCODE END SAY "----------------------------------" SAY "Total tables processed "loopctr SAY "----------------------------------" /* Close Cursor */ "EXECSQL CLOSE C1" SAY"SQLCODE from CLOSE is "SQLCODE S_RC = RXSUBCOM('DELETE','DSNREXX','DSNREXX')
00610004 00620004 00630004 00640004 00650004 00660004 00670004 00680004 00690004 00700004 00710004 00720004 00721004 00730004 00750004 00760004 00770004 00780004 00790004 00800004 00810004 00820004 00830004 00840004 00841004 00842004 00843007 00850008 00910011 00950000 00951007 00960008 00970000 00980000 00981007 00982007 00990007 01000000 01010000 01020000 01030000
172
SAP on DB2 UDB for OS/390 and z/OS: Multiple Components in One Database (MCOD)
SETUPIX
In Example B-11, we provide the REXX procedure used to populate the metadata table ZMCOD_INDEXES.
Example: B-11 REXX to populate ZMCOD_INDEXES
/*******************************************************************/ /* DB2 INITIALISATION - Populate MCOD Index Table */ /* VERBOSE - Print all SQL Return codes */ /* PREDELETE - Delete table contents prior to run, allow reruns */ /*******************************************************************/ VERBOSE = N PREDELETE = Y /*******************************************************************/ /* */ /* Initialize variables passed to program */ /* Name Description */ /* SRCSSID Source DB2 Subsystem ID */ /* SRCSCHEMA Source DB2 Owner of SAP Objects */ /* SRCRELEASE Source DB2 Version Number */ /* TRGSSID Target DB2 Subsystem ID */ /* TRGSCHEMA Target DB2 Owner of SAP Objects */ /* TRGRELEASE Target DB2 Version Number */ /* TRGVCAT Target DB2 VCAT name */ /* TRGSTOGRPPRE Target DB2 Storage Group Prefix (1st 3 Characters)*/ /* */ /*******************************************************************/ PARSE ARG SRCSSID SRCSCHEMA SRCRELEASE, TRGSSID TRGSCHEMA TRGRELEASE, TRGVCAT TRGSTOGRPPRE /*******************************************************************/ /* Add DSNREXX to the host command environment table if not there. */ /*******************************************************************/ 'SUBCOM DSNREXX' IF RC THEN , S_RC = RXSUBCOM('ADD','DSNREXX','DSNREXX') ADDRESS DSNREXX /*******************************************************************/ /* Connect to DB2 */ /*******************************************************************/ 'CONNECT' SRCSSID 00010011 00020011 00030011 00040011 00050011 00060020 00070020 00080020 00090020 00100020 00110020 00120020 00130020 00140020 00150020 00160020 00170020 00180020 00190020 00200020 00210020 00220020 00230020 00240020 00250019 00260019 00270019 00280005 00290020 00300000 00310020 00320000 00330000 00340000 00350000 00360000 00370011 00380011 00390011 00400011 00410011 00420020
173
/*******************************************************************/ /* For rerunning this procedure, to prevent duplicates, set flag */ /* PREDELETE to delete table contents before populating table */ /*******************************************************************/ IF PREDELETE = 'Y' THEN DO "EXECSQL DELETE FROM "SRCSCHEMA".ZMCOD_INDEXES" Say "SQL from delete is "SQLCODE END /*******************************************************************/ /* Setup Fetch SQL statement, declare cursor, prepare statement */ /* This cursor remains open and loops through SYSINDEXES rows */ /*******************************************************************/ SQLSTMT = "SELECT ", "IX.NAME,", "IX.CREATOR,", "IX.DBNAME,", "IX.DBID,", "IX.INDEXSPACE,", "IXPART.IPREFIX,", "IX.ISOBID,", "IXPART.PQTY,", "IXPART.SQTY,", "IXPART.STORNAME,", "IXPART.VCATNAME,", "IXPART.SPACE,", "IXPART.PARTITION ", " FROM SYSIBM.SYSINDEXES IX JOIN SYSIBM.SYSINDEXPART IXPART", " ON IX.NAME = IXPART.IXNAME AND IX.CREATOR = IXPART.IXCREATOR ", " WHERE IX.CREATOR = '"SRCSCHEMA"'" "EXECSQL DECLARE C1 CURSOR FOR S1" "EXECSQL PREPARE S1 INTO :OUTREC FROM :SQLSTMT" IF (VERBOSE = Y) | (SQLCODE <> 0) THEN SAY "SQLCODE from Select PREPARE is "SQLCODE /*******************************************************************/ /* Open Cursor for reading through SYSINDEXES and fetch */ /* the first row. */ /*******************************************************************/ "EXECSQL OPEN C1" IF (VERBOSE = Y) | (SQLCODE <> 0) THEN SAY "SQLCODE from Select OPEN is "SQLCODE "EXECSQL FETCH C1 USING DESCRIPTOR :OUTREC " IF (VERBOSE = Y) | (SQLCODE <> 0) THEN SAY "SQLCODE from select FETCH is "SQLCODE
00430011 00440011 00450011 00460011 00470011 00480011 00490005 00500016 00510005 00520005 00530011 00540011 00550011 00560011 00570011 00580011 00590000 00600000 00610000 00620000 00630000 00640000 00650000 00660023 00670000 00680000 00690000 00700003 00710007 00720008 00730000 00740001 00750016 00760000 00770000 00780020 00790000 00800011 00810011 00820011 00830011 00840011 00850011 00860000 00870020 00880000 00890000 00900020 00910011
174
SAP on DB2 UDB for OS/390 and z/OS: Multiple Components in One Database (MCOD)
/*******************************************************************/ /* Set loop counter and loop while rows are found */ /*******************************************************************/ loopctr = 0 DO WHILE SQLCODE = 0 /*******************************************************************/ /* Setup variables from SYSINDEXES fetch for inserting, */ /* including replacing the first 3 chars of the STOGROUP name. */ /*******************************************************************/ SRCINDEX TRGINDEX SRCSCHEMA SRCDBNAME TRGDBNAME SRCDBID TRGDBID SRCINDEXSPACE TRGINDEXSPACE SRCIPREFIX TRGIPREFIX SRCISOBID TRGISOBID SRCPRIQTY SRCSTOGROUP TRGSTOGROUP SRCVCAT SRCSPACE SRCPART = = = = = = = = = = = = = = = = = = = OUTREC.1.SQLDATA OUTREC.1.SQLDATA OUTREC.2.SQLDATA OUTREC.3.SQLDATA OUTREC.3.SQLDATA OUTREC.4.SQLDATA OUTREC.4.SQLDATA OUTREC.5.SQLDATA OUTREC.5.SQLDATA OUTREC.6.SQLDATA OUTREC.6.SQLDATA OUTREC.7.SQLDATA OUTREC.7.SQLDATA OUTREC.8.SQLDATA OUTREC.10.SQLDATA TRGSTOGRPPRE||substr(OUTREC.10.SQLDATA,4,3) OUTREC.11.SQLDATA OUTREC.12.SQLDATA OUTREC.13.SQLDATA
/*******************************************************************/ /* Setup insert statement string */ /*******************************************************************/ INSERTSQL = "INSERT INTO "SRCSCHEMA".ZMCOD_INDEXES (", ||"SRCINDEX,", ||"SRCSCHEMA,", ||"SRCDBNAME,", ||"SRCPART,", ||"SRCSSID,", ||"SRCRELEASE,", ||"SRCDBID,", ||"SRCINDEXSPACE,", ||"SRCIPREFIX,", ||"SRCISOBID,", ||"SRCPRIQTY,",
00920011 00930011 00940011 00950011 00960011 00970000 00980000 00990011 01000011 01010011 01020011 01030011 01040011 01050000 01060000 01070000 01080000 01090000 01100000 01110000 01120000 01130000 01140000 01150000 01160000 01170000 01180000 01190000 01200001 01210000 01220003 01230009 01240011 01250011 01260011 01270011 01280011 01290016 01300001 01310001 01320001 01330009 01340001 01350001 01360001 01370001 01380001 01390001 01400001
175
||"SRCSTOGROUP,", ||"SRCVCAT,", ||"SRCSPACE,", ||"TRGSSID,", ||"TRGRELEASE,", ||"TRGDBID,", ||"TRGDBNAME,", ||"TRGINDEX,", ||"TRGINDEXSPACE,", ||"TRGIPREFIX,", ||"TRGISOBID,", ||"TRGSCHEMA,", ||"TRGSTOGROUP,", ||"TRGVCAT", ||") ", " VALUES('", ||SRCINDEX"','", ||SRCSCHEMA"','", ||SRCDBNAME"',", ||SRCPART",'", ||SRCSSID"','", ||SRCRELEASE"',", ||SRCDBID",'", ||SRCINDEXSPACE"','", ||SRCIPREFIX"',", ||SRCISOBID",'", ||SRCPRIQTY"','", ||SRCSTOGROUP"','", ||SRCVCAT"',", ||SRCSPACE",'", ||TRGSSID"','", ||TRGRELEASE"',", ||TRGDBID",'", ||TRGDBNAME"','", ||TRGINDEX"','", ||TRGINDEXSPACE"','", ||TRGIPREFIX"',", ||TRGISOBID",'", ||TRGSCHEMA"','", ||TRGSTOGROUP"','", ||TRGVCAT"') " /*******************************************************************/ /* Execute insert statement, and check RC */ /*******************************************************************/ "EXECSQL "INSERTSQL IF (VERBOSE = Y) | (SQLCODE <> 0) THEN SAY "INSERTSQL is "SQLCODE
01410001 01420001 01430003 01440007 01450007 01460007 01470007 01480007 01490007 01500007 01510007 01520007 01530007 01540007 01550000 01560001 01570001 01580001 01590009 01600009 01610001 01620001 01630001 01640001 01650001 01660001 01670001 01680001 01690003 01700009 01710007 01720007 01730007 01740007 01750007 01760007 01770007 01780007 01790007 01800001 01810001 01830011 01840011 01850011 01860011 01870001 01880020 01890011 01900011
176
SAP on DB2 UDB for OS/390 and z/OS: Multiple Components in One Database (MCOD)
/*******************************************************************/ /* Fetch next SYSTABLESPACE record, increment counter */ /*******************************************************************/ "EXECSQL FETCH C1 USING DESCRIPTOR :OUTREC " IF (VERBOSE = Y) | (SQLCODE <> 0) THEN SAY "SQLCODE from FETCH is "SQLCODE loopctr=loopctr+1 END /*******************************************************************/ /* Close main cursor and exit */ /*******************************************************************/ SAY "----------------------------------" SAY "Total indexes processed "loopctr SAY "----------------------------------" "EXECSQL CLOSE C1" SAY"SQLCODE from CLOSE is "SQLCODE S_RC = RXSUBCOM('DELETE','DSNREXX','DSNREXX')
01910011 01920011 01930011 01940011 01950011 01960020 01970011 01980011 01990011 02000000 02010000 02020000 02030011 02040011 02050011 02060011 02070005 02080005 02090005 02100011 02110000 02120000
177
%SETUPTAB DB7S SAPBLU 710 DB7T SAPBLU 710 MCDBLU BLU %SETUPIX DB7S SAPBLU 710 DB7T SAPBLU 710 MCDBLU BLU /* //* For faster elapsed time, this job can be split into //* 5 jobs running each REXX, executing in parallel
178
SAP on DB2 UDB for OS/390 and z/OS: Multiple Components in One Database (MCOD)
DELETE (SAPRES4.UNLOAD.SYSREC.INDEXES) DELETE (SAPRES4.UNLOAD.SYSPUNCH.INDEXES) SET MAXCC=0 /* //STEPST EXEC DSNUPROC,PARM='DB7S,DSNTEX' //SYSREC DD DSN=SAPRES4.UNLOAD.SYSREC.STOG, // DISP=(NEW,CATLG,CATLG),UNIT=SYSDA,SPACE=(TRK,(5,5)) //SYSPUNCH DD DSN=SAPRES4.UNLOAD.SYSPUNCH.STOG, // DISP=(NEW,CATLG,CATLG),UNIT=SYSDA,SPACE=(TRK,(5,5)) //SYSPRINT DD SYSOUT=* //SYSIN DD * UNLOAD TABLESPACE U000XGSR.ZMCODXS //* //STEPDB EXEC DSNUPROC,PARM='DB7S,DSNTEX',COND=(0,LT) //SYSREC DD DSN=SAPRES4.UNLOAD.SYSREC.DATABASE, // DISP=(NEW,CATLG,CATLG),UNIT=SYSDA,SPACE=(TRK,(5,5)) //SYSPUNCH DD DSN=SAPRES4.UNLOAD.SYSPUNCH.DATABASE, // DISP=(NEW,CATLG,CATLG),UNIT=SYSDA,SPACE=(TRK,(5,5)) //SYSPRINT DD SYSOUT=* //SYSIN DD * UNLOAD TABLESPACE U010XZSZ.ZMCODXD //STEPTS EXEC DSNUPROC,PARM='DB7S,DSNTEX' //SYSREC DD DSN=SAPRES4.UNLOAD.SYSREC.TSPACE, // DISP=(NEW,CATLG,CATLG),UNIT=SYSDA,SPACE=(TRK,(5,5)) //SYSPUNCH DD DSN=SAPRES4.UNLOAD.SYSPUNCH.TSPACE, // DISP=(NEW,CATLG,CATLG),UNIT=SYSDA,SPACE=(TRK,(5,5)) //SYSPRINT DD SYSOUT=* //SYSIN DD * UNLOAD TABLESPACE U020XTAF.ZMCODXT /* //STEPTB EXEC DSNUPROC,PARM='DB7S,DSNTEX',COND=(0,LT) //SYSREC DD DSN=SAPRES4.UNLOAD.SYSREC.TABLES, // DISP=(NEW,CATLG,CATLG),UNIT=SYSDA,SPACE=(TRK,(5,5)) //SYSPUNCH DD DSN=SAPRES4.UNLOAD.SYSPUNCH.TABLES, // DISP=(NEW,CATLG,CATLG),UNIT=SYSDA,SPACE=(TRK,(5,5)) //SYSPRINT DD SYSOUT=* //SYSIN DD * UNLOAD TABLESPACE U010XX1B.ZMCODXT //* //STEPIX EXEC DSNUPROC,PARM='DB7S,DSNTEX',COND=(0,LT) //SYSREC DD DSN=SAPRES4.UNLOAD.SYSREC.INDEXES, // DISP=(NEW,CATLG,CATLG),UNIT=SYSDA,SPACE=(TRK,(5,5)) //SYSPUNCH DD DSN=SAPRES4.UNLOAD.SYSPUNCH.INDEXES, // DISP=(NEW,CATLG,CATLG),UNIT=SYSDA,SPACE=(TRK,(5,5)) //SYSPRINT DD SYSOUT=* //SYSIN DD * UNLOAD TABLESPACE U010XZ8Y.ZMCODXI
179
180
SAP on DB2 UDB for OS/390 and z/OS: Multiple Components in One Database (MCOD)
//SYSREC //SYSIN //SYSUT1 // //SORTOUT // // //* //STEPTB //SYSPRINT //SYSREC //SYSIN //SYSPRINT //SYSUT1 // // //SORTOUT // // //* //STEPIX //SYSPRINT //SYSREC //SYSIN //SYSPRINT //SYSUT1 // // //SORTOUT // // //*
DD DSN=SAPRES4.UNLOAD.SYSREC.TSPACE,DISP=SHR DD DSN=SAPRES4.UNLOAD.SYSPUNCH.TSPACE,DISP=SHR DD DSN=SAPRES4.UNLOAD.SYSUT1.TSPACE, UNIT=SYSDA,SPACE=(4000,(20,20),,,ROUND) DD DSN=SAPRES4.UNLOAD.SORTOUT.TSPACE, DISP=(MOD,DELETE,CATLG), UNIT=SYSDA,SPACE=(4000,(20,20),,,ROUND) EXEC DSNUPROC,PARM='DB7T,DSNTEX' DD SYSOUT=* DD DSN=SAPRES4.UNLOAD.SYSREC.TABLES,DISP=SHR DD DSN=SAPRES4.UNLOAD.SYSPUNCH.TABLES,DISP=SHR DD SYSOUT=* DD DSN=SAPRES4.UNLOAD.SYSUT1.TABLES, DISP=(MOD,DELETE,CATLG), UNIT=SYSDA,SPACE=(4000,(20,20),,,ROUND) DD DSN=SAPRES4.UNLOAD.SORTOUT.TABLES, DISP=(MOD,DELETE,CATLG), UNIT=SYSDA,SPACE=(4000,(20,20),,,ROUND) EXEC DSNUPROC,PARM='DB7T,DSNTEX' DD SYSOUT=* DD DSN=SAPRES4.UNLOAD.SYSREC.INDEXES,DISP=SHR DD DSN=SAPRES4.UNLOAD.SYSPUNCH.INDEXES,DISP=SHR DD SYSOUT=* DD DSN=SAPRES4.UNLOAD.SYSUT1.INDEXES, DISP=(MOD,DELETE,CATLG), UNIT=SYSDA,SPACE=(4000,(20,20),,,ROUND) DD DSN=SAPRES4.UNLOAD.SORTOUT.INDEXES, DISP=(MOD,DELETE,CATLG), UNIT=SYSDA,SPACE=(4000,(20,20),,,ROUND)
181
//SYSPRINT DD //SYSIN DD REPAIR SET REPAIR SET REPAIR SET REPAIR SET REPAIR SET /*
DUPLICDB
In Example B-16, we provide the REXX procedure used to detect and correct duplicate database names.
Example: B-16 REXX procedure to detect and correct duplicate database names
/*******************************************************************/ /* SAP MCOD Migration - Change DBNAME if duplicate exists */ /*******************************************************************/ VERBOSE = N /*******************************************************************/ /* */ /* Initialize variables passed to program */ /* Name Description */ /* SRCSSID Source DB2 Subsystem ID */ /* SRCSCHEMA Source DB2 Owner of SAP Objects */ /* SRCRELEASE Source DB2 Version Number */ /* TRGSSID Target DB2 Subsystem ID */ /* TRGSCHEMA Target DB2 Owner of SAP Objects */ /* TRGRELEASE Target DB2 Version Number */ /* TRGVCAT Target DB2 VCAT name */ /* TRGSTOGRPPRE Target DB2 Storage Group Prefix (1st 3 Characters)*/ /* TRGOWNER Target DB2 Owner of SAP Objects */ /* */ /*******************************************************************/ PARSE ARG SRCSSID SRCSCHEMA SRCRELEASE, TRGSSID TRGSCHEMA TRGRELEASE, 00010003 00020003 00030003 00040017 00050017 00060018 00061016 00062016 00063016 00064016 00065016 00066016 00067016 00068016 00069016 00069116 00069216 00069316 00069417 00069517 00069617 00069717 00069817 00069917
182
SAP on DB2 UDB for OS/390 and z/OS: Multiple Components in One Database (MCOD)
00070017 00070117 /*******************************************************************/ 00070217 /* Add DSNREXX to the host command environment table if not there. */ 00071001 /*******************************************************************/ 00072016 00080001 'SUBCOM DSNREXX' 00090001 IF RC THEN , 00100001 S_RC = RXSUBCOM('ADD','DSNREXX','DSNREXX') 00110001 ADDRESS DSNREXX 00120001 00130003 /*******************************************************************/ 00140003 /* Connect to DB2 */ 00150003 /*******************************************************************/ 00160003 00170003 'CONNECT' TRGSSID 00180016 /* trace i */ 00190003 00200003 /*******************************************************************/ 00210003 /* Setup Fetch SQL statement, declare cursor, prepare statement */ 00220003 /* This cursor remains open and loops through ZMCOD_DATABASE rows */ 00230003 /*******************************************************************/ 00240003 00250003 MAINLOOP = "SELECT TRGDBNAME ", 00260003 "FROM "TRGOWNER".ZMCOD_DATABASE ", 00270016 "WHERE TRGSCHEMA = '"TRGSCHEMA"' " 00280016 "EXECSQL DECLARE C1 CURSOR FOR S1" 00290001 IF (VERBOSE = Y) | (SQLCODE <> 0) THEN 00291018 SAY "SQLCODE from MAINLOOP DECLARE is "SQLCODE 00292017 "EXECSQL PREPARE S1 INTO :OUTREC FROM :MAINLOOP" 00300003 IF (VERBOSE = Y) | (SQLCODE <> 0) THEN 00301018 SAY "SQLCODE from MAINLOOP PREPARE is "SQLCODE 00302017 00310001 /*******************************************************************/ 00320003 /* Setup Fetch SQL statement, declare cursor, prepare statement */ 00330003 /* This cursor is opened to read SYSDATABASE looking for clashes */ 00340003 /*******************************************************************/ 00350003 00360003 SYSDBASESQL = "SELECT CREATOR FROM SYSIBM.SYSDATABASE WHERE ", 00370003 ||"NAME = ?" 00380001 "EXECSQL DECLARE C2 CURSOR FOR S2" 00390001 IF (VERBOSE = Y) | (SQLCODE <> 0) THEN 00391018 SAY "SQLCODE from SYSDBASESQL DECLARE is "SQLCODE 00392016 "EXECSQL PREPARE S2 INTO :OUTDB FROM :SYSDBASESQL" 00400003 IF (VERBOSE = Y) | (SQLCODE <> 0) THEN 00410018 SAY "SQLCODE from SYSDBASESQL PREPARE is "SQLCODE 00420016 00430003 /*******************************************************************/ 00440003 /* Setup Fetch SQL statement, declare cursor, prepare statement */ 00450003
183
/* This cursor is opened when database name is re-randomized, to */ /* look for clashes within the new database names */ /*******************************************************************/ ZMCODSQL = "SELECT TRGDBNAME FROM "TRGOWNER".ZMCOD_DATABASE WHERE ", ||"TRGDBNAME = ?" "EXECSQL DECLARE C3 CURSOR FOR S3" IF (VERBOSE = Y) | (SQLCODE <> 0) THEN SAY "SQLCODE from ZMCODSQL DECLARE is "SQLCODE "EXECSQL PREPARE S3 INTO :DUPDB FROM :ZMCODSQL" IF (VERBOSE = Y) | (SQLCODE <> 0) THEN SAY "SQLCODE from ZMCODSQL PREPARE is "SQLCODE /*******************************************************************/ /* Open Cursor for reading through ZMCOD_DATABASE and fetch */ /* the first row. */ /*******************************************************************/ "EXECSQL OPEN C1" IF (VERBOSE = Y) | (SQLCODE <> 0) THEN SAY "SQLCODE from MAINLOOP OPEN is "SQLCODE "EXECSQL FETCH C1 USING DESCRIPTOR :OUTREC " IF (VERBOSE = Y) | (SQLCODE <> 0) THEN SAY "SQLCODE from MAINLOOP FETCH is "SQLCODE /*******************************************************************/ /* Set loop counter and loop while rows are found */ /*******************************************************************/ countok = 0 countchanges = 0 countunresolved = 0 counttotal = 0 DO WHILE SQLCODE = 0 IF (VERBOSE = Y) | (SQLCODE <> 0) THEN SAY counttotal "Fetched DB is "OUTREC.1.SQLDATA TRGDBNAME = OUTREC.1.SQLDATA /*******************************************************************/ /* Open cursor in SYSDATABASE and check if row exists */ /*******************************************************************/ "EXECSQL OPEN C2 USING :TRGDBNAME" IF (VERBOSE = Y) | (SQLCODE <> 0) THEN SAY "SQLCODE from SYSDBASESQL OPEN is "SQLCODE "EXECSQL FETCH C2 INTO :OUTREC2" IF VERBOSE = Y THEN SAY "SQLCODE from SYSDBASESQL Fetch is "SQLCODE
00460003 00470003 00480003 00490003 00500016 00510003 00520003 00521018 00522016 00530003 00540018 00550016 00560003 00570003 00580003 00590003 00600003 00610003 00620001 00630016 00640016 00650001 00660016 00670016 00680003 00690003 00700003 00710003 00720003 00730005 00740005 00750005 00760005 00770001 00780001 00790016 00800016 00810002 00820003 00830003 00840003 00850003 00860003 00870002 00880016 00890016 00900001 00910018 00920016
184
SAP on DB2 UDB for OS/390 and z/OS: Multiple Components in One Database (MCOD)
TEMPSQLCODE = SQLCODE "EXECSQL CLOSE C2" IF (VERBOSE = Y) | (SQLCODE <> 0) THEN SAY "SQLCODE from ZTABCHK CLOSE is "SQLCODE SQLCODE = TEMPSQLCODE /*******************************************************************/ /* If no row exists, drop into main loop */ /*******************************************************************/ If SQLCODE = 100 THEN DO countok = countok + 1 IF VERBOSE = Y THEN SAY " Database " OUTREC.1.SQLDATA " No Dup "counttotal END /*******************************************************************/ /* If row exists, DBNAME must be re-randomized and checked for */ /* uniqueness in SYSDATABASE and ZMCOD_DATABASE-TRGDBNAME */ /*******************************************************************/ ELSE do loopctr2 = 0 do while SQLCODE = 0 loopctr2 = loopctr2 + 1 /*******************************************************************/ /* If we could not get unique name after 20 tries, drop out and */ /* print error message for customer to investigate */ /*******************************************************************/ if loopctr2 = 20 then do SAY "Could not produce random for " TRGDBNAME countunresolved = countunresolved + 1 leave end else nop /*******************************************************************/ /* Randomize the last 3 characters to new values */ /* Ugly code, but it'll do the job on the few occasions that clash*/ /* True randomizing of all 3 characters */ /*******************************************************************/ NEWDBSTART = SUBSTR(TRGDBNAME,1,5) RANDOMCHAR = RANDOM(1,36) If RANDOMCHAR <10 then RANDOMCHAR = RANDOMCHAR + 192 else If RANDOMCHAR <19 then RANDOMCHAR = RANDOMCHAR + 199 else If RANDOMCHAR <27 then RANDOMCHAR = RANDOMCHAR + 207
00930003 00940003 00950016 00960016 00970003 00980003 00990003 01000003 01010003 01020003 01030002 01040005 01050018 01060016 01070002 01080003 01090003 01100003 01110003 01120003 01130003 01140001 01150001 01160001 01170001 01180003 01190003 01200003 01210003 01220003 01230003 01240003 01250016 01260005 01270001 01280001 01290001 01300003 01310003 01320003 01330003 01340003 01350003 01360003 01370002 01380003 01390003 01400003 01410003
185
else If RANDOMCHAR <37 then RANDOMCHAR = RANDOMCHAR TRGDBPOS6 = D2C(RANDOMCHAR) RANDOMCHAR = RANDOM(1,36) If RANDOMCHAR <10 then RANDOMCHAR = RANDOMCHAR + 192 else If RANDOMCHAR <19 then RANDOMCHAR = RANDOMCHAR else If RANDOMCHAR <27 then RANDOMCHAR = RANDOMCHAR else If RANDOMCHAR <37 then RANDOMCHAR = RANDOMCHAR TRGDBPOS7 = D2C(RANDOMCHAR) RANDOMCHAR = RANDOM(1,36) If RANDOMCHAR <10 then RANDOMCHAR = RANDOMCHAR + 192 else If RANDOMCHAR <19 then RANDOMCHAR = RANDOMCHAR else If RANDOMCHAR <27 then RANDOMCHAR = RANDOMCHAR else If RANDOMCHAR <37 then RANDOMCHAR = RANDOMCHAR TRGDBPOS8 = D2C(RANDOMCHAR)
+ 213
/*******************************************************************/ /* Build new DBNAME open cursor on SYSDATABASE and test it */ /*******************************************************************/ NEWDBNAME = NEWDBSTART||TRGDBPOS6||TRGDBPOS7||TRGDBPOS8 IF (VERBOSE = Y) | (SQLCODE <> 0) THEN SAY TRGDBNAME" now "NEWDBNAME "EXECSQL OPEN C2 USING :NEWDBNAME" IF (VERBOSE = Y) | (SQLCODE <> 0) THEN SAY "SQLCODE from SYSDBASESQL Open is "SQLCODE "EXECSQL FETCH C2 INTO :OUTREC2" IF (VERBOSE = Y) | (SQLCODE <> 0) THEN SAY "SQLCODE from SYSDBASESQL is "SQLCODE TEMPSQLCODE = SQLCODE "EXECSQL CLOSE C2" IF (VERBOSE = Y) | (SQLCODE <> 0) THEN SAY "SQLCODE from ZTABCHK CLOSE is "SQLCODE SQLCODE = TEMPSQLCODE /*******************************************************************/ /* If it is unique in SYSDATABASE, need to test it against our */ /* ZMCOD_DATABASE-TRGDBNAME as well, in case we already used it */ /*******************************************************************/ IF SQLCODE = 100 then do "EXECSQL OPEN C3 USING :NEWDBNAME" IF (VERBOSE = Y) | (SQLCODE <> 0) THEN SAY "SQLCODE from ZTABCHK OPEN is "SQLCODE "EXECSQL FETCH C3 INTO :OUTREC3" IF (VERBOSE = Y) | (SQLCODE <> 0) THEN SAY "SQLCODE from ZTABCHK Fetch is "SQLCODE TEMPSQLCODE = SQLCODE "EXECSQL CLOSE C3" IF (VERBOSE = Y) | (SQLCODE <> 0) THEN
01420003 01430003 01440003 01450003 01460003 01470003 01480003 01490003 01500003 01510003 01520003 01530003 01540003 01550003 01560003 01570003 01580003 01590003 01600003 01610003 01620016 01630017 01640016 01650016 01660016 01670016 01680016 01690016 01700016 01710016 01720016 01730016 01740016 01750003 01760003 01770003 01780003 01790003 01800003 01810003 01820003 01830016 01840016 01850016 01860016 01870016 01880016 01890003 01900016
186
SAP on DB2 UDB for OS/390 and z/OS: Multiple Components in One Database (MCOD)
SAY "SQLCODE from ZTABCHK CLOSE is "SQLCODE SQLCODE = TEMPSQLCODE END END /*******************************************************************/ /* If we dropped out of loop because of success, update our table */ /* and all other ZMCOD tables with the target DBNAME */ /*******************************************************************/ if loopctr2 < 20 then do countchanges = countchanges + 1 UPDATESQL1 = "UPDATE "TRGOWNER".ZMCOD_DATABASE ", "SET TRGDBNAME ='"||NEWDBNAME"' WHERE SRCDBNAME ='"TRGDBNAME"'" IF (VERBOSE = Y) | (SQLCODE <> 0) THEN SAY "UPDATESQL is "UPDATESQL1 "EXECSQL "UPDATESQL1 IF (VERBOSE = Y) | (SQLCODE <> 0) THEN SAY "SQLCODE from UPDATESQL1 is "SQLCODE SQLERRMC UPDATESQL2 = "UPDATE "TRGOWNER".ZMCOD_TABLES ", "SET TRGDBNAME ='"||NEWDBNAME"' WHERE SRCDBNAME ='"TRGDBNAME"'" IF (VERBOSE = Y) | (SQLCODE <> 0) THEN SAY "UPDATESQL is "UPDATESQL2 "EXECSQL "UPDATESQL2 IF (VERBOSE = Y) | (SQLCODE <> 0) THEN SAY "SQLCODE from UPDATESQL2 is "SQLCODE SQLERRMC UPDATESQL3 = "UPDATE "TRGOWNER".ZMCOD_TABLESPACE ", "SET TRGDBNAME ='"||NEWDBNAME"' WHERE SRCDBNAME ='"TRGDBNAME"'" IF (VERBOSE = Y) | (SQLCODE <> 0) THEN SAY "UPDATESQL is "UPDATESQL3 "EXECSQL "UPDATESQL3 IF (VERBOSE = Y) | (SQLCODE <> 0) THEN SAY "SQLCODE from UPDATESQL3 is "SQLCODE SQLERRMC UPDATESQL4 = "UPDATE "TRGOWNER".ZMCOD_INDEXES ", "SET TRGDBNAME ='"||NEWDBNAME"' WHERE SRCDBNAME ='"TRGDBNAME"'" IF (VERBOSE = Y) | (SQLCODE <> 0) THEN SAY "UPDATESQL is "UPDATESQL4 "EXECSQL "UPDATESQL4 IF (VERBOSE = Y) | (SQLCODE <> 0) THEN SAY "SQLCODE from UPDATESQL4 is "SQLCODE SQLERRMC SAY " Resolved "TRGDBNAME " to "NEWDBNAME END END /*******************************************************************/
01910016 01920016 01930016 01940016 01950003 01960003 01970003 01980003 01990003 02000003 02010003 02020005 02030016 02040016 02050016 02060016 02070002 02080016 02090016 02100008 02110016 02120016 02130016 02140016 02150013 02160016 02170016 02180008 02190016 02200016 02210016 02220016 02230013 02240016 02250016 02260008 02270016 02280016 02290016 02300016 02310013 02320016 02330016 02340013 02350016 02360016 02370016 02380003 02390003
187
/* Increment counter, fetch next record for cursor1 and continue */ /* loop */ /*******************************************************************/ counttotal=counttotal+1 "EXECSQL FETCH C1 USING DESCRIPTOR :OUTREC " IF (VERBOSE = Y) | (SQLCODE <> 0) THEN SAY "SQLCODE from MAINLOOP FETCH is "SQLCODE END /*******************************************************************/ /* Close main cursor and exit */ /*******************************************************************/ SAY "----------------------------------" SAY "Total databases processed "counttotal SAY "Total databases without duplicates "countok SAY "Total databases changed "countchanges SAY "Total databases unresolved "countunresolved SAY "----------------------------------" "EXECSQL CLOSE C1" SAY"SQLCODE from MAINLOOP CLOSE is "SQLCODE S_RC = RXSUBCOM('DELETE','DSNREXX','DSNREXX')
02400003 02410003 02420003 02430003 02440005 02450003 02460016 02470016 02480001 02490001 02500003 02510003 02520006 02530003 02540003 02550016 02560016 02570016 02580016 02590016 02600016 02610001 02620016 02630001
188
SAP on DB2 UDB for OS/390 and z/OS: Multiple Components in One Database (MCOD)
POSTDDL
In Example B-18, we provide the REXX procedure used to update the target DB2 catalog with new tablespace values.
Example: B-18 REXX procedure to update target catalog with new tablespace values
/*******************************************************************/ /* SAP MCOD Migration - Change DBNAME if duplicate exists */ /*******************************************************************/ /*******************************************************************/ /* */ /* Initialize variables passed to program */ /* Name Description */ /* SRCSSID Source DB2 Subsystem ID */ /* SRCSCHEMA Source DB2 Owner of SAP Objects */ /* SRCRELEASE Source DB2 Version Number */ /* TRGSSID Target DB2 Subsystem ID */ /* TRGSCHEMA Target DB2 Owner of SAP Objects */ /* TRGRELEASE Target DB2 Version Number */ /* TRGVCAT Target DB2 VCAT name */ /* TRGSTOGRPPRE Target DB2 Storage Group Prefix (1st 3 Characters)*/ /* TRGOWNER Target DB2 Owner of SAP Objects */ /* */ /*******************************************************************/ PARSE ARG SRCSSID SRCSCHEMA SRCRELEASE, TRGSSID TRGSCHEMA TRGRELEASE, TRGVCAT TRGSTOGRPPRE TRGOWNER VERBOSE = N /*******************************************************************/ /* Add DSNREXX to the host command environment table if not there. */ /*******************************************************************/ 'SUBCOM DSNREXX' IF RC THEN , S_RC = RXSUBCOM('ADD','DSNREXX','DSNREXX') ADDRESS DSNREXX /*******************************************************************/ 00010000 00020000 00030000 00040009 00050000 00060000 00070000 00080000 00090000 00100000 00110000 00120000 00130000 00140000 00150000 00160000 00161005 00170000 00180000 00190000 00200000 00210000 00220005 00230000 00240011 00250000 00260000 00270000 00280000 00290000 00300000 00310000 00320000 00330000 00340000 00350000
189
00360000 00370000 00380000 'CONNECT' TRGSSID 00390004 /* trace i */ 00400000 00410000 /*******************************************************************/ 00420000 /* Setup Fetch SQL statement, declare cursor, prepare stament */ 00430000 /* This cursor remains open and loops through ZMCOD_TABLESPACE */ 00440010 /*******************************************************************/ 00450000 00460000 MAINLOOP = "SELECT TRGDBID,TRGIPREFIX,TRGPSID,TRGTSNAME ", 00470002 "FROM "TRGOWNER".ZMCOD_TABLESPACE ", 00480006 "WHERE TRGSCHEMA = '"TRGSCHEMA"' ", 00490002 "FOR UPDATE OF TRGDBID,TRGIPREFIX,TRGPSID" 00491002 "EXECSQL DECLARE C1 CURSOR FOR S1" 00500002 IF (VERBOSE = Y) | (SQLCODE <> 0) THEN 00510010 SAY "SQLCODE from MAINLOOP DECLARE is "SQLCODE 00521010 "EXECSQL PREPARE S1 INTO :OUTREC FROM :MAINLOOP" 00530000 IF (VERBOSE = Y) | (SQLCODE <> 0) THEN 00531010 SAY "SQLCODE from MAINLOOP PREPARE is "SQLCODE 00540010 00550000 /*******************************************************************/ 00560000 /* Setup Fetch SQL statement, declare cursor, prepare statement */ 00570000 /* This cursor is opened to read SYSTABLESPACE looking for clashes */ 00580000 /*******************************************************************/ 00590000 00600000 SQLSTMT = "SELECT ", 00610000 "TS.DBID, ", 00620000 "TSP.IPREFIX, ", 00630000 "TS.PSID ", 00640000 " FROM SYSIBM.SYSTABLESPACE TS JOIN SYSIBM.SYSTABLEPART TSP", 00650000 " ON TS.DBNAME = TSP.DBNAME ", 00660002 " WHERE TS.NAME = ? AND TS.CREATOR = '"TRGSCHEMA"'" 00670002 "EXECSQL DECLARE C2 CURSOR FOR S2" 00680000 IF (VERBOSE = Y) | (SQLCODE <> 0) THEN 00681010 SAY "SQLCODE from C2 PREPARE is "SQLCODE 00690010 "EXECSQL PREPARE S2 INTO :OUTREC2 FROM :SQLSTMT" 00700002 IF (VERBOSE = Y) | (SQLCODE <> 0) THEN 00701010 SAY "SQLCODE from C2 PREPARE is "SQLCODE 00710010 00720000 /*******************************************************************/ 00730000 /* Open Cursor for reading through ZMCOD_TABLESPACE and fetch */ 00740000 /* the first row. */ 00750000 /*******************************************************************/ 00760000 00770000 "EXECSQL OPEN C1" 00780000 IF (VERBOSE = Y) | (SQLCODE <> 0) THEN 00790010 SAY "SQLCODE from MAINLOOP OPEN is "SQLCODE 00800010
190
SAP on DB2 UDB for OS/390 and z/OS: Multiple Components in One Database (MCOD)
"EXECSQL FETCH C1 USING DESCRIPTOR :OUTREC " IF (VERBOSE = Y) | (SQLCODE <> 0) THEN SAY "SQLCODE from MAINLOOP FETCH is "SQLCODE /*******************************************************************/ /* Set loop counter and loop while rows are found */ /*******************************************************************/ counttotal = 0 DO WHILE SQLCODE = 0 /* if counttotal = 5 then leave */ IF (VERBOSE = Y) | (SQLCODE <> 0) THEN SAY counttotal "Fetched TS is "OUTREC.4.SQLDATA /*******************************************************************/ /* Open cursor in SYSTABLESPACE join and read new fields */ /*******************************************************************/ "EXECSQL OPEN C2 USING :OUTREC.4.SQLDATA" IF (VERBOSE = Y) | (SQLCODE <> 0) THEN SAY "SQLCODE from SYSTSSQL OPEN is "SQLCODE SQLERRMC SQLERRP "EXECSQL FETCH C2 USING DESCRIPTOR :OUTREC2" IF (VERBOSE = Y) | (SQLCODE <> 0) THEN SAY "SQLCODE from SYSTSSQL Fetch is "SQLCODE SQLERRMC SQLERRP /*******************************************************************/ /* setup update statement for ZMCOD_TABLESPACE and execute */ /*******************************************************************/ UPDATESQL = "UPDATE "TRGOWNER".ZMCOD_TABLESPACE SET ", "TRGDBID = '"OUTREC2.1.SQLDATA"', ", "TRGIPREFIX = '"OUTREC2.2.SQLDATA"', ", "TRGPSID = "OUTREC2.3.SQLDATA" ", "WHERE CURRENT OF C1" "EXECSQL "UPDATESQL IF (VERBOSE = Y) | (SQLCODE <> 0) THEN UPDATESQL = "UPDATE "TRGOWNER".ZMCOD_TABLESPACE SET ", "TRGDBID = '"OUTREC2.1.SQLDATA"', ", "TRGIPREFIX = '"OUTREC2.2.SQLDATA"', ", "TRGPSID = "OUTREC2.3.SQLDATA" ", "WHERE CURRENT OF C1" "EXECSQL "UPDATESQL IF (VERBOSE = Y) | (SQLCODE <> 0) THEN SAY "SQLCODE from UPDATESQL is "SQLCODE SQLERRMC "EXECSQL CLOSE C2" IF (VERBOSE = Y) | (SQLCODE <> 0) THEN SAY "SQLCODE from UPDATESQL CLOSE is "SQLCODE /*******************************************************************/
00810000 00820010 00830010 00840000 00850000 00860000 00870000 00880000 00890000 00900000 00910008 00920010 00930002 00950000 00960000 00970000 00980000 00990000 01000002 01010010 01020002 01030002 01040010 01050002 01051002 01070000 01080000 01100000 01110000 01120002 01130002 01140002 01150000 01170007 01180010 01110000 01120002 01130002 01140002 01150000 01170007 01180010 01190010 01200000 01210000 01220010 01230010 01240000 01250000
191
/* Increment counter, fetch next record for cursor1 and continue */ /* loop */ /*******************************************************************/ counttotal=counttotal+1 "EXECSQL FETCH C1 USING DESCRIPTOR :OUTREC " IF (VERBOSE = Y) | (SQLCODE <> 0) THEN SAY "SQLCODE from MAINLOOP FETCH is "SQLCODE END /*******************************************************************/ /* Close main cursor and exit */ /*******************************************************************/ SAY "----------------------------------" SAY "Total tablespaces processed "counttotal SAY "----------------------------------" "EXECSQL CLOSE C1" SAY"SQLCODE from MAINLOOP CLOSE is "SQLCODE S_RC = RXSUBCOM('DELETE','DSNREXX','DSNREXX')
01260000 01270000 01280000 01290000 01300000 01310000 01320010 01330010 01340000 01350000 01360000 01370000 01380000 01390000 01400000 01410000 01420000 01430000 01440000 01450000 01460000
POSTDDL2
In Example B-19, we provide the REXX procedure used to update the target DB2 catalog with new index values.
Example: B-19 REXX procedure to update target catalog with new index values
/*******************************************************************/ /* SAP MCOD Migration - Update ZMCOD_INDEXES with new fields */ /* after running of DDL in target system. */ /*******************************************************************/ /*******************************************************************/ /* */ /* Initialize variables passed to program */ /* Name Description */ /* SRCSSID Source DB2 Subsystem ID */ /* SRCSCHEMA Source DB2 Owner of SAP Objects */ /* SRCRELEASE Source DB2 Version Number */ /* TRGSSID Target DB2 Subsystem ID */ /* TRGSCHEMA Target DB2 Owner of SAP Objects */ /* TRGRELEASE Target DB2 Version Number */ /* TRGVCAT Target DB2 VCAT name */ /* TRGSTOGRPPRE Target DB2 Storage Group Prefix (1st 3 Characters)*/ /* TRGOWNER Target DB2 Owner of SAP Objects */ /* */ 00010000 00020000 00030000 00040000 00050000 00060000 00070000 00080000 00090000 00100000 00110000 00120000 00130000 00140000 00150000 00160000 00170000 00180000 00190000
192
SAP on DB2 UDB for OS/390 and z/OS: Multiple Components in One Database (MCOD)
/*******************************************************************/ PARSE ARG SRCSSID SRCSCHEMA SRCRELEASE, TRGSSID TRGSCHEMA TRGRELEASE, TRGVCAT TRGSTOGRPPRE TRGOWNER VERBOSE = N /*******************************************************************/ /* Add DSNREXX to the host command environment table if not there. */ /*******************************************************************/ 'SUBCOM DSNREXX' IF RC THEN , S_RC = RXSUBCOM('ADD','DSNREXX','DSNREXX') ADDRESS DSNREXX /*******************************************************************/ /* Connect to DB2 */ /*******************************************************************/ 'CONNECT' TRGSSID /* trace i */ /*******************************************************************/ /* Setup Fetch SQL statement, declare cursor, prepare statement */ /* This cursor remains open and loops through ZMCOD_INDEXES rows */ /*******************************************************************/ MAINLOOP = "SELECT TRGDBID,TRGIPREFIX,TRGISOBID,", "TRGINDEXSPACE,TRGINDEX ", "FROM "TRGOWNER".ZMCOD_INDEXES ", "WHERE TRGSCHEMA = '"TRGSCHEMA"' ", "FOR UPDATE OF TRGDBID,TRGIPREFIX,TRGISOBID,TRGINDEXSPACE" "EXECSQL DECLARE C1 CURSOR FOR S1" IF (VERBOSE = Y) | (SQLCODE <> 0) THEN SAY "SQLCODE from MAINLOOP DECLARE is "SQLCODE SQLERRMC SQLERRP "EXECSQL PREPARE S1 INTO :OUTREC FROM :MAINLOOP" IF (VERBOSE = Y) | (SQLCODE <> 0) THEN SAY "SQLCODE from MAINLOOP PREPARE is "SQLCODE SQLERRMC SQLERRP /*******************************************************************/ /* Setup Fetch SQL statement, declare cursor, prepare statement */ /* fetching new data for INDEXES after execution of DDL on target */ /*******************************************************************/ SQLSTMT = "SELECT ", "IX.DBID, ", "IXP.IPREFIX, ",
00200000 00210000 00220000 00230000 00240000 00250000 00260002 00270000 00280000 00290000 00300000 00310000 00320000 00330000 00340000 00350000 00360000 00370000 00380000 00390000 00400000 00410000 00420000 00430000 00440000 00450000 00460001 00470000 00480000 00490001 00500001 00510000 00520000 00530001 00540000 00550001 00560001 00570000 00580001 00590001 00600000 00610000 00620001 00630001 00640000 00650000 00660000 00670000 00680000
193
"IX.ISOBID, ", "IX.INDEXSPACE ", " FROM SYSIBM.SYSINDEXES IX JOIN SYSIBM.SYSINDEXPART IXP", " ON IX.NAME = IXP.IXNAME AND IX.CREATOR = IXP.IXCREATOR", " WHERE IX.NAME = ? AND IX.CREATOR = '"TRGSCHEMA"'" "EXECSQL DECLARE C2 CURSOR FOR S2" IF (VERBOSE = Y) | (SQLCODE <> 0) THEN SAY "SQLCODE from C2 PREPARE is "SQLCODE SQLERRMC SQLERRP "EXECSQL PREPARE S2 INTO :OUTREC2 FROM :SQLSTMT" IF (VERBOSE = Y) | (SQLCODE <> 0) THEN SAY "SQLCODE from C2 PREPARE is "SQLCODE SQLERRMC SQLERRP /*******************************************************************/ /* Open Cursor for reading through ZMCOD_TABLESPACE and fetch */ /* the first row. */ /*******************************************************************/ "EXECSQL OPEN C1" IF (VERBOSE = Y) | (SQLCODE <> 0) THEN SAY "SQLCODE from MAINLOOP OPEN is "SQLCODE "EXECSQL FETCH C1 USING DESCRIPTOR :OUTREC " IF (VERBOSE = Y) | (SQLCODE <> 0) THEN SAY "SQLCODE from MAINLOOP FETCH is "SQLCODE /*******************************************************************/ /* Set loop counter and loop while rows are found */ /*******************************************************************/ counttotal = 0 DO WHILE SQLCODE = 0 IF (VERBOSE = Y) | (SQLCODE <> 0) THEN SAY counttotal "Fetched IX is "OUTREC.5.SQLDATA /*******************************************************************/ /* Open cursor in SYSTABLESPACE join and read new fields */ /*******************************************************************/ "EXECSQL OPEN C2 USING :OUTREC.5.SQLDATA" IF (VERBOSE = Y) | (SQLCODE <> 0) THEN SAY "SQLCODE from SYSTSSQL OPEN is "SQLCODE SQLERRMC SQLERRP "EXECSQL FETCH C2 USING DESCRIPTOR :OUTREC2" IF (VERBOSE = Y) | (SQLCODE <> 0) THEN SAY "SQLCODE from SYSTSSQL Fetch is "SQLCODE SQLERRMC SQLERRP /*******************************************************************/ /* setup update statement for ZMCOD_TABLESPACE and execute */ /*******************************************************************/
00690001 00700000 00710001 00720001 00730000 00740000 00750001 00760001 00770000 00780001 00790001 00800000 00810000 00820000 00830000 00840000 00850000 00860000 00870001 00880001 00890000 00900001 00910001 00920000 00930000 00940000 00950000 00960000 00970000 00980000 00990001 01000001 01010000 01020000 01030000 01040000 01050000 01060000 01070000 01080001 01090000 01100000 01110001 01120000 01130000 01140000 01150000 01160000 01170000
194
SAP on DB2 UDB for OS/390 and z/OS: Multiple Components in One Database (MCOD)
UPDATESQL = "UPDATE "TRGOWNER".ZMCOD_INDEXES SET ", "TRGDBID = "OUTREC2.1.SQLDATA", ", "TRGIPREFIX = '"OUTREC2.2.SQLDATA"', ", "TRGISOBID = "OUTREC2.3.SQLDATA", ", "TRGINDEXSPACE = '"OUTREC2.4.SQLDATA"' ", "WHERE CURRENT OF C1" "EXECSQL "UPDATESQL IF (VERBOSE = Y) | (SQLCODE <> 0) THEN Say "SQLCODE from UPDATESQL is "SQLCODE SQLERRMC "EXECSQL CLOSE C2" IF (VERBOSE = Y) | (SQLCODE <> 0) THEN SAY "SQLCODE from UPDATESQL CLOSE is "SQLCODE /*******************************************************************/ /* Increment counter, fetch next record for cursor1 and continue */ /* loop */ /*******************************************************************/ counttotal=counttotal+1 "EXECSQL FETCH C1 USING DESCRIPTOR :OUTREC " IF (VERBOSE = Y) | (SQLCODE <> 0) THEN SAY "SQLCODE from MAINLOOP FETCH is "SQLCODE END /*******************************************************************/ /* Close main cursor and exit */ /*******************************************************************/ SAY "----------------------------------" SAY "Total indexes processed "counttotal SAY "----------------------------------" "EXECSQL CLOSE C1" SAY"SQLCODE from MAINLOOP CLOSE is "SQLCODE S_RC = RXSUBCOM('DELETE','DSNREXX','DSNREXX')
01180000 01190001 01200000 01210001 01220000 01230000 01260001 01270000 01280000 01290000 01300001 01310001 01320000 01330000 01340000 01350000 01360000 01370000 01380000 01390000 01400001 01410001 01420000 01430000 01440000 01450000 01460000 01470000 01480000 01490000 01500000 01510000 01520000 01530000 01540000
195
//RUNREXX EXEC PGM=IKJEFT01,DYNAMNBR=20 //STEPLIB DD DSN=DB7T7.SDSNEXIT,DISP=SHR // DD DSN=DB7T7.SDSNLOAD,DISP=SHR //SYSEXEC DD DISP=SHR,DSN=SAPRES2.MCOD.REXX //OUTDDDB DD SYSOUT=* //OUTDDTS DD SYSOUT=* //OUTDDTB DD SYSOUT=* //OUTDDIX DD SYSOUT=* //OUTDDRE DD SYSOUT=* //SYSTSPRT DD SYSOUT=* //SYSTSIN DD * %POSTDDL DB7S SAPR3 '710' DB7T SAPBLU '710' MCDBLU BLU SAPR3 %POSTDDL2 DB7S SAPR3 '710' DB7T SAPBLU '710' MCDBLU BLU SAPR3 //*
196
SAP on DB2 UDB for OS/390 and z/OS: Multiple Components in One Database (MCOD)
Appendix C.
197
198
SAP on DB2 UDB for OS/390 and z/OS: Multiple Components in One Database (MCOD)
GRANTVW = 'N', GRANTSG = 'N', NEWDB = 'A000X02A', NEWTSSG = '', NEWIXSG = '', NEWSQLID = 'SAPBLU', SPCALLOC = 'DEFINED', COMMITFR = 'N', DEFAULTS = 'R', TGTDB2 = '710'; DB='A000X00V', TS=''; /*
In this example: DB2 Admin is invoked for database A000X00Y (DB=A000X00Y) that is being renamed to A000X02A (NEWDB = A000X02A). This JCL generates statements for CREATE DATABASE (GENDB=Y). Other jobs for creating DDL for other objects would use parameters GENTS, GENTABLE, and GENINDEX. The generated DDL is appended to the SAPRES4.MRGBLU.REXXFILE.DDLDB.UNTAIL file. The storage group name is renamed from SAP* to BLU* using the MASK parameter.
JCLGEN
In Example C-2, we provide the REXX procedure used to generate JCL to invoke DB2 Admin. The source of this procedure (the JCLGEN.RXX file) is also part of the additional material that can be downloaded from the Internet (see Appendix E, Additional material on page 265).
Example: C-2 REXX procedure to generate JCL to invoke DB2 Admin
/****************************************************************/ /* REXXSQL REXX routine name: JCLGEN This routine is used to generate JCL for invoking DB2 Administration Tool in batch. To simplify the REXX it uses the following external subroutines: JCLGENDB (for generating JCL for CREATE DATABASE) JCLGENTS (for generating JCL for CREATE TABLESPACE) JCLGENTB (for generating JCL for CREATE TABLE) JCLGENIX (for generating JCL for CREATE INDEX)
199
The logic of the routine is: Loop through the ZMCOD_DATABASE table. For each database: - call subroutine JCLGENDB for database JCL - call subroutine JCLGENTS for tablespace JCL - call subroutine JCLGENTB for table JCL - call subroutine JCLGENIX for index JCL Parameters to call this procedure: METADATA_SSID Target DB2 subsystem containing metadata tables METADATA_OWNER Owner of the metadata tables in target system DATASET_PREFIX Prefix for the dataset names to generate DDL & JCL into AUTHID AUTHID for Admin Tool to use Note that this REXX routine needs to run against the metadata tables located on the target DB2 system. Review the parameters to ensure this. *******************************************************************/ /* TRACE(R) */ PARSE ARG METADATA_SSID METADATA_OWNER DATASET_PREFIX AUTHID SAY ' ' SAY 'JCLGEN executing in DB2 subsystem' METADATA_SSID SAY ' using metadata from table ' METADATA_OWNER'.ZMCOD_DATABASE' SAY ' and SQL authority of ' AUTHID SAY ' JCL will be generated into datasets prefixed' DATASET_PREFIX SAY ' ' /***************************************************************/ /* Initialize variables for use within this routine */ /***************************************************************/ SRC.DB2REL='999' SRC.DB='DDDDDDDD' SRC.SSID='SSSS' SRC.STOG3='GGG' SRC.SCHEMA='SSSSSSSS' TARG.DB='DDDDDDDD' TARG.DB2REL='999' TARG.OWNER='OOOOOOOO' TARG.SQLID='SSSSSSSS' TARG.STOG3='GGG' /*******************************************************************/ /* Add DSNREXX to the host command environment table if not there. */ /*******************************************************************/ 'SUBCOM DSNREXX' IF RC THEN ,
200
SAP on DB2 UDB for OS/390 and z/OS: Multiple Components in One Database (MCOD)
S_RC = RXSUBCOM('ADD','DSNREXX','DSNREXX') ADDRESS DSNREXX /*******************************************************************/ /* Connect to TARGET DB2 subsystem */ /*******************************************************************/ 'CONNECT' METADATA_SSID /***************************************************************/ /* Setup the cursor for reading from the ZMCOD_DATABASE table */ /* The ZMCOD_DATABASE table contains one row for every database*/ /* being merged. */ /***************************************************************/ SQLSTMT = "SELECT SRCDBNAME, SRCRELEASE, SRCSSID, TRGDBNAME, " SQLSTMT = SQLSTMT " TRGRELEASE, TRGSCHEMA, SRCSTOGROUP, " SQLSTMT = SQLSTMT " TRGSTOGROUP, SRCSCHEMA " SQLSTMT = SQLSTMT " FROM " METADATA_OWNER".ZMCOD_DATABASE " SQLSTMT = SQLSTMT " ORDER BY SRCDBNAME " /* SAY "JCLGEN SQLSTMT is " SQLSTMT */ "EXECSQL DECLARE C1 CURSOR FOR S1" IF SQLCODE <> 0 THEN DO SAY "JCLGEN SQLCODE from DECLARE is "SQLCODE SQLERRMC SQLERRD.5 EXIT(12) END ELSE NOP "EXECSQL PREPARE S1 FROM :SQLSTMT" IF SQLCODE <> 0 THEN DO SAY "JCLGEN SQLCODE from PREPARE is "SQLCODE SQLERRMC SQLERRD.5 EXIT(12) END ELSE NOP /* Open Cursor */ "EXECSQL OPEN C1" IF SQLCODE <> 0 THEN DO SAY "JCLGEN SQLCODE from OPEN is "SQLCODE SQLERRMC SQLERRD.5 EXIT(12) END ELSE NOP
/***************************************************************/ /* Loop through each database record */ /***************************************************************/ "EXECSQL FETCH C1 INTO " || ,
201
" :SRC.DB, :SRC.DB2REL, :SRC.SSID, :TARG.DB," || , " :TARG.DB2REL, :TARG.OWNER, :SRC.STOG, :TARG.STOG, :SRC.SCHEMA" IF SQLCODE <> 0 THEN DO SAY "JCLGEN SQLCODE from FIRST FETCH is "SQLCODE SQLERRMC SQLERRD.5 EXIT(12) END ELSE NOP /* While the fetches are OK, continue to loop loopctr=0 StepsInJob=0 ADDJOBCARD='Y' DO WHILE SQLCODE = 0 CALL GETSTOG3 /* Get first 3 chars of stogroup for JCL Mask */ */
SAY 'JCLGEN Processing database 'SRC.DB, ' (renamed to:' TARG.DB ')' /* Call external subroutines to generate JCL JCLGENDB (for generating JCL for CREATE DATABASE) JCLGENTS (for generating JCL for CREATE TABLESPACE) JCLGENTB (for generating JCL for CREATE TABLE) JCLGENIX (for generating JCL for CREATE INDEX) Strip off leading and trailing spaces off parameters ADDRESS TSO CALL JCLGENDB STRIP(SRC.DB), STRIP(SRC.DB2REL), STRIP(SRC.SSID), STRIP(TARG.DB), STRIP(TARG.DB2REL), STRIP(TARG.OWNER), STRIP(TARG.SQLID), STRIP(SRC.STOG3), STRIP(TARG.STOG3), STRIP(AUTHID), ADDJOBCARD, STRIP(SRC.SCHEMA), DATASET_PREFIX CALL JCLGENTS STRIP(SRC.DB), STRIP(SRC.DB2REL), STRIP(SRC.SSID), STRIP(TARG.DB), STRIP(TARG.DB2REL), STRIP(TARG.OWNER),
*/
202
SAP on DB2 UDB for OS/390 and z/OS: Multiple Components in One Database (MCOD)
STRIP(TARG.SQLID), STRIP(SRC.STOG3), STRIP(TARG.STOG3), STRIP(AUTHID), ADDJOBCARD, STRIP(SRC.SCHEMA), DATASET_PREFIX CALL JCLGENTB STRIP(SRC.DB), STRIP(SRC.DB2REL), STRIP(SRC.SSID), STRIP(TARG.DB), STRIP(TARG.DB2REL), STRIP(TARG.OWNER), STRIP(TARG.SQLID), STRIP(SRC.STOG3), STRIP(TARG.STOG3), STRIP(AUTHID), ADDJOBCARD, STRIP(SRC.SCHEMA), DATASET_PREFIX CALL JCLGENIX STRIP(SRC.DB), STRIP(SRC.DB2REL), STRIP(SRC.SSID), STRIP(TARG.DB), STRIP(TARG.DB2REL), STRIP(TARG.OWNER), STRIP(TARG.SQLID), STRIP(SRC.STOG3), STRIP(TARG.STOG3), STRIP(AUTHID), ADDJOBCARD, STRIP(SRC.SCHEMA), DATASET_PREFIX loopctr=loopctr+1 /* prevent infinite loop */ IF loopctr = 100000 THEN /* or just limit to speed up testing DO SAY 'Stopped after ' loopctr ' databases ' EXIT(12) END ELSE NOP
*/
/* Insert Jobcard every 250 steps (JES limit is 250 steps per job) */ StepsInJob = StepsInJob + 1 IF StepsInJob > 250 THEN DO SAY 'JCLGEN New jobcard being generated after' StepsInJob 'steps'
203
ADDJOBCARD = 'Y' StepsInJob = 0 END ELSE ADDJOBCARD = 'N' /* Read the next database record */ ADDRESS DSNREXX "EXECSQL FETCH C1 INTO " || , " :SRC.DB, :SRC.DB2REL, :SRC.SSID, :TARG.DB," || , " :TARG.DB2REL, :TARG.OWNER, :SRC.STOG, :TARG.STOG, :SRC.SCHEMA" IF (SQLCODE = 0) | (SQLCODE = 100) THEN NOP ELSE DO SAY "JCLGEN SQLCODE from FETCH NEXT is "SQLCODE SQLERRMC SQLERRD.5 EXIT(12) END END /***************************************************************/ /* Cleanup and exit */ /***************************************************************/ /* Close Cursor */ "EXECSQL CLOSE C1" S_RC = RXSUBCOM('DELETE','DSNREXX','DSNREXX') EXIT /***************************************************************/ /* SUBROUTINES */ /***************************************************************/ /* Subroutine used to extract the first 3 characters of the */ /* current source and target stogroups */ /* This is used in the DB2 Admin JCL for masking. */ /***************************************************************/ GETSTOG3: /* Separate STOG into STOG3 and StogLast3Chars at position 4 PARSE VAR SRC.STOG SRC.STOG3 4 SRC.StogLast3Chars PARSE VAR TARG.STOG TARG.STOG3 4 TARG.StogLast3Chars RETURN /***************************************************************/ */
204
SAP on DB2 UDB for OS/390 and z/OS: Multiple Components in One Database (MCOD)
JCLGENDB
In Example C-3, we provide the REXX subroutine used to generate JCL for creating DDL for databases. The source of this subroutine (the JCLGENDB.RXX file) is also part of the additional material that can be downloaded from the Internet (see Appendix E, Additional material on page 265).
Example: C-3 REXX subroutine to generate JCL for creating DDL for databases
/****************************************************************/ /* REXXSQL REXX routine name: JCLGENDB (subroutine of REXX routine JCLGEN) Used to generate JCL for invoking the DB2 Administration Tool. This routine is called from the JCLGEN REXX routine for each database which is being merged. This routine then generates JCL based on this information. NOTE: The generated JCL will be run against the source DB2 system, so review at least these items in the JCL statements: - JOBCARD, including JOBPARM to direct job to source MVS system - SDSNLOAD/SDSNEXIT for the source DB2 system ****************************************************************/ /* Accept input values */ ARG SRC.DB, SRC.DB2REL, SRC.SSID, TARG.DB, TARG.DB2REL, TARG.OWNER, TARG.SQLID, SRC.STOG3, TARG.STOG3, AUTHID, ADDJOBCARD, SRC.SCHEMA, DATASET_PREFIX /* Write a jobcard if requested */ IF ADDJOBCARD = 'Y' THEN DO QUEUE "//SAPRES41 JOB (999,KEL),'GEN DB DDL',CLASS=A,MSGCLASS=T," QUEUE "// NOTIFY=&SYSUID,TIME=1440,REGION=0M,TYPRUN=HOLD " QUEUE "//JOBLIB DD DSN=DB7S7.SDSNEXIT,DISP=SHR QUEUE "// DD DSN=DB7S7.SDSNLOAD,DISP=SHR QUEUE "// DD DISP=SHR,DSN=ADB.V4R1M0.SADBLLIB
205
QUEUE QUEUE QUEUE QUEUE QUEUE QUEUE QUEUE END ELSE NOP
"/*JOBPARM SYSAFF=SC42,L=9999 " "//*************************************************************" "//* " "//* JCL TO CALL DB2 ADMINISTRATION TOOL TO GENERATE DDL FOR " "//* CREATING DATABASES " "//* " "//*************************************************************"
/* Put JCL into a queue (fifo stack) and write them to database JCL */ QUEUE "//********************************************************************" QUEUE "//* CREATE DATABASE STATEMENT FOR DATABASE "TARG.DB" " QUEUE "//********************************************************************" QUEUE "//"SRC.DB" EXEC PGM=IKJEFT01,DYNAMNBR=100 " QUEUE "//SYSTSPRT DD SYSOUT=* " QUEUE "//SYSTSIN DD * " QUEUE " DSN SYSTEM("SRC.SSID") " QUEUE " RUN PROG(ADB2GEN) PLAN(ADB2GEN) PARMS('/MASK') " QUEUE " END " QUEUE "/* " QUEUE "//MASKS DD * " QUEUE " SGNAME:"SRC.STOG3"*,"TARG.STOG3"* " QUEUE "/* " QUEUE "//SQL DD DISP=MOD, " QUEUE "// DSN="DATASET_PREFIX".DDLDB.UNTAIL " QUEUE "//SYSPRINT DD SYSOUT=* " QUEUE "//IN DD * " QUEUE " DB2SYS = '"SRC.SSID"' " QUEUE " DB2ALOC = '', " QUEUE " DB2SERV = '"SRC.SSID"', " QUEUE " DB2AUTH = '"AUTHID"', " QUEUE " DB2REL = '"SRC.DB2REL"', " QUEUE " RUNSQLID = '"TARG.OWNER"', " QUEUE " GENSG = 'N', " QUEUE " GENDB = 'Y', " QUEUE " GENTS = 'N', " QUEUE " GENTABLE = 'N', " QUEUE " GENVIEW = 'N', " QUEUE " GENINDEX = 'N', " QUEUE " GENSYN = 'N', " QUEUE " GENALIAS = 'N', " QUEUE " GENLABEL = 'N', " QUEUE " GENCOMM = 'N', " QUEUE " GENRELS = 'N', " QUEUE " GENTRIG = 'N', " QUEUE " GRANTDB = 'N', " QUEUE " GRANTTS = 'N', " QUEUE " GRANTTAB = 'N', "
206
SAP on DB2 UDB for OS/390 and z/OS: Multiple Components in One Database (MCOD)
QUEUE QUEUE QUEUE QUEUE QUEUE QUEUE QUEUE QUEUE QUEUE QUEUE QUEUE QUEUE
" GRANTVW = 'N', " GRANTSG = 'N', " NEWDB = '"TARG.DB"', " NEWTSSG = '', " NEWIXSG = '', " NEWSQLID = '"TARG.OWNER"', " SPCALLOC = 'DEFINED', " COMMITFR = 'N', " DEFAULTS = 'R', " TGTDB2 = '"TARG.DB2REL"'; " DB='"SRC.DB"', TS=''; "/*
" " " " " " " " " " " "
/* Write the JCL to the output file */ "EXECIO * DISKW JCLDB " IF rc <> 0 THEN DO SAY 'Error writing to JCLDB ' rc EXIT END ELSE NOP RETURN
JCLGENTS
In Example C-4, we provide the REXX subroutine used to generate JCL for creating DDL for tablespaces. The source of this subroutine (the JCLGENTS.RXX file) is also part of the additional material that can be downloaded from the Internet (see Appendix E, Additional material on page 265).
Example: C-4 REXX subroutine to generate JCL for creating DDL for tablespaces
/****************************************************************/ /* REXXSQL REXX routine name: JCLGENTS (subroutine of REXX routine JCLGEN) Used to generate JCL for invoking the DB2 Administration Tool. This routine is called from the JCLGEN REXX routine for each database which is being merged. This routine then generates JCL for invoking the DB2 Administration Tool to create the tablespace contained within that database. NOTE: The generated JCL will be run against the source DB2 system, so review at least these items before generating the JCL: - JOBCARD, including JOBPARM to direct job to source MVS system - SDSNLOAD/SDSNEXIT for the source DB2 system
207
****************************************************************/ /* Accept input values ARG SRC.DB, SRC.DB2REL, SRC.SSID, TARG.DB, TARG.DB2REL, TARG.OWNER, TARG.SQLID, SRC.STOG3, TARG.STOG3, AUTHID, ADDJOBCARD, SRC.SCHEMA, DATASET_PREFIX */
/* Write a jobcard if requested */ IF ADDJOBCARD = 'Y' THEN DO QUEUE "//SAPRES42 JOB (999,KEL),'GEN TS DDL',CLASS=A,MSGCLASS=T, " QUEUE "// NOTIFY=&SYSUID,TIME=1440,REGION=0M,TYPRUN=HOLD " QUEUE "//JOBLIB DD DSN=DB7S7.SDSNEXIT,DISP=SHR " QUEUE "// DD DSN=DB7S7.SDSNLOAD,DISP=SHR " QUEUE "// DD DISP=SHR,DSN=ADB.V4R1M0.SADBLLIB " QUEUE "/*JOBPARM SYSAFF=SC42,L=9999 " QUEUE "//*************************************************************" QUEUE "//* " QUEUE "//* JCL TO CALL DB2 ADMINISTRATION TOOL TO GENERATE DDL FOR " QUEUE "//* CREATING TABLESPACES FOR A GIVEN DATABASE " QUEUE "//* " QUEUE "//*************************************************************" END ELSE NOP /* Put lines into a queue (fifo stack) and write them to outdd */ QUEUE "//********************************************************************" QUEUE "//* CREATE TABLESPACE STATEMENTS FOR DATABASE "TARG.DB" " QUEUE "//********************************************************************" QUEUE "//"SRC.DB" EXEC PGM=IKJEFT01,DYNAMNBR=100 " QUEUE "//SYSTSPRT DD SYSOUT=* " QUEUE "//SYSTSIN DD * " QUEUE " DSN SYSTEM("SRC.SSID") " QUEUE " RUN PROG(ADB2GEN) PLAN(ADB2GEN) PARMS('/MASK') " QUEUE " END " QUEUE "/* " QUEUE "//MASKS DD * " QUEUE " SGNAME:"SRC.STOG3"*,"TARG.STOG3"* "
208
SAP on DB2 UDB for OS/390 and z/OS: Multiple Components in One Database (MCOD)
QUEUE QUEUE QUEUE QUEUE QUEUE QUEUE QUEUE QUEUE QUEUE QUEUE QUEUE QUEUE QUEUE QUEUE QUEUE QUEUE QUEUE QUEUE QUEUE QUEUE QUEUE QUEUE QUEUE QUEUE QUEUE QUEUE QUEUE QUEUE QUEUE QUEUE QUEUE QUEUE QUEUE QUEUE QUEUE QUEUE QUEUE QUEUE
"/* "//SQL DD DISP=MOD, "// DSN="DATASET_PREFIX".DDLTS.UNTAIL "//SYSPRINT DD SYSOUT=* "//IN DD * " DB2SYS = '"SRC.SSID"' " DB2ALOC = '', " DB2SERV = '"SRC.SSID"', " DB2AUTH = '"AUTHID"', " DB2REL = '"SRC.DB2REL"', " RUNSQLID = '"TARG.OWNER"', " GENSG = 'N', " GENDB = 'N', " GENTS = 'Y', " GENTABLE = 'N', " GENVIEW = 'N', " GENINDEX = 'N', " GENSYN = 'N', " GENALIAS = 'N', " GENLABEL = 'N', " GENCOMM = 'N', " GENRELS = 'N', " GENTRIG = 'N', " GRANTDB = 'N', " GRANTTS = 'N', " GRANTTAB = 'N', " GRANTVW = 'N', " GRANTSG = 'N', " NEWDB = '"TARG.DB"', " NEWTSSG = '', " NEWIXSG = '', " NEWSQLID = '"TARG.OWNER"', " SPCALLOC = 'DEFINED', " COMMITFR = 'N', " DEFAULTS = 'R', " TGTDB2 = '"TARG.DB2REL"'; " DB='"SRC.DB"', TS=''; "/*
" " " " " " " " " " " " " " " " " " " " " " " " " " " " " " " " " " " " " "
/* Write the JCL to the output file */ "EXECIO * DISKW JCLTS " IF rc <> 0 THEN DO SAY 'Error writing to JCLTS ' rc EXIT END ELSE NOP RETURN
209
JCLGENTB
In Example C-5, we provide the REXX subroutine used to generate JCL for creating DDL for tables. The source of this subroutine (the JCLGENTB.RXX file) is also part of the additional material that can be downloaded from the Internet (see Appendix E, Additional material on page 265).
Example: C-5 REXX subroutine to generate JCL for creating DDL for tables
/****************************************************************/ /* REXXSQL REXX routine name: JCLGENTB (subroutine of REXX routine JCLGEN) Used to generate JCL for invoking the DB2 Administration Tool. This routine is called from the JCLGEN REXX routine for each database which is being merged. This routine then generates JCL for invoking the DB2 Administration Tool to create the the tables contained within this tablespace. NOTE: The generated JCL will be run against the source DB2 system, so review at least these items before generating the JCL: - JOBCARD, including JOBPARM to direct job to source MVS system - SDSNLOAD/SDSNEXIT for the source DB2 system ****************************************************************/ /* Accept input values ARG SRC.DB, SRC.DB2REL, SRC.SSID, TARG.DB, TARG.DB2REL, TARG.OWNER, TARG.SQLID, SRC.STOG3, TARG.STOG3, AUTHID, ADDJOBCARD, SRC.SCHEMA, DATASET_PREFIX */
/* Write a jobcard if requested */ IF ADDJOBCARD = 'Y' THEN DO QUEUE "//SAPRES43 JOB (999,KEL),'GEN TB DDL',CLASS=A,MSGCLASS=T," QUEUE "// NOTIFY=&SYSUID,TIME=1440,REGION=0M,TYPRUN=HOLD " QUEUE "//JOBLIB DD DSN=DB7S7.SDSNEXIT,DISP=SHR QUEUE "// DD DSN=DB7S7.SDSNLOAD,DISP=SHR
" "
210
SAP on DB2 UDB for OS/390 and z/OS: Multiple Components in One Database (MCOD)
QUEUE QUEUE QUEUE QUEUE QUEUE QUEUE QUEUE QUEUE END ELSE NOP
"// DD DISP=SHR,DSN=ADB.V4R1M0.SADBLLIB " "/*JOBPARM SYSAFF=SC42,L=9999 " "//*************************************************************" "//* " "//* JCL TO CALL DB2 ADMINISTRATION TOOL TO GENERATE DDL FOR " "//* CREATING TABLES FOR A GIVEN DATABASE " "//* " "//*************************************************************"
/* Put lines into a queue (fifo stack) and write them to outdd */ QUEUE "//********************************************************************" QUEUE "//* CREATE TABLE STATEMENTS FOR DATABASE "TARG.DB" " QUEUE "//********************************************************************" QUEUE "//"SRC.DB" EXEC PGM=IKJEFT01,DYNAMNBR=100 " QUEUE "//SYSTSPRT DD SYSOUT=* " QUEUE "//SYSTSIN DD * " QUEUE " DSN SYSTEM("SRC.SSID") " QUEUE " RUN PROG(ADB2GEN) PLAN(ADB2GEN) PARMS('/MASK') " QUEUE " END " QUEUE "/* " QUEUE "//MASKS DD * " QUEUE " SGNAME:"SRC.STOG3"*,"TARG.STOG3"* " QUEUE "/* " QUEUE "//SQL DD DISP=MOD, " QUEUE "// DSN="DATASET_PREFIX".DDLTB.UNTAIL " QUEUE "//SYSPRINT DD SYSOUT=* " QUEUE "//IN DD * " QUEUE " DB2SYS = '"SRC.SSID"' " QUEUE " DB2ALOC = '', " QUEUE " DB2SERV = '"SRC.SSID"', " QUEUE " DB2AUTH = '"AUTHID"', " QUEUE " DB2REL = '"SRC.DB2REL"', " QUEUE " RUNSQLID = '"TARG.OWNER"', " QUEUE " GENSG = 'N', " QUEUE " GENDB = 'N', " QUEUE " GENTS = 'N', " QUEUE " GENTABLE = 'Y', " QUEUE " GENVIEW = 'N', " QUEUE " GENINDEX = 'N', " QUEUE " GENSYN = 'N', " QUEUE " GENALIAS = 'N', " QUEUE " GENLABEL = 'N', " QUEUE " GENCOMM = 'N', " QUEUE " GENRELS = 'N', " QUEUE " GENTRIG = 'N', " QUEUE " GRANTDB = 'N', " QUEUE " GRANTTS = 'N', "
211
QUEUE QUEUE QUEUE QUEUE QUEUE QUEUE QUEUE QUEUE QUEUE QUEUE QUEUE QUEUE QUEUE
" GRANTTAB = 'N', " GRANTVW = 'N', " GRANTSG = 'N', " NEWDB = '"TARG.DB"', " NEWTSSG = '', " NEWIXSG = '', " NEWSQLID = '"TARG.OWNER"', " SPCALLOC = 'DEFINED', " COMMITFR = 'N', " DEFAULTS = 'R', " TGTDB2 = '"TARG.DB2REL"'; " DB='"SRC.DB"', TS=''; "/*
" " " " " " " " " " " " "
/* Write the JCL to the output file */ "EXECIO * DISKW JCLTB " IF rc <> 0 THEN DO SAY 'Error writing to JCLTB ' rc EXIT END ELSE NOP RETURN
JCLGENIX
In Example C-6, we provide the REXX subroutine used to generate JCL for creating DDL for indexes. The source of this subroutine (the JCLGENIX.RXX file) is also part of the additional material that can be downloaded from the Internet (see Appendix E, Additional material on page 265).
Example: C-6 REXX subroutine to generate JCL for creating DDL for indexes
/****************************************************************/ /* REXXSQL REXX routine name: JCLGENIX (subroutine of REXX routine JCLGEN) Used to generate JCL for invoking the DB2 Administration Tool. This routine is called from the JCLGEN REXX routine for each database which is being merged. This routine then generates JCL for invoking the DB2 Administration Tool to create all of the indexes within this database. NOTE: The generated JCL will be run against the source DB2 system, so review at least these items before generating the JCL: - JOBCARD, including JOBPARM to direct job to source MVS system - SDSNLOAD/SDSNEXIT for the source DB2 system
212
SAP on DB2 UDB for OS/390 and z/OS: Multiple Components in One Database (MCOD)
****************************************************************/ /* Accept input values ARG SRC.DB, SRC.DB2REL, SRC.SSID, TARG.DB, TARG.DB2REL, TARG.OWNER, TARG.SQLID, SRC.STOG3, TARG.STOG3, AUTHID, ADDJOBCARD, SRC.SCHEMA, DATASET_PREFIX */
/* Write a jobcard if requested */ IF ADDJOBCARD = 'Y' THEN DO QUEUE "//SAPRES44 JOB (999,KEL),'GEN IX DDL',CLASS=A,MSGCLASS=T, " QUEUE "// NOTIFY=&SYSUID,TIME=1440,REGION=0M,TYPRUN=HOLD " QUEUE "//JOBLIB DD DSN=DB7S7.SDSNEXIT,DISP=SHR " QUEUE "// DD DSN=DB7S7.SDSNLOAD,DISP=SHR " QUEUE "// DD DISP=SHR,DSN=ADB.V4R1M0.SADBLLIB " QUEUE "/*JOBPARM SYSAFF=SC42,L=9999 " QUEUE "//*************************************************************" QUEUE "//* " QUEUE "//* JCL TO CALL DB2 ADMINISTRATION TOOL TO GENERATE DDL FOR " QUEUE "//* CREATING INDEXES FOR A GIVEN DATABASE " QUEUE "//* " QUEUE "//*************************************************************" END ELSE NOP /* Put JCL into a queue (fifo stack) and write them to outdd */ QUEUE "//********************************************************************" QUEUE "//* CREATE INDEX STATEMENTS FOR DATABASE "TARG.DB" " QUEUE "//********************************************************************" QUEUE "//"SRC.DB" EXEC PGM=IKJEFT01,DYNAMNBR=100 " QUEUE "//SYSTSPRT DD SYSOUT=* " QUEUE "//SYSTSIN DD * " QUEUE " DSN SYSTEM("SRC.SSID") " QUEUE " RUN PROG(ADB2GEN) PLAN(ADB2GEN) PARMS('/MASK') " QUEUE " END " QUEUE "/* " QUEUE "//MASKS DD * " QUEUE " SGNAME:"SRC.STOG3"*,"TARG.STOG3"* "
213
QUEUE QUEUE QUEUE QUEUE QUEUE QUEUE QUEUE QUEUE QUEUE QUEUE QUEUE QUEUE QUEUE QUEUE QUEUE QUEUE QUEUE QUEUE QUEUE QUEUE QUEUE QUEUE QUEUE QUEUE QUEUE QUEUE QUEUE QUEUE QUEUE QUEUE QUEUE QUEUE QUEUE QUEUE QUEUE QUEUE QUEUE QUEUE
"/* "//SQL DD DISP=MOD, "// DSN="DATASET_PREFIX".DDLIX.UNTAIL "//SYSPRINT DD SYSOUT=* "//IN DD * " DB2SYS = '"SRC.SSID"' " DB2ALOC = '', " DB2SERV = '"SRC.SSID"', " DB2AUTH = '"AUTHID"', " DB2REL = '"SRC.DB2REL"', " RUNSQLID = '"TARG.OWNER"', " GENSG = 'N', " GENDB = 'N', " GENTS = 'N', " GENTABLE = 'N', " GENVIEW = 'N', " GENINDEX = 'Y', " GENSYN = 'N', " GENALIAS = 'N', " GENLABEL = 'N', " GENCOMM = 'N', " GENRELS = 'N', " GENTRIG = 'N', " GRANTDB = 'N', " GRANTTS = 'N', " GRANTTAB = 'N', " GRANTVW = 'N', " GRANTSG = 'N', " NEWDB = '"TARG.DB"', " NEWTSSG = '', " NEWIXSG = '', " NEWSQLID = '"TARG.OWNER"', " SPCALLOC = 'DEFINED', " COMMITFR = 'N', " DEFAULTS = 'R', " TGTDB2 = '"TARG.DB2REL"'; " DB='"SRC.DB"', TS=''; "/*
" " " " " " " " " " " " " " " " " " " " " " " " " " " " " " " " " " " " " "
/* Write the JCL to the output file */ "EXECIO * DISKW JCLIX " IF rc <> 0 THEN DO SAY 'Error writing to JCLIX ' rc EXIT END ELSE NOP RETURN
214
SAP on DB2 UDB for OS/390 and z/OS: Multiple Components in One Database (MCOD)
JCL to run generation REXX procedure and submit the generated JCL
In Example C-7, we provide the JCL used to run the generation REXX procedure and submit the generated JCL. Keep in mind that this JCL must run on the target system, because the REXX procedures use the metadata tables in the target system, and the generated JCL invoking DB2 Admin must run on the source subsystem to extract information from the source DB2 catalog. The source of this JCL is also part of the additional material (the JCLGEN$.JCL file) that can be downloaded from the Internet (see Appendix E, Additional material on page 265).
Example: C-7 JCL used to run the generation REXX procedure
//SAPRES4J JOB (999,KEL),'JCLGEN$',CLASS=A,MSGCLASS=T, // NOTIFY=SAPRES4,REGION=0M /*JOBPARM SYSAFF=SC49,L=9999 //***************************************************************** //* //* JCL JOBSTREAM NAME: JCLGEN$ //* //***************************************************************** //* THIS JCL USES REXX TO CREATE JOBS FOR INVOKING THE //* THE DB2 ADMINISTRATION TOOL. THESE GENERATED JOBS ARE //* THEN SUBMITTED TO THE INTRDR. //* //* THIS JOBSTREAM NEEDS TO BE RUN ON THE TARGET DB2 SYSTEM BECAUSE //* THE JCLGEN REXX ROUTINE USES THE METADATA TABLES. //* ALTER PARAMETERS PASSED TO THE JCLGEN REXX ROUTINE TO //* SPECIFY THIS. //***************************************************************** //* //* DELETE AND REDEFINE DSETS WHICH JCL AND DDL WILL BE GENERATED INTO. //* //DSNTIC EXEC PGM=IDCAMS //SYSPRINT DD SYSOUT=* //SYSUDUMP DD SYSOUT=* //SYSIN DD * DELETE (SAPRES4.MERGBLU.REXXFILE.JCLDB) DELETE (SAPRES4.MERGBLU.REXXFILE.JCLTS) DELETE (SAPRES4.MERGBLU.REXXFILE.JCLTB) DELETE (SAPRES4.MERGBLU.REXXFILE.JCLIX) DELETE (SAPRES4.MERGBLU.REXXFILE.DDLDB.UNTAIL) DELETE (SAPRES4.MERGBLU.REXXFILE.DDLTS.UNTAIL) DELETE (SAPRES4.MERGBLU.REXXFILE.DDLTB.UNTAIL) DELETE (SAPRES4.MERGBLU.REXXFILE.DDLIX.UNTAIL) SET MAXCC=0
215
/* //ALLOCDSN EXEC PGM=IEFBR14 //JCLDB DD DSN=SAPRES4.MERGBLU.REXXFILE.JCLDB, // DISP=(,CATLG,DELETE), // UNIT=3390,VOL=SER=TOTDB7,SPACE=(CYL,(30,15)), // DCB=(RECFM=FB,LRECL=80,BLKSIZE=6400) //JCLTS DD DSN=SAPRES4.MERGBLU.REXXFILE.JCLTS, // DISP=(,CATLG,DELETE), // UNIT=3390,VOL=SER=TOTDB7,SPACE=(CYL,(30,15)), // DCB=(RECFM=FB,LRECL=80,BLKSIZE=6400) //JCLTB DD DSN=SAPRES4.MERGBLU.REXXFILE.JCLTB, // DISP=(,CATLG,DELETE), // UNIT=3390,VOL=SER=TOTDB7,SPACE=(CYL,(30,15)), // DCB=(RECFM=FB,LRECL=80,BLKSIZE=6400) //JCLIX DD DSN=SAPRES4.MERGBLU.REXXFILE.JCLIX, // DISP=(,CATLG,DELETE), // UNIT=3390,VOL=SER=TOTDB7,SPACE=(CYL,(30,15)), // DCB=(RECFM=FB,LRECL=80,BLKSIZE=6400) //DLLDB DD DSN=SAPRES4.MERGBLU.REXXFILE.DDLDB.UNTAIL, // DISP=(,CATLG,DELETE), // UNIT=3390,VOL=SER=TOTDB7,SPACE=(CYL,(15,15)), // DCB=(RECFM=FB,LRECL=80,BLKSIZE=6400) //DLLTS DD DSN=SAPRES4.MERGBLU.REXXFILE.DDLTS.UNTAIL, // DISP=(,CATLG,DELETE), // UNIT=3390,VOL=SER=TOTDB7,SPACE=(CYL,(15,15)), // DCB=(RECFM=FB,LRECL=80,BLKSIZE=6400) //DLLTB DD DSN=SAPRES4.MERGBLU.REXXFILE.DDLTB.UNTAIL, // DISP=(,CATLG,DELETE), // UNIT=3390,VOL=SER=TOTDB7,SPACE=(CYL,(15,15)), // DCB=(RECFM=FB,LRECL=80,BLKSIZE=6400) //DLLIX DD DSN=SAPRES4.MERGBLU.REXXFILE.DDLIX.UNTAIL, // DISP=(,CATLG,DELETE), // UNIT=3390,VOL=SER=TOTDB7,SPACE=(CYL,(15,15)), // DCB=(RECFM=FB,LRECL=80,BLKSIZE=6400) //* //* GENERATE JOBS FOR INVOKING THE DB2 ADMINISTRATION TOOL //* //* UPDATE THE PARAMETERS FOR CALLING JCLGEN REXX ROUTINE: //* 1. TARGET DB2 SUBSYSTEM CONTAINING METADATA TABLES //* 2. OWNER OF THE METADATA TABLES IN TARGET SYSTEM //* 3. PREFIX FOR THE DATASET NAMES TO GENERATE DDL & JCL INTO //* (THIS PREFIX NEEDS TO MATCH THE NAMES USED IN THIS JCL) //* 3. AUTHID FOR ADMIN TOOL TO USE //* UPDATE SDSNLOAD/SDSNEXIT FOR TARGET DB2 SUBSYSTEM. //* //JCLGEN EXEC PGM=IKJEFT01,DYNAMNBR=20,COND=(0,LT) //STEPLIB DD DSN=DB7T7.SDSNEXIT,DISP=SHR // DD DSN=DB7T7.SDSNLOAD,DISP=SHR //SYSEXEC DD DISP=SHR,DSN=SAPRES4.MERGBOOK.REXX
216
SAP on DB2 UDB for OS/390 and z/OS: Multiple Components in One Database (MCOD)
//JCLDB DD DISP=MOD,DSN=SAPRES4.MERGBLU.REXXFILE.JCLDB //JCLTS DD DISP=MOD,DSN=SAPRES4.MERGBLU.REXXFILE.JCLTS //JCLTB DD DISP=MOD,DSN=SAPRES4.MERGBLU.REXXFILE.JCLTB //JCLIX DD DISP=MOD,DSN=SAPRES4.MERGBLU.REXXFILE.JCLIX //SYSTSPRT DD SYSOUT=* //SYSTSIN DD * %JCLGEN DB7T SAPR3 SAPRES4.MERGBLU.REXXFILE SAPRES1 //* //* SUBMIT THE JOBS TO THE INTERNAL READER BECAUSE THEY ARE TOO LARGE //* TO EDIT AND SUBMIT IN ISPF //* //INTRDRDB EXEC PGM=IEBGENER,REGION=4096K,COND=(0,LT) //SYSPRINT DD SYSOUT=* //SYSUT1 DD DISP=SHR,DSN=SAPRES4.MERGBLU.REXXFILE.JCLDB //SYSUT2 DD SYSOUT=(A,INTRDR),DCB=(LRECL=80,RECFM=FB,BLKSIZE=80) //SYSIN DD DUMMY //* //INTRDRTS EXEC PGM=IEBGENER,REGION=4096K,COND=(0,LT) //SYSPRINT DD SYSOUT=* //SYSUT1 DD DISP=SHR,DSN=SAPRES4.MERGBLU.REXXFILE.JCLTS //SYSUT2 DD SYSOUT=(A,INTRDR),DCB=(LRECL=80,RECFM=FB,BLKSIZE=80) //SYSIN DD DUMMY //* //INTRDRTB EXEC PGM=IEBGENER,REGION=4096K,COND=(0,LT) //SYSPRINT DD SYSOUT=* //SYSUT1 DD DISP=SHR,DSN=SAPRES4.MERGBLU.REXXFILE.JCLTB //SYSUT2 DD SYSOUT=(A,INTRDR),DCB=(LRECL=80,RECFM=FB,BLKSIZE=80) //SYSIN DD DUMMY //* //INTRDRIX EXEC PGM=IEBGENER,REGION=4096K,COND=(0,LT) //SYSPRINT DD SYSOUT=* //SYSUT1 DD DISP=SHR,DSN=SAPRES4.MERGBLU.REXXFILE.JCLIX //SYSUT2 DD SYSOUT=(A,INTRDR),DCB=(LRECL=80,RECFM=FB,BLKSIZE=80) //SYSIN DD DUMMY
TAILORTS
In Example C-8 on page 218, we provide the REXX procedure used to reduce the primary and secondary quantity allocations in the CREATE TABLESPACE statements generated by DB2 Admin. The source of this procedure (the
217
TAILORTS.RXX file) is also part of the additional material that can be downloaded from the Internet (see Appendix E, Additional material on page 265).
Example: C-8 REXX procedure to tailor CREATE TABLESPACE statements
/****************************************************************/ /* REXXSQL REXX routine name: TAILORTS This routine will read through the untailored DDL file which contains CREATE TABLESPACE statements. For the CREATE TABLESPACE statement it will reduce the PRIQTY and SECQTY to small values. The tailored DDL is then written to the output file. ****************************************************************/ /* TRACE(R) */ SAY ' ' SAY 'TAILORTS executing.' SAY ' ' /* Read the first record */ "EXECIO 0 DISKR DDLTSIN (OPEN" "EXECIO 1 DISKR DDLTSIN" IF rc <> 0 THEN DO SAY 'TAILORTS Error opening DDLTSIN input file. rc=' rc EXIT(12) END ELSE NOP /* Open output file which will contain tailored DDL */ "EXECIO 0 DISKW DDLTSOUT (OPEN" IF rc <> 0 THEN DO SAY 'TAILORTS Error opening DDLTSOUT file. rc=' rc EXIT(12) END ELSE NOP DO WHILE RC = 0 PULL currline /* If this line contains PRIQTY then it's for CREATE TABLESPACE.
218
SAP on DB2 UDB for OS/390 and z/OS: Multiple Components in One Database (MCOD)
Reduce the PRIQTY and SECQTY to small values. These values provide adequate space for creating the empty tablespaces */ IF WORD(currline,1) = 'PRIQTY' THEN DO currline = "PRIQTY 240 SECQTY 3600" END ELSE NOP PUSH currline "EXECIO 1 DISKW DDLTSOUT" /* Write curr record */ IF rc <> 0 THEN DO SAY 'TAILORTS Error writing to DDLTSOUT output file. rc=' rc SAY 'current line is:' currline EXIT(12) END ELSE NOP "EXECIO 1 DISKR END "EXECIO 0 DISKR DDLTSIN (FINIS" "EXECIO 0 DISKW DDLTSOUT (FINIS" /* Close the files */ DDLTSIN" /* Read next record */
TAILORIX
In Example C-9, we provide the REXX procedure used to reduce the primary and secondary quantity allocations in the CREATE INDEX statements generated by DB2 Admin. The source of this procedure (the TAILORIX.RXX file) is also part of the additional material that can be downloaded from the Internet (see Appendix E, Additional material on page 265).
Example: C-9 REXX procedure to tailor CREATE INDEX statements
/****************************************************************/ /* REXXSQL REXX routine name: TAILORIX This routine will read through and untailored DDL file which contains CREATE INDEX statements. For each CREATE INDEX statement it will reduce the PRIQTY and SECQTY to small values. The tailored DDL is then written to the output file.
219
****************************************************************/ /* TRACE(R) */ SAY ' ' SAY 'TAILORIX executing.' SAY ' ' /* Read the first record */ "EXECIO 0 DISKR DDLIXIN (OPEN" "EXECIO 1 DISKR DDLIXIN" IF rc <> 0 THEN DO SAY 'TAILORIX Error opening DDLIXIN input file. rc=' rc EXIT(12) END ELSE NOP /* Open output file which will contain tailored DDL */ "EXECIO 0 DISKW DDLIXOUT (OPEN" IF rc <> 0 THEN DO SAY 'TAILORIX Error opening DDLIXOUT file. rc=' rc EXIT(12) END ELSE NOP DO WHILE RC = 0 PULL currline /* If this line contains PRIQTY then it's for CREATE INDEX. Reduce the PRIQTY and SECQTY to small values. These values provide adequate space for creating the empty indexes */ IF WORD(currline,1) = 'PRIQTY' THEN DO currline = " PRIQTY 240 SECQTY 3600" END ELSE NOP PUSH currline "EXECIO 1 DISKW DDLIXOUT" /* Write curr record */ IF rc <> 0 THEN DO SAY 'TAILORIX Error writing to DDLIXOUT output file. rc=' rc EXIT(12) END ELSE NOP "EXECIO 1 DISKR END DDLIXIN" /* Read next record */
220
SAP on DB2 UDB for OS/390 and z/OS: Multiple Components in One Database (MCOD)
TAILORTB
In Example C-10, we provide the REXX procedure used to append the OBID clause to the CREATE TABLE statements generated by DB2 Admin. The source of this procedure (the TAILORTB.RXX file) is also part of the additional material that be downloaded from the Internet (see Appendix E, Additional material on page 265).
Example: C-10 REXX procedure to tailor CREATE TABLE statements
/****************************************************************/ /* REXXSQL REXX routine name: TAILORTB This routine will read through the untailored DDL file which contains CREATE TABLE statements. For the CREATE TABLE statements it will add the OBID we want to use when defining the table in the target system. The tailored DDL is then written to the output file. Parameters to call this procedure: METADATA_SSID Target DB2 subsystem containing metadata tables METADATA_OWNER Owner of the metadata tables in target system Note that this routine needs to run against the metadata tables located on the target DB2 system. Review the parameters to ensure this. ****************************************************************/ /* TRACE(R) */ PARSE ARG METADATA_SSID METADATA_OWNER SAY ' ' SAY 'TAILORTB executing in DB2 subsystem' METADATA_SSID SAY ' using metadata from table ' METADATA_OWNER'.ZMCOD_TABLES' SAY ' ' /*******************************************************************/ /* Add DSNREXX to the host command environment table if not there. */ /*******************************************************************/ 'SUBCOM DSNREXX'
221
IF RC THEN , S_RC = RXSUBCOM('ADD','DSNREXX','DSNREXX') ADDRESS DSNREXX /*******************************************************************/ /* Connect to TARGET DB2 subsystem containing metadata tables */ /*******************************************************************/ 'CONNECT' METADATA_SSID /***************************************************************/ /* Setup the cursor for reading from the ZMCOD_TABLES table. */ /* The ZMCOD_TABLES table contains one row for every database */ /* being merged. */ /***************************************************************/ SQLSTMT1 = "SELECT SRCTABOBID FROM " METADATA_OWNER".ZMCOD_TABLES " SQLSTMT1 = SQLSTMT1 " WHERE TRGSCHEMA = " ? " AND SRCTABLE = " ? "EXECSQL DECLARE C1 CURSOR FOR S1" IF SQLCODE <> 0 THEN DO SAY "TAILORTB from DECLARE is " SQLCODE SQLERRMC SQLERRD.5 EXIT(12) END ELSE NOP /* Return to the TSO environment so EXECIO will work */ ADDRESS TSO /* Open input file which contains untailored DDL and read the first record */ "EXECIO 0 DISKRU DDLTBIN (OPEN" "EXECIO 1 DISKRU DDLTBIN" IF rc <> 0 THEN DO SAY 'TAILORTB Error opening DDLTBIN input file. rc=' rc EXIT(12) END ELSE NOP /* Open output file which will contain tailored DDL */ "EXECIO 0 DISKW DDLTBOUT (OPEN" IF rc <> 0 THEN DO SAY 'TAILORTB Error opening DDLTBOUT file. rc=' rc EXIT(12) END ELSE NOP /* Read through each line of the input file DO WHILE RC = 0 PULL currline */
222
SAP on DB2 UDB for OS/390 and z/OS: Multiple Components in One Database (MCOD)
newline = currline /* If this line contains the CREATE TABLE statements then extract table name and creator. These will be used to determine the OBID to be used to create the table */ IF (WORD(currline,1) = 'CREATE') & (WORD(currline,2) = 'TABLE') THEN DO /* SAY 'Found the CREATE TABLE LINE ' */ currcreatortable = WORD(currline,3) /*extract CREATOR.TABLE */ PARSE VAR currcreatortable currcreator '.' currtable /* SAY 'Extracted ' currcreator 'and' currtable */ END ELSE NOP /* If this line starts with 'IN' and contains a ';' then it is the final line of the CREATE TABLE statements. Call subroutine to lookup the OBID and append the OBID clause to the line */ IF (WORD(currline,1) = 'IN') & (POS(';',currline) <> 0) THEN DO currobid = 'AA' CALL OBIDLookup currcreator, currtable, currobid /* Separate the line at the semicolon PARSE VAR currline startofline ';' endofline newline = startofline ' OBID ' currobid ' ;' END ELSE NOP /* Write the record, which may or may not have been changed to the output file */ PUSH newline "EXECIO 1 DISKW DDLTBOUT" IF rc <> 0 THEN DO SAY 'TAILORTB Error writing DDLTBOUT file. rc=' rc EXIT(12) END ELSE NOP "EXECIO 1 DISKRU DDLTBIN" END "EXECIO 0 DISKRU DDLTBIN (FINIS" /* Close the files */ "EXECIO 0 DISKW DDLTBOUT (FINIS" EXIT /***************************************************************/ /* SUBROUTINES */ /***************************************************************/ /* Read next input record */
*/
223
/* This subroutine will query the SAPR3.ZMCOD_TABLES table to */ /* obtain the OBID to be used to create the table */ /***************************************************************/ OBIDLOOKUP: ARG CURRCREATOR, CURRTABLE CURROBID = 'BB' /* Transfer to DSNREXX environment ADDRESS DSNREXX */
/* Prepare the SQL statement */ "EXECSQL PREPARE S1 FROM :SQLSTMT1" IF SQLCODE <> 0 THEN DO SAY "TAILORTB from PREPARE is " SQLCODE SQLERRMC SQLERRD.5 SAY "TAILORTB CURRCREATOR " CURRCREATOR " CURRTABLE "CURRTABLE EXIT(12) END ELSE NOP /* Setup the host variables. The creator and table names may have single or double quotes around them. The SQL query requires single quotes. So, use the STRIP command to remove whatever quotes may be on it. Then add the single quotes we require. */ CREATORNOQUOTES = STRIP(CURRCREATOR,B,'"') /* remove double quotes */ CREATORNOQUOTES = STRIP(CREATORNOQUOTES,B,"'") /* remove single quotes */ CREATORINQUOTES = "'"CREATORNOQUOTES"'" /* add single quotes */ TABLENOQUOTES = STRIP(CURRTABLE,B,'"') TABLENOQUOTES = STRIP(TABLENOQUOTES,B,"'") TABLEINQUOTES = "'"TABLENOQUOTES"'" /* remove double quotes */ /* remove single quotes */ /* add single quotes */
/* Open the cursor */ "EXECSQL OPEN C1 USING :CREATORINQUOTES, :TABLEINQUOTES " IF SQLCODE <> 0 THEN DO SAY "TAILORTB from OPEN C1 is " SQLCODE SQLERRMC SQLERRD.5 SAY "TAILORTB CREATORINQUOTES " CREATORINQUOTES SAY "TAILORTB TABLEINQUOTES " TABLEINQUOTES EXIT(12) END ELSE NOP /* Fetch the cursor "EXECSQL FETCH C1 INTO :CURROBID" IF SQLCODE <> 0 THEN DO */
224
SAP on DB2 UDB for OS/390 and z/OS: Multiple Components in One Database (MCOD)
SAY "TAILORTB SAY "TAILORTB SAY "TAILORTB SAY "TAILORTB SAY "TAILORTB EXIT(12) END ELSE NOP
from FETCH C1 is " SQLCODE SQLERRMC SQLERRD.5 CURRCREATOR " CURRCREATOR CURRTABLE " CURRTABLE CREATORINQUOTES " CREATORINQUOTES TABLEINQUOTES " TABLEINQUOTES
/* Close the cursor */ "EXECSQL CLOSE C1" IF SQLCODE <> 0 THEN DO SAY "TAILORTB from CLOSE C1 is " SQLCODE SQLERRMC SQLERRD.5 SAY "TAILORTB CREATORINQUOTES " CREATORINQUOTES SAY "TAILORTB TABLEINQUOTES " TABLEINQUOTES EXIT(12) END ELSE NOP /* Return to the TSO environment and exit subroutine ADDRESS TSO RETURN(CURROBID) */
225
//* THE OBID FOR THE NEW TABLES. //* //* ALTER PARAMETERS PASSED TO THE TAILOR REXX ROUTINE TO //* SPECIFY THIS. //***************************************************************** //* //* DELETE AND DEFINE DATASETS WHICH THE DDL WILL BE TAILORED INTO //* //DSNTIC EXEC PGM=IDCAMS //SYSPRINT DD SYSOUT=* //SYSUDUMP DD SYSOUT=* //SYSIN DD * DELETE (SAPRES4.MERGBLU.REXXFILE.DDLDB.TAILOR) DELETE (SAPRES4.MERGBLU.REXXFILE.DDLTS.TAILOR) DELETE (SAPRES4.MERGBLU.REXXFILE.DDLTB.TAILOR) DELETE (SAPRES4.MERGBLU.REXXFILE.DDLIX.TAILOR) SET MAXCC=0 /* //ALLOCDSN EXEC PGM=IEFBR14 //DDLDB DD DSN=SAPRES4.MERGBLU.REXXFILE.DDLDB.TAILOR, // DISP=(,CATLG,DELETE), // UNIT=3390,VOL=SER=TOTDB7,SPACE=(CYL,(15,15)), // DCB=(RECFM=FB,LRECL=80,BLKSIZE=6400) //DDLTS DD DSN=SAPRES4.MERGBLU.REXXFILE.DDLTS.TAILOR, // DISP=(,CATLG,DELETE), // UNIT=3390,VOL=SER=TOTDB7,SPACE=(CYL,(15,15)), // DCB=(RECFM=FB,LRECL=80,BLKSIZE=6400) //DDLTB DD DSN=SAPRES4.MERGBLU.REXXFILE.DDLTB.TAILOR, // DISP=(,CATLG,DELETE), // UNIT=3390,VOL=SER=TOTDB7,SPACE=(CYL,(15,15)), // DCB=(RECFM=FB,LRECL=80,BLKSIZE=6400) //DDLIX DD DSN=SAPRES4.MERGBLU.REXXFILE.DDLIX.TAILOR, // DISP=(,CATLG,DELETE), // UNIT=3390,VOL=SER=TOTDB7,SPACE=(CYL,(15,15)), // DCB=(RECFM=FB,LRECL=80,BLKSIZE=6400) //* //* DATABASE DDL REQUIRES NO TAILORING SO JUST COPY TO THE OUTPUT FILE //* //COPYDB EXEC PGM=IEBGENER,COND=(0,LT) //SYSPRINT DD SYSOUT=* //SYSUT1 DD DISP=SHR,DSN=SAPRES4.MERGBLU.REXXFILE.DDLDB.UNTAIL //SYSUT2 DD DISP=SHR,DSN=SAPRES4.MERGBLU.REXXFILE.DDLDB.TAILOR //SYSIN DD DUMMY //* //* RUN THE REXX ROUTINES TO TAILOR THE DDL //* //* UPDATE SDSNLOAD/SDSNEXIT FOR TARGET DB2 SUBSYSTEM. //* UPDATE THE PARAMETERS FOR CALLING TAILORTB REXX ROUTINE: //* 1. TARGET DB2 SUBSYSTEM CONTAINING METADATA TABLES
226
SAP on DB2 UDB for OS/390 and z/OS: Multiple Components in One Database (MCOD)
//* 2. OWNER OF THE METADATA TABLES IN TARGET SYSTEM //* (THE OTHER REXX ROUTINES DON'T ACCESS DB2 AND DONT REQUIRE //* AND PARAMETERS) //* //TAILOR EXEC PGM=IKJEFT01,DYNAMNBR=20,COND=(0,LT) //STEPLIB DD DSN=DB7T7.SDSNEXIT,DISP=SHR // DD DSN=DB7T7.SDSNLOAD,DISP=SHR //SYSEXEC DD DISP=SHR,DSN=SAPRES4.MERGBOOK.REXX //DDLTSIN DD DISP=OLD,DSN=SAPRES4.MERGBLU.REXXFILE.DDLTS.UNTAIL //DDLTSOUT DD DISP=OLD,DSN=SAPRES4.MERGBLU.REXXFILE.DDLTS.TAILOR //DDLTBIN DD DISP=OLD,DSN=SAPRES4.MERGBLU.REXXFILE.DDLTB.UNTAIL //DDLTBOUT DD DISP=OLD,DSN=SAPRES4.MERGBLU.REXXFILE.DDLTB.TAILOR //DDLIXIN DD DISP=OLD,DSN=SAPRES4.MERGBLU.REXXFILE.DDLIX.UNTAIL //DDLIXOUT DD DISP=OLD,DSN=SAPRES4.MERGBLU.REXXFILE.DDLIX.TAILOR //SYSTSPRT DD SYSOUT=* //SYSTSIN DD * %TAILORTS %TAILORTB DB7T SAPR3 %TAILORIX /*
Example C-13 on page 228 is a sample of the CREATE DATABASE DDL. The database name is changed during the generation process to avoid name clashes with databases that already exist in the target system.
227
Example C-14 is a sample of the CREATE TABLE DDL. Note that the primary and secondary quantities have been reduced to conserve disk space during the merge procedure.
Example: C-14 DDL for CREATE TABLESPACE
------------------------------------------------------------------------- DATABASE=A000X8X4 STOGROUP=BLUSTD -- TABLESPACE=A000X8X4.ABAPTREE ------------------------------------------------------------------------CREATE TABLESPACE ABAPTREE IN A000X8X4 USING STOGROUP BLUSTD PRIQTY 240 SECQTY 3600 FREEPAGE 3 PCTFREE 20 SEGSIZE 4 BUFFERPOOL BP2 LOCKSIZE ROW CCSID ASCII; -COMMIT;
Example C-15 is a sample of the CREATE TABLE DDL. We include the OBID clause so that the table will retain its OBID during the merge procedure.
Example: C-15 DDL for CREATE TABLE
------------------------------------------------------------------------TABLE=SAPBLU.ABAPTREE IN A000X8X4.ABAPTREE ------------------------------------------------------------------------CREATE TABLE SAPBLU.ABAPTREE (ID VARCHAR(6) NOT NULL WITH DEFAULT '000000' , REPNAME VARCHAR(40) NOT NULL WITH DEFAULT ' ' ,
228
SAP on DB2 UDB for OS/390 and z/OS: Multiple Components in One Database (MCOD)
Example C-16 is a sample of the CREATE INDEX DDL. We reduce the primary and secondary quantity to conserve disk space during the merge procedure.
Example: C-16 DDL for CREATE INDEX
------------------------------------------------------------------------- DATABASE=A000X8X4 -INDEX=SAPBLU.ABAPTREE~0 ON SAPBLU.ABAPTREE ------------------------------------------------------------------------CREATE UNIQUE INDEX SAPBLU."ABAPTREE~0" ON SAPBLU.ABAPTREE (ID ASC) USING STOGROUP BLUSTI PRIQTY 240 SECQTY 3600 CLUSTER BUFFERPOOL BP3 COPY NO; -COMMIT;
229
T0001."OBJECT" = 'DOMA' ;
230
SAP on DB2 UDB for OS/390 and z/OS: Multiple Components in One Database (MCOD)
The FILLERTS routine also generates DDL to drop the filler tablespaces, as follows. Example C-19 is a sample of the DROP TABLESPACE DDL used to drop filler tablespaces.
Example: C-19 DDL for DROP TABLESPACE for filler tablespaces
DROP DROP DROP DROP DROP DROP DROP DROP DROP TABLESPACE TABLESPACE TABLESPACE TABLESPACE TABLESPACE TABLESPACE TABLESPACE TABLESPACE TABLESPACE A000XAAA A000XAAA A000XAAA A000XAAA A000XAAA A000XAAA A000XAAA A000XAAA A000XAAA . . . . . . . . . FIL1 FIL2 FIL3 FIL4 FIL5 FIL6 FIL7 FIL8 FIL9 ; ; ; ; ; ; ; ; ;
231
232
SAP on DB2 UDB for OS/390 and z/OS: Multiple Components in One Database (MCOD)
Appendix D.
233
234
SAP on DB2 UDB for OS/390 and z/OS: Multiple Components in One Database (MCOD)
//* //BLUQURY // // // //SYSTSPRT //SYSTSIN //* //BLUQURS // // // //SYSTSPRT //SYSTSIN //* //BLUSKEL // // // //SYSTSPRT //SYSTSIN //* //BLUSTIN // // // //SYSTSPRT //SYSTSIN //*
DD DSN=SAPRES1.REXX.BLUQURY, UNIT=SYSDA,DISP=(,CATLG), SPACE=(TRK,(50,10,10)), DSORG=PO,RECFM=FB,LRECL=80,BLKSIZE=6160 DD SYSOUT=* DD DUMMY DD DSN=SAPRES1.REXX.BLUQURS, UNIT=SYSDA,DISP=(,CATLG), SPACE=(CYL,(100,10,10)), DSORG=PO,RECFM=FB,LRECL=1540,BLKSIZE=6160 DD SYSOUT=* DD DUMMY DD DSN=SAPRES1.REXX.BLUSKEL, UNIT=SYSDA,DISP=(,CATLG), SPACE=(TRK,(50,10,10)), DSORG=PO,RECFM=FB,LRECL=80,BLKSIZE=6160 DD SYSOUT=* DD DUMMY DD DSN=SAPRES1.REXX.BLUSTIN, UNIT=SYSDA,DISP=(,CATLG), SPACE=(CYL,(20,10,10)), DSORG=PO,RECFM=FB,LRECL=80,BLKSIZE=6160 DD SYSOUT=* DD DUMMY
235
$ZMCDBSR
The SQL query $ZMCDBSR, as shown in Example D-3 on page 237, can be used as the input member of the REXX procedure PQUERYTB to retrieve information related to the databases.
236
SAP on DB2 UDB for OS/390 and z/OS: Multiple Components in One Database (MCOD)
$ZMCINSR
The SQL query $ZMCINSR, as shown in Example D-4, can be used as the input member of the REXX procedure PQUERYTB to retrieve information related to the indexes.
Example: D-4 SQL query to retrieve information about indexes
-- Query against SAPR3.ZMCOD_DATABASE and SAPR3.ZMCOD_INDEXES -- used in SG24-6914 select IN.SRCDBNAME as ZM_SRCDBNAME , IN.SRCINDEXSPACE as ZM_SRCINDEXSPACE , IN.SRCPART as ZM_SRCPART , IN.SRCINDEX as ZM_SRCINDEX , IN.SRCSCHEMA as ZM_SRCSCHEMA , IN.SRCSSID as ZM_SRCSSID , IN.SRCDBID as ZM_SRCDBID , IN.SRCSPACE as ZM_SRCSPACE , IN.SRCISOBID as ZM_SRCISOBID , IN.SRCIPREFIX as ZM_SRCIPREFIX , IN.SRCPRIQTY as ZM_SRCPRIQTY , IN.SRCSTOGROUP as ZM_SRCSTOGROUP , IN.SRCVCAT as ZM_SRCVCAT , IN.TRGINDEX as ZM_TRGINDEX , IN.TRGINDEXSPACE as ZM_TRGINDEXSPACE , IN.TRGSCHEMA as ZM_TRGSCHEMA , DB.TRGDBNAME as ZM_TRGDBNAME ,
237
IN.TRGSSID as ZM_TRGSSID , IN.TRGDBID as ZM_TRGDBID , IN.TRGISOBID as ZM_TRGISOBID , IN.TRGIPREFIX as ZM_TRGIPREFIX , IN.TRGSTOGROUP as ZM_TRGSTOGROUP , IN.TRGVCAT as ZM_TRGVCAT from SAPR3.ZMCOD_INDEXES as IN, SAPR3.ZMCOD_DATABASE as DB where IN.SRCDBNAME = DB.SRCDBNAME order by ZM_SRCDBNAME , ZM_SRCINDEXSPACE , ZM_SRCPART
$ZMCTSSR
The SQL query $ZMCTSSR, as shown in Example D-5, can be used as the input member of the REXX procedure PQUERYTB to retrieve information related to the tablespaces.
Example: D-5 SQL query to retrieve information about tablespaces
-- Query against ZMCOD_TABLESPACE and -- used in SG24-6914 select TS.SRCSSID as ZM_SRCSSID TS.SRCTSNAME as ZM_SRCTSNAME TS.SRCDBNAME as ZM_SRCDBNAME TS.SRCDBID as ZM_SRCDBID TS.SRCPSID as ZM_SRCPSID TS.SRCRELEASE as ZM_SRCRELAESE TS.SRCPART as ZM_SRCPART TS.SRCSPACE as ZM_SRCSPACE TS.SRCIPREFIX as ZM_SRCIPREFIX TS.SRCSCHEMA as ZM_SRCSCHEMA TS.SRCSTOGROUP as ZM_SRCSTOGROUP TS.SRCVCAT as ZM_SRCVCAT TS.TRGSSID as ZM_TRGSSID TS.TRGPSID as ZM_TRGPSID TS.TRGTSNAME as ZM_TRGTSNAME DB.TRGDBNAME as ZM_TRGDBNAME TS.TRGDBID as ZM_TRGDBID TS.TRGRELEASE as ZM_TRGRELAESE TS.TRGIPREFIX as ZM_TRGIPREFIX TS.TRGSCHEMA as ZM_TRGSCHEMA TS.TRGSTOGROUP as ZM_TRGSTOGROUP ZMCOD_DATABASE
, , , , , , , , , , , , , , , , , , , , ,
238
SAP on DB2 UDB for OS/390 and z/OS: Multiple Components in One Database (MCOD)
TS.TRGVCAT as ZM_TRGVCAT from SAPR3.ZMCOD_TABLESPACE TS, SAPR3.ZMCOD_DATABASE DB where DB.SRCDBNAME = TS.SRCDBNAME order by ZM_SRCDBNAME, ZM_SRCPSID, ZM_SRCPART
PQUERYTB
The REXX procedure PQUERYTB can extract information from the metadata tables. It takes as input SQL queries located by default in SAPRES5.REXX.BLUQURY. The output is generated in SAPRES5.REXX.BLUQURS. Once the metadata tables are populated with all the information from the source and the target system, we use the following JCL, as shown in Example D-6, for invoking the REXX procedure PQUERYTB. Note the PQUERYTB is run against the target DB2 subsystem.
Example: D-6 Invocation of PQUERYTB
//SAPRES5A JOB (999,POK),'RUNREXX ',CLASS=A,MSGCLASS=T, // NOTIFY=&SYSUID,TIME=1440,REGION=0M,RESTART=HERE /*JOBPARM SYSAFF=SC42,L=9999 // JCLLIB ORDER=(DB7SU.PROCLIB) //HERE EXEC PGM=IEFBR14 //* //RUNREXX EXEC PGM=IKJEFT01,DYNAMNBR=20 //STEPLIB DD DSN=DB7S7.SDSNEXIT,DISP=SHR // DD DSN=DB7S7.SDSNLOAD,DISP=SHR //SYSEXEC DD DISP=SHR,DSN=SAPRES5.REXX.BLUCNTL //SYSTSPRT DD SYSOUT=* //SYSTSIN DD * %PQUERYTB INPMEMB=$ZMCDBSR DB2=T %PQUERYTB INPMEMB=$ZMCINSR DB2=T %PQUERYTB INPMEMB=$ZMCTSSR DB2=T
Example D-7 on page 240 shows the log of the REXX procedure PQUERYTB when we use as the input member (parameter INPMEMB) the SQL query $ZMCTSSR.
239
Example D-8 shows the output generated by the REXX procedure PQUERYTB.
Example: D-8 Output generated by PQUERYTB
EDIT SAPRES5.REXX.BLUQURS($ZMCTSSR) - 01.00 Columns 00001 00072 Command ===> Scroll ===> CSR 000001 -- Generated by Procedure PQUERYTB in Lib SYSEXEC -000002 -- Date 16/12/02 Time 07:05:26 -000003 -- using GLOBAL member BLUGLOB in library SAPRES5.REXX.BLUPARM -000004 -- using QUERY $ZMCTSSR in library SAPRES5.REXX.BLUQURY -000005 -- using DB2 Subsystem DBSSN -000006 -- Query against ZMCOD_TABLESPACE and ZMCOD_DATABASE -000007 -- used in SG24-6914 -000008 -- select -000009 -- TS.SRCSSID as ZM_SRCSSID , -000010 -- TS.SRCTSNAME as ZM_SRCTSNAME , -000011 -- TS.SRCDBNAME as ZM_SRCDBNAME , -000012 -- TS.SRCDBID as ZM_SRCDBID , -000013 -- TS.SRCPSID as ZM_SRCPSID , -000014 -- TS.SRCRELEASE as ZM_SRCRELAESE , -000015 -- TS.SRCPART as ZM_SRCPART , -000016 -- TS.SRCSPACE as ZM_SRCSPACE , -000017 -- TS.SRCIPREFIX as ZM_SRCIPREFIX , --
240
SAP on DB2 UDB for OS/390 and z/OS: Multiple Components in One Database (MCOD)
000018 000019 000020 000021 000022 000023 000024 000025 000026 000027 000028 000029 000030 000031 000032 000033 000034 000035 000036 000037 000038 000039 000040 000041 000042 ...... ......
-- TS.SRCSCHEMA as ZM_SRCSCHEMA , --- TS.SRCSTOGROUP as ZM_SRCSTOGROUP , --- TS.SRCVCAT as ZM_SRCVCAT , --- TS.TRGSSID as ZM_TRGSSID , --- TS.TRGPSID as ZM_TRGPSID , --- TS.TRGTSNAME as ZM_TRGTSNAME , --- DB.TRGDBNAME as ZM_TRGDBNAME , --- TS.TRGDBID as ZM_TRGDBID , --- TS.TRGRELEASE as ZM_TRGRELAESE , --- TS.TRGIPREFIX as ZM_TRGIPREFIX , --- TS.TRGSCHEMA as ZM_TRGSCHEMA , --- TS.TRGSTOGROUP as ZM_TRGSTOGROUP , --- TS.TRGVCAT as ZM_TRGVCAT --- from --- SAPR3.ZMCOD_TABLESPACE TS, --- SAPR3.ZMCOD_DATABASE DB --- where --- DB.SRCDBNAME = TS.SRCDBNAME --- order by --- ZM_SRCDBNAME, -; ZM_SRCSSID ; ZM_SRCTSNAME ; ZM_SRCDBNAME ; ZM_SRCDBID ; ZM_SRCPSID ; ... ; DB7S ; ABAPTREE ; A000X000 ; 2395 ; 2 ; 710 ; 0 ; 144 ; I ; SAPR3 ; ... ; DB7S ; TLANTEST ; A000X019 ; 2394 ; 2 ; 710 ; 0 ; -1 ; I ; SAPR3 ; ... ; DB7S ; ADR12S ; A000X01I ; 2393 ; 2 ; 710 ; 0 ; -1 ; I ; SAPR3 ; ... ; DB7S ; TRESEPR ; A000X04Z ; 2392 ; 2 ; 710 ; 0 ; -1 ; I ; SAPR3 ; ...
PDSNDBST
The REXX procedure PDSNDBST generates the JCL and control statements to issue DB2 START and STOP DATABASE commands. Example D-9 on page 242 shows the invocation of the REXX procedure PDSNDBST. By default, it uses $ZMCDBSR as the input member (member generated by the REXX procedure PQUERYTB, using the SQL query $ZMCDBSR as the input member).
241
The other files are for the different types: T stands for the target database subsystem. S stands for the source database system. A stands for -START DATABASE(dbname). U stands for -START DATABASE(dbname) ACCESS(UT). Z stands for -STOP DATABASE(dbname). Example D-11 shows the log of the REXX procedure PDSNDBST when we use BLUSDA as the local parameter file.
Example: D-11 Log of PDSNDBST
READY %PDSNDBST MCD0008I MCD0009I MCD0021W MCD0021W MCD0021W MCD0021W MCD0021W MCD0022I MCD0022I MCD0022I MCD0022I MCD0022I MCD0022I LOCAL=BLUSDA PDSNDBST 1.1.0 Procedure SYSEXEC Input Arg inpmemb Input Arg parmlib Input Arg global Input Arg infix Input Arg prognam Input Arg db2 Input Arg dsnexit Input Arg dsnload Input Arg infix Input Arg inpmemb Input Arg inpqurs
in Lib replaced by $ZMCDBSR replaced by SAPRES5.REXX.BLUPARM replaced by BLUGLOB replaced by SDA replaced by SAPRES5 is S is DB7S7.SDSNEXIT is DB7S7.SDSNLOAD is SDA is $ZMCDBSR is SAPRES5.REXX.BLUQURS
242
SAP on DB2 UDB for OS/390 and z/OS: Multiple Components in One Database (MCOD)
MCD0022I MCD0022I MCD0022I MCD0022I MCD0022I MCD0022I MCD0022I MCD0022I MCD0022I MCD0022I MCD0022I MCD0022I MCD0022I MCD0022I MCD0022I MCD0037I MCD0038I MCD0007I MCD0013I READY END
Input Arg inpskel is SAPRES5.REXX.BLUSKEL Input Arg njdbcom is 1 Input Arg outjobs is SAPRES5.REXX.BLUJOBS Input Arg outparm is SAPRES5.REXX.BLUSTIN Input Arg prognam is SAPRES5 Input Arg sid is BLU Input Arg skeldbc is SKGSDBCO Input Arg skeljob is SKGJJOBC Input Arg sssid is DB7S Input Arg ssysid is SC42 Input Arg svcat is SAPBLU Input Arg tssid is DB7T Input Arg tsysid is SC49 Input Arg tvcat is MCDBLU Input Arg type is A # databases 3337 processed and written to BLUSDA01 # databases 3337 are read Procedure PDSNDBST RC = 0 Elapsed Time 2 in seconds
Example D-12 shows the JCL generated by the REXX procedure PDSNDBST.
Example: D-12 JCL generated by PDSNDBST
EDIT SAPRES5.REXX.BLUJOBS(BLUSDA01) - 01.00 Columns 00001 00072 Command ===> Scroll ===> CSR 000001 //BLUSDA01 JOB (999,POK), 000002 // 'SAPRES5', 000003 // CLASS=A, 000004 // MSGCLASS=T, 000005 // NOTIFY=&SYSUID, 000006 // TIME=1440, 000007 // REGION=0M, 000008 // RESTART=HERE 000009 // JCLLIB ORDER=(DB7SU.PROCLIB) 000010 /*JOBPARM SYSAFF=SC42,L=9999 000011 //HERE EXEC PGM=IEFBR14 000012 //* Generated by Procedure PDSNDBST in Lib SYSEXEC 000013 //* Date 17/12/02 Time 10:36:28 000014 //* using GLOBAL member BLUGLOB in library SAPRES5.REXX.BLUPARM 000015 //* using INPUT member $ZMCDBSR in library SAPRES5.REXX.BLUQURS 000016 //BLUSDA01 EXEC PGM=IKJEFT01,DYNAMNBR=20,COND=(4,LT) 000017 //STEPLIB DD DSN=DB7S7.SDSNLOAD, 000018 // DISP=SHR 000019 // DD DSN=DB7S7.SDSNEXIT, 000020 // DISP=SHR 000021 //SYSTSPRT DD SYSOUT=*
243
Example D-13 shows sample statements created by the REXX procedure PDSNDBST.
Example: D-13 Sample statements created by PDSNDBST
EDIT SAPRES5.REXX.BLUSTIN(BLUSDA01) - 01.00 Command ===> 000001 DSN SYSTEM(DB7S) 000002 -START DATABASE(A000X000) 000003 -START DATABASE(A000X019) 000004 -START DATABASE(A000X01I) ...... 002617 -START DATABASE(A223XQZQ) ...... 003338 -START DATABASE(U020X8AV) Columns 00001 00072 Scroll ===> CSR
PREPTSOB
The REXX procedure PREPTSOB generates REPAIR statements for tablespaces. By default, it uses $ZMCTSSR as the input member (member generated by the REXX procedure PQUERYTB, using the SQL query $ZMCTSSR as the input member). Example D-14 shows the invocation of the REXX procedure PREPTSOB.
Example: D-14 Invocation of PREPTSOB
%PREPTSOB
244
SAP on DB2 UDB for OS/390 and z/OS: Multiple Components in One Database (MCOD)
Note that no parameters are given on the invocation. Looking at the log of the REXX procedure PREPTSOB, as shown in Example D-15, we see that the following parameters are automatically replaced by their default values before looking at the values specified in BLUGLOB: inpmemb infix db2 parmlib global prognam
Example: D-15 Log of PREPTSOB
READY %PREPTSOB MCD0008I MCD0009I MCD0021W MCD0021W MCD0021W MCD0021W MCD0021W MCD0021W MCD0022I MCD0022I MCD0022I MCD0022I MCD0022I MCD0022I MCD0022I MCD0022I MCD0022I MCD0022I MCD0022I MCD0022I MCD0022I MCD0022I MCD0022I MCD0022I MCD0022I MCD0022I MCD0030A MCD0033I MCD0034I MCD0007I MCD0013I
PREPTSOB 1.1.0 Procedure PREPTSOB in Lib SYSEXEC Input Arg inpmemb replaced by $ZMCTSSR Input Arg infix replaced by TSO Input Arg db2 replaced by S Input Arg parmlib replaced by SAPRES5.REXX.BLUPARM Input Arg global replaced by BLUGLOB Input Arg prognam replaced by SAPRES5 Input Arg db2 is S Input Arg infix is TSO Input Arg inpmemb is $ZMCTSSR Input Arg inpqurs is SAPRES5.REXX.BLUQURS Input Arg inpskel is SAPRES5.REXX.BLUSKEL Input Arg njrepob is 1 Input Arg outjobs is SAPRES5.REXX.BLUJOBS Input Arg outparm is SAPRES5.REXX.BLUSTIN Input Arg prognam is SAPRES5 Input Arg sid is BLU Input Arg skeldsn is SKGSDSNU Input Arg skeljob is SKGJJOBC Input Arg sssid is DB7S Input Arg ssysid is SC42 Input Arg svcat is SAPBLU Input Arg tssid is DB7T Input Arg tsysid is SC49 Input Arg tvcat is MCDBLU Partitioned Tablespace A223XQZQ.USOBXX manual FUP required # Tablespaces 1105 processed and written to BLUTSO01 # Tablespaces 3346 are read Procedure PREPTSOB RC = 0 Elapsed Time 8 in seconds
245
READY END
Let us look at messages MCD0030A, MCD0033I, and MCD0034I in Example D-15 on page 245: MCD0030A states that a partitioned tablespace is found, the statements produced, and will need a manual follow up treatment. MCD033I states that 1105 tablespaces have output generated. MCD034I states that 3346 tablespaces are read. The difference 3346 - 1105 = 2241 tablespaces are not materialized so far, because they are created with the DEFINE NO parameter, and no table that resides in this tablespace contains a row. Example D-16 shows the JCL generated by the REXX procedure PREPTSOB. Note that the PDS member names are generated by <SID><INFIX>nn, where nn is a number between 1 and NJREPOB.
Example: D-16 JCL generated by PREPTSOB
EDIT SAPRES5.REXX.BLUJOBS(BLUTSO01) - 01.00 Columns 00001 00072 Command ===> Scroll ===> CSR 000001 //BLUTSO01 JOB (999,POK), 000002 // 'SAPRES5', 000003 // CLASS=A, 000004 // MSGCLASS=T, 000005 // NOTIFY=&SYSUID, 000006 // TIME=1440, 000007 // REGION=0M, 000008 // RESTART=HERE 000009 // JCLLIB ORDER=(DB7SU.PROCLIB) 000010 /*JOBPARM SYSAFF=SC42,L=9999 000011 //HERE EXEC PGM=IEFBR14 000012 //* Generated by Procedure PREPTSOB in Lib SYSEXEC 000013 //* Date 16/12/02 Time 08:23:32 000014 //* using GLOBAL member BLUGLOB in library SAPRES5.REXX.BLUPARM 000015 //* using INPUT member $ZMCTSSR in library SAPRES5.REXX.BLUQURS 000016 //BLURIO01 EXEC DSNUPROC, 000017 // SYSTEM='DB7S', 000018 // UID='BLUTSO01', 000019 // COND=(4,LT) 000020 //SYSIN DD DSN=SAPRES5.REXX.BLUSTIN(BLUTSO01), 000021 // DISP=SHR 000022 //SYSPRINT DD SYSOUT=*
246
SAP on DB2 UDB for OS/390 and z/OS: Multiple Components in One Database (MCOD)
Example D-17 shows sample statements created by the REXX procedure PREPTSOB.
Example: D-17 Sample statements created by PREPTSOB
EDIT Command 000001 000002 000003 000004 000005 000006 000007 000008 000009 000010 000011 000012 000013 000014 000015 000016 000017 ...... 009390 009391 009392 009393 009394 009395 009396 009397 009398 009399 009400 009401 009402 009403 009404 ...... SAPRES5.REXX.BLUSTIN(BLUTSO01) - 01.00 Columns 00001 00072 ===> Scroll ===> CSR -- Generated by Procedure PREPTSOB in Lib SYSEXEC -- Date 16/12/02 Time 08:23:32 --- using GLOBAL member BLUGLOB in library SAPRES5.REXX.BLUPARM --- using INPUT member $ZMCTSSR in library SAPRES5.REXX.BLUQURS -REPAIR OBJECT LOG YES LOCATE TABLESPACE A000X000.ABAPTREE PAGE 0 VERIFY OFFSET 12 DATA X'095B' REPLACE OFFSET 12 DATA X'095B' VERIFY OFFSET 14 DATA X'0002' REPLACE OFFSET 14 DATA X'0002' VERIFY OFFSET 40 DATA 'DB7S' REPLACE OFFSET 40 DATA 'DB7T' VERIFY OFFSET 82 DATA 'SAPSTD ' REPLACE OFFSET 82 DATA 'BLUSTD ' VERIFY OFFSET 90 DATA 'SAPBLU ' REPLACE OFFSET 90 DATA 'MCDBLU ' REPAIR OBJECT LOG YES ---------------A223XQZQ.USOBXX PARTITIONED MAN FUP REQ LOCATE TABLESPACE A223XQZQ.USOBXX PAGE X'00000000' VERIFY OFFSET 12 DATA X'0E0E' REPLACE OFFSET 12 DATA X'0E0E' VERIFY OFFSET 14 DATA X'0005' REPLACE OFFSET 14 DATA X'0005' VERIFY OFFSET 40 DATA 'DB7S' REPLACE OFFSET 40 DATA 'DB7T' VERIFY OFFSET 82 DATA 'SAPPOD ' REPLACE OFFSET 82 DATA 'BLUPOD ' VERIFY OFFSET 90 DATA 'SAPBLU ' REPLACE OFFSET 90 DATA 'MCDBLU ' REPAIR OBJECT LOG YES LOCATE TABLESPACE A223XQZQ.USOBXX VERIFY OFFSET 12 DATA X'0E0E'
If we look at rows 009390 to 009404 in Example D-17, we see that the partitioned tablespace A223XQZQ.USOBXX has all the REPAIR statements created. However the PAGE X......... of partitions 2 to n cannot be calculated manually with the data provided in the metadata tables. That is why the statements are generated as comments.
247
PREPINOB
The REXX procedure PREPINOB generates REPAIR statements for indexspaces. It works very much like PREPTSOB, but uses $ZMCINSR as the input member (member generated by the REXX procedure PQUERYTB, using the SQL query $ZMCINSR as the input member).
Deleting created target data sets and renaming source data sets
The VSAM data sets created when running the DDL on the target system must be deleted, and the source data sets must be renamed to match the definitions in the target DB2 catalog. REXX procedures PVSATSDE and PVSAINDE are used to generate the DELETE statements. REXX procedures PVSATSAL and PVSAINAL are used to generate the ALTER statements.
PVSATSDE
The REXX procedure PVSATSDE generates the DELETE statements for tablespaces. By default, it uses $ZMCTSSR as the input member (member generated by the REXX procedure PQUERYTB, using the SQL query $ZMCTSSR as the input member). Example D-18 shows the invocation of the REXX procedure PVSATSDE.
Example: D-18 Invocation of PVSATSDE
%PVSATSDE
PVSATSDE 1.1.0 in Lib SYSEXEC Arg inpmemb not specified Arg infix not specified Arg db2 not specified Arg parmlib not specified Arg global not specified Arg progname not specified Arg db2 = S Arg infix = TSD Arg inpmemb = $ZMCTSSR
$ZMCTSSR used TSD used S used SAPRES5.REXX.BLUPARM used BLUGLOB used SAPRES5 used
248
SAP on DB2 UDB for OS/390 and z/OS: Multiple Components in One Database (MCOD)
MCD0022I MCD0022I MCD0022I MCD0022I MCD0022I MCD0022I MCD0022I MCD0022I MCD0022I MCD0022I MCD0022I MCD0022I MCD0022I MCD0022I MCD0022I MCD0035I MCD0036I MCD0007I MCD0013I READY END
Arg inpqurs = SAPRES5.REXX.BLUQURS Arg inpskel = SAPRES5.REXX.BLUSKEL Arg njvsalt = 1 Arg outjobs = SAPRES5.REXX.BLUJOBS Arg outparm = SAPRES5.REXX.BLUSTIN Arg progname = SAPRES5 Arg sid = BLU Arg skelidca = SKGSIDCA Arg skeljobc = SKGJJOBC Arg sssid = DB7S Arg ssysid = SC42 Arg svcat = SAPBLU Arg tssid = DB7T Arg tsysid = SC49 Arg tvcat = MCDBLU # Tablespaces 1105 processed and written to BLUTSD01 # Tablespaces 3346 are read Procedure PVSATSDE RC = 0 Elapsed Time 4 in seconds
Example D-20 shows the JCL generated by the REXX procedure PVSATSDE.
Example: D-20 JCL generated by PVSATSDE
EDIT SAPRES5.REXX.BLUJOBS(BLUTSD01) - 01.00 Columns 00001 00072 Command ===> Scroll ===> CSR 000001 //BLUTSD01 JOB (999,POK), 000002 // 'SAPRES5', 000003 // CLASS=A, 000004 // MSGCLASS=T, 000005 // NOTIFY=&SYSUID, 000006 // TIME=1440, 000007 // REGION=0M, 000008 // RESTART=HERE 000009 // JCLLIB ORDER=(DB7SU.PROCLIB) 000010 /*JOBPARM SYSAFF=SC42,L=9999 000011 //HERE EXEC PGM=IEFBR14 000012 //* Generated by Procedure PVSATSDE in Lib SYSEXEC 000013 //* Date 16/12/02 Time 09:29:31 000014 //* using GLOBAL member BLUGLOB in library SAPRES5.REXX.BLUPARM 000015 //* using INPUT member $ZMCTSSR in library SAPRES5.REXX.BLUQURS 000016 //BLUVI001 EXEC PGM=IDCAMS 000017 //SYSPRINT DD SYSOUT=* 000018 //SYSIN DD DSN=SAPRES5.REXX.BLUSTIN(BLUTSD01), 000019 // DISP=SHR
249
Example D-21 shows sample statements created by the REXX procedure PVSATSDE. In addition, note that it deals with partitions.
Example: D-21 Sample statements created by PVSATSDE
EDIT Command 000001 000002 000003 000004 000005 000006 000007 000008 000009 000010 000011 ...... SAPRES5.REXX.BLUSTIN(BLUTSD01) - 01.00 Columns 00001 00072 ===> Scroll ===> CSR /* Generated by Procedure PVSATSDE in Lib SYSEXEC */ /* Date 16/12/02 Time 09:29:15 */ /* using GLOBAL member BLUGLOB in library SAPRES5.REXX.BLUPARM */ /* using INPUT member $ZMCTSSR in library SAPRES5.REXX.BLUQURS */ DELETE MCDBLU.DSNDBC.A000X02Y.BAPITOOL.I0001.A001 DELETE MCDBLU.DSNDBC.A000X03C.SEUDEPTT.I0001.A001 DELETE MCDBLU.DSNDBC.A000X0DR.TER13.I0001.A001 DELETE MCDBLU.DSNDBC.A000X0TS.DSVASREP.I0001.A001 DELETE MCDBLU.DSNDBC.A000X15F.SXBNFRUL.I0001.A001 DELETE MCDBLU.DSNDBC.A000X1L4.SAASYSTT.I0001.A001 DELETE MCDBLU.DSNDBC.A000X2MI.USR41.I0001.A001 003925
PVSAINDE
The REXX procedure PVSAINDE generates the DELETE statements for indexspaces. It works very much like PVSATSDE, but uses $ZMCINSR as the input member (member generated by the REXX procedure PQUERYTB, using the SQL query $ZMCINSR as the input member).
PVSATSAL
The REXX procedure PVSATSAL generates the ALTER statements for tablespaces. By default, it uses $ZMCTSSR as the input member (member generated by the REXX procedure PQUERYTB, using the SQL query $ZMCTSSR as the input member). Example D-22 shows the invocation of the REXX procedure PVSATSAL.
Example: D-22 Invocation of PVSATSAL
%PVSATSAL
Example D-23 on page 251 shows the log of the REXX procedure PVSATSAL.
250
SAP on DB2 UDB for OS/390 and z/OS: Multiple Components in One Database (MCOD)
PVSATSAL 1.1.0 in Lib SYSEXEC Arg inpmemb not specified $ZMCTSSR used Arg infix not specified TSA used Arg db2 not specified S used Arg parmlib not specified SAPRES5.REXX.BLUPARM used Arg global not specified BLUGLOB used Arg progname not specified SAPRES5 used Arg db2 = S Arg infix = TSA Arg inpmemb = $ZMCTSSR Arg inpqurs = SAPRES5.REXX.BLUQURS Arg inpskel = SAPRES5.REXX.BLUSKEL Arg njvsalt = 1 Arg outjobs = SAPRES5.REXX.BLUJOBS Arg outparm = SAPRES5.REXX.BLUSTIN Arg progname = SAPRES5 Arg sid = BLU Arg skelidca = SKGSIDCA Arg skeljobc = SKGJJOBC Arg sssid = DB7S Arg ssysid = SC42 Arg svcat = SAPBLU Arg tssid = DB7T Arg tsysid = SC49 Arg tvcat = MCDBLU # Tablespaces 1105 processed and written to BLUTSA01 # Tablespaces 3346 are read Procedure PVSATSAL RC = 0 Elapsed Time 7 in seconds
Example D-24 shows the JCL generated by the REXX procedure PVSATSAL.
Example: D-24 JCL generated by PVSATSAL
EDIT SAPRES5.REXX.BLUJOBS(BLUTSA01) - 01.00 Command ===> 000001 //BLUTSA01 JOB (999,POK), 000002 // 'SAPRES5', 000003 // CLASS=A, 000004 // MSGCLASS=T, 000005 // NOTIFY=&SYSUID, 000006 // TIME=1440, Columns 00001 00072 Scroll ===> CSR
251
000007 000008 000009 000010 000011 000012 000013 000014 000015 000016 000017 000018 000019
// REGION=0M, // RESTART=HERE // JCLLIB ORDER=(DB7SU.PROCLIB) /*JOBPARM SYSAFF=SC42,L=9999 //HERE EXEC PGM=IEFBR14 //* Generated by Procedure PVSATSAL in Lib SYSEXEC //* Date 16/12/02 Time 09:29:31 //* using GLOBAL member BLUGLOB in library SAPRES5.REXX.BLUPARM //* using INPUT member $ZMCTSSR in library SAPRES5.REXX.BLUQURS //BLUVI001 EXEC PGM=IDCAMS //SYSPRINT DD SYSOUT=* //SYSIN DD DSN=SAPRES5.REXX.BLUSTIN(BLUTSA01), // DISP=SHR
Example D-25 shows sample statements created by the REXX procedure PVSATSAL. Note that the procedure deals with the cluster and data components (see lines 003916 to 003919 in Example D-25). In addition, note that it deals with partitions.
Example: D-25 Sample statements created by PVSATSAL
EDIT Command 000001 000002 000003 000004 ...... 003915 003916 003917 003918 003919 003920 003921 003922 003923 003924 003925 ...... SAPRES5.REXX.BLUSTIN(BLUTSA01) - 01.00 Columns 00001 00072 ===> Scroll ===> CSR /* Generated by Procedure PVSATSAL in Lib SYSEXEC */ /* Date 16/12/02 Time 09:29:31 */ /* using GLOBAL member BLUGLOB in library SAPRES5.REXX.BLUPARM */ /* using INPUT member $ZMCTSSR in library SAPRES5.REXX.BLUQURS */
ALTER SAPBLU.DSNDBC.A223XQZQ.TABL.VALU.ZM_SS.I0001.A001 NEWNAME (MCDBLU.DSNDBC.A223XQZQ.TABL.VALU.ZM_TS.I0001.A001) ALTER SAPBLU.DSNDBD.A223XQZQ.TABL.VALU.ZM_SS.I0001.A001 NEWNAME (MCDBLU.DSNDBD.A223XQZQ.TABL.VALU.ZM_TS.I0001.A001) ALTER SAPBLU.DSNDBC.A223XQZQ.TABL.VALU.ZM_SS.I0001.A002 NEWNAME (MCDBLU.DSNDBC.A223XQZQ.TABL.VALU.ZM_TS.I0001.A002) ALTER SAPBLU.DSNDBD.A223XQZQ.TABL.VALU.ZM_SS.I0001.A002 NEWNAME (MCDBLU.DSNDBD.A223XQZQ.TABL.VALU.ZM_TS.I0001.A002)
PVSAINAL
The REXX procedure PVSAINAL generates the ALTER statements for indexspaces. It works very much like PVSATSAL, but uses $ZMCINSR as the input member (member generated by the REXX procedure PQUERYTB, using the SQL query $ZMCINSR as the input member).
252
SAP on DB2 UDB for OS/390 and z/OS: Multiple Components in One Database (MCOD)
PREPTSLV
The REXX procedure PREPTSLV generates REPAIR LEVELID statements for tablespaces. By default, it uses $ZMCTSSR as the input member (member generated by the REXX procedure PQUERYTB, using the SQL query $ZMCTSSR as the input member). Example D-26 shows the invocation of the REXX procedure PREPTSLV.
Example: D-26 Invocation of PREPTSLV
%PREPTSLV
PREPTSLV 1.1.0 Procedure PREPTSLV Input Arg inpmemb Input Arg infix Input Arg db2 Input Arg parmlib Input Arg global Input Arg progname Input Arg db2 Input Arg infix Input Arg inpmemb Input Arg inpqurs Input Arg inpskel Input Arg njreplv Input Arg outjobs Input Arg outparm Input Arg progname Input Arg sid Input Arg skeldsnu Input Arg skeljobc Input Arg sssid
in Lib SYSEXEC replaced by $ZMCTSSR replaced by TSL replaced by T replaced by SAPRES5.REXX.BLUPARM replaced by BLUGLOB replaced by SAPRES5 is T is TSL is $ZMCTSSR is SAPRES5.REXX.BLUQURS is SAPRES5.REXX.BLUSKEL is 1 is SAPRES5.REXX.BLUJOBS is SAPRES5.REXX.BLUSTIN is SAPRES5 is BLU is SKGSDSNU is SKGJJOBC is DB7S
253
MCD0022I MCD0022I MCD0022I MCD0022I MCD0022I MCD0031I MCD0032I MCD0007I MCD0013I READY END
Input Arg ssysid is SC42 Input Arg svcat is SAPBLU Input Arg tssid is DB7T Input Arg tsysid is SC49 Input Arg tvcat is MCDBLU # Tablespaces 1105 processed and written to # Tablespaces 3346 are read Procedure PREPTSLV RC = 0 Elapsed Time 6 in seconds
BLUTSL01
Example D-28 shows the JCL generated by the REXX procedure PREPTSLV.
Example: D-28 JCL generated by PREPTSLV
EDIT SAPRES5.REXX.BLUJOBS(BLUTSL01) - 01.00 Columns 00001 00072 Command ===> Scroll ===> CSR 000001 //BLUTSL01 JOB (999,POK), 000002 // 'SAPRES5', 000003 // CLASS=A, 000004 // MSGCLASS=T, 000005 // NOTIFY=&SYSUID, 000006 // TIME=1440, 000007 // REGION=0M, 000008 // RESTART=HERE 000009 // JCLLIB ORDER=(DB7SU.PROCLIB) 000010 /*JOBPARM SYSAFF=SC49,L=9999 000011 //HERE EXEC PGM=IEFBR14 000012 //* Generated by Procedure PREPTSLV in Lib SYSEXEC 000013 //* Date 16/12/02 Time 09:03:09 000014 //* using GLOBAL member BLUGLOB in library SAPRES5.REXX.BLUPARM 000015 //* using INPUT member $ZMCTSSR in library SAPRES5.REXX.BLUQURS 000016 //BLUTSL01 EXEC DSNUPROC, 000017 // SYSTEM='DB7T', 000018 // UID='BLUTSL01', 000019 // COND=(4,LT) 000020 //SYSIN DD DSN=SAPRES5.REXX.BLUSTIN(BLUTSL01), 000021 // DISP=SHR 000022 //SYSPRINT DD SYSOUT=*
Example D-29 on page 255 shows sample statements created by the REXX procedure PREPTSLV. Note that the procedure deals with partitioned tablespaces.
254
SAP on DB2 UDB for OS/390 and z/OS: Multiple Components in One Database (MCOD)
PREPINLV
The REXX procedure PREPINLV generates the REPAIR LEVELID statements for indexes. It works very much like PREPINLV, but uses $ZMCINSR as the input member (member generated by the REXX procedure PQUERYTB, using the SQL query $ZMCINSR as the input member).
255
$IBMVIST
The SQL query $IBMVIST, as shown in Example D-30, can be used as the input member of the REXX procedure PQUERYTB to retrieve information related to the views. In that case, PQUERYTB must be run against the source DB2 subsystem.
Example: D-30 SQL query to retrieve information about views
-- Query against SYSIBM.SYSVIEWS -- used in SG24-6914 select VI.NAME as VI_NAME, VI.CREATOR as VI_CREATOR, VI.SEQNO as VI_SEQNO, VI.CHECK as VI_CHECK, VI.PATHSCHEMAS as VI_PATHSCHEMAS, VI.TEXT as VI_TEXT from SYSIBM.SYSVIEWS as VI where VI.CREATOR = 'SAPR3' order by VI_NAME, VI_SEQNO ;
PCREATVI
The REXX procedure PCREATVI generates DDL for views. By default, it uses $IBMVIST as the input member (member generated by the REXX procedure PQUERYTB, using the SQL query $IBMVIST as the input member). Example D-31 shows the invocation of the REXX procedure PCREATVI.
Example: D-31 Invocation of PCREATVI
%PCREATEVI
Example D-33 on page 257 shows the log of the REXX procedure PCREATVI.
Example: D-32 Log of PCREATVI
READY %PCREATVI MCD0008I MCD0009I MCD0021W MCD0021W
PCREATVI 1.1.0 Procedure PCREATVI in Lib SYSEXEC Input Arg inpmemb replaced by $IBMVIST Input Arg local replaced by BLUTVI
256
SAP on DB2 UDB for OS/390 and z/OS: Multiple Components in One Database (MCOD)
MCD0021W MCD0021W MCD0021W MCD0021W MCD0021W MCD0022I MCD0022I MCD0022I MCD0022I MCD0022I MCD0022I MCD0022I MCD0022I MCD0022I MCD0022I MCD0022I MCD0022I MCD0022I MCD0022I MCD0022I MCD0022I MCD0022I MCD0022I MCD0022I MCD0022I MCD0022I MCD0022I MCD0037I MCD0038I MCD0007I MCD0013I READY END
Input Arg infix replaced by VDD Input Arg db2 replaced by T Input Arg parmlib replaced by SAPRES5.REXX.BLUPARM Input Arg global replaced by BLUGLOB Input Arg prognam replaced by SAPRES5 Input Arg db2 is T Input Arg infix is VDD Input Arg inpmemb is $IBMVIST Input Arg inpqurs is SAPRES5.REXX.BLUQURS Input Arg inpskel is SAPRES5.REXX.BLUSKEL Input Arg njdb2dd is 1 Input Arg outjobs is SAPRES5.REXX.BLUJOBS Input Arg outparm is SAPRES5.REXX.BLUSTIN Input Arg prognam is SAPRES5 Input Arg sid is BLU Input Arg skeldbd is SKGSDBDD Input Arg skeljob is SKGJJOBC Input Arg dsnload is DB7T7.SDSNLOAD Input Arg dsnexit is DB7T7.SDSNEXIT Input Arg dsnrunl is DB7TU.RUNLIB.LOAD Input Arg tschema is SAPBLU Input Arg sssid is DB7S Input Arg ssysid is SC42 Input Arg svcat is SAPBLU Input Arg tssid is DB7T Input Arg tsysid is SC49 Input Arg tvcat is MCDBLU views 623 processed, written to BLUVIE01 views 623 are read from $IBMVIST Procedure PCREATVI RC = 0 Elapsed Time 4 in seconds
Example D-33 shows the JCL generated by the REXX procedure PCREATVI.
Example: D-33 JCL generated by PCREATVI
EDIT SAPRES5.REXX.BLUJOBS(BLUVDD01) - 01.00 Command ===> 000001 //BLUVIE01 JOB (999,POK), 000002 // 'SAPRES5', 000003 // CLASS=A, 000004 // MSGCLASS=T, 000005 // NOTIFY=&SYSUID, 000006 // TIME=1440, 000007 // REGION=0M, 000008 // RESTART=HERE 000009 // JCLLIB ORDER=(DB7SU.PROCLIB) Columns 00001 00072 Scroll ===> CSR
257
000010 000011 000012 000013 000014 000015 000016 000017 000018 000019 000020 000021 000022 000023 000024 000025 000026 000027 000028 000029
/*JOBPARM SYSAFF=SC49,L=9999 //HERE EXEC PGM=IEFBR14 //* Generated by Procedure PCREATVI in Lib ? //* Date 10/01/03 Time 12:05:35 //* using GLOBAL member BLUGLOB in library SAPRES5.REXX.BLUPARM //* using INPUT member $IBMVIST in library SAPRES5.REXX.BLUQURS //BLUVIE01 EXEC PGM=IKJEFT01,DYNAMNBR=20,COND=(4,LT) //STEPLIB DD DSN=DB7T7.SDSNLOAD, // DISP=SHR // DD DSN=DB7T7.SDSNEXIT, // DISP=SHR //SYSTSIN DD * DSN SYSTEM(DB7T) RUN PROGRAM(DSNTEP2) PLAN(DSNTEP71) LIB('DB7TU.RUNLIB.LOAD') PARMS('/ALIGN(MID)') //SYSTSPRT DD SYSOUT=* //SYSPRINT DD SYSOUT=* //SYSUDUMP DD SYSOUT=* //SYSIN DD DSN=SAPRES5.REXX.BLUSTIN(BLUVDD01), // DISP=SHR
Example D-34 shows sample statements created by the REXX procedure PCREATVI.
Example: D-34 Sample statements created by PCREATVI
EDIT Command 000001 000002 000003 000004 000005 000006 000007 000008 000009 000010 000011 000012 000013 000014 000015 000016 000017 000018 000019 000020 000021 SAPRES5.REXX.BLUSTIN(BLUVDD01) - 01.00 Columns 00001 0007 ===> Scroll ===> CSR -- Generated by Procedure PCREATVI in Lib SYSEXEC --- Date 10/01/03 Time 12:05:35 --- using GLOBAL member BLUGLOB in library SAPRES5.REXX.BLUPARM --- using INPUT member $IBMVIST in library SAPRES5.REXX.BLUQURS -set current sqlid='SAPBLU' ; commit; CREATE VIEW "APPL_DEVC" ( "DEVCLASS", "OBJ_NAME" ) AS SELECT T0001."DEVCLASS", T0001."DEVCLASS" FROM "TDEVC" T0001
258
SAP on DB2 UDB for OS/390 and z/OS: Multiple Components in One Database (MCOD)
000022 ......
$IBMTSSR
The SQL query $IBMTSSR, as shown in Example D-35, can be used as the input member of the REXX procedure PQUERYTB to retrieve information related to the source tablespaces. In that case, PQUERYTB must be run against the source DB2 subsystem.
Example: D-35 SQL query to retrieve information about source tablespaces
-- GET DATA -select TS.DBNAME as TS.NAME as TS.CREATOR as TS.DBID as TS.PSID as TS.OBID as TS.TYPE as TS.PARTITIONS as TS.CLOSERULE as TS.ERASERULE as TS.BPOOL as TS.LOCKRULE as TS.LOCKMAX as TS.LOCKPART as TS.MAXROWS as TS.DSSIZE as TS.LOCKRULE as TS.LOG as TS.ENCODING_SCHEME TS.SEGSIZE as TP.SPACE as TP.COMPRESS as
TS_DBNAME , TS_NAME , TS_CREATOR , TS_DBID , TS_PSID , TS_OBID , TS_TYPE , TS_PARTITIONS , TS_CLOSERULE , TS_ERASERULE , TS_BPOOL , TS_LOCKRULE , TS_LOCKMAX , TS_LOCKPART , TS_MAXROWS , TS_DSSIZE , TS_LOCKRULE , TS_LOG , as TS_ENCODING , TS_SEGSIZE , TP_SPACE , TP_COMPRESS,
259
TP.PARTITION as TP_PARTITION , TP.IXNAME as TP_IXNAME , TP.GBPCACHE as TP_GBPCACHE, TP.PQTY as TP_PQTY , TP.SQTY as TP_SQTY , TP.SECQTYI as TP_SECQTYI , TP.STORTYPE as TP_STORTYPE , TP.FREEPAGE as TP_FREEPAGE , TP.PCTFREE as TP_PCTFREE , TP.TRACKMOD as TP_TRACKMOD , TP.LIMITKEY as TP_LIMITKEY from SYSIBM.SYSTABLESPACE as TS, SYSIBM.SYSTABLEPART as TP where TS.CREATOR = 'SAPR3' and TP.DBNAME = TS.DBNAME and TP.TSNAME = TS.NAME order by TS_DBNAME, TS_PSID, TP_PARTITION
$IBMINSR
The SQL query $IBMINSR, as shown in Example D-36, can be used as the input member of the REXX procedure PQUERYTB to retrieve information related to the source indexes. In that case, PQUERYTB must be run against the source DB2 subsystem.
Example: D-36 SQL query to retrieve information about source indexes
-- Query against SYSIBM.SYSINDEXES and SYSIBM.SYSINDEXPART -- used in SG24-6914 select IX.DBNAME as IX_DBNAME , IX.INDEXSPACE as IX_INDEXSPACE , IX.NAME as IX_NAME , IX.TBNAME as IX_TBNAME , IP.PARTITION as IP_PARTITION , IX.CREATOR as IX_CREATOR , IX.UNIQUERULE as IX_UNIQUERULE , IX.COLCOUNT as IX_COLCOUNT , IX.CLUSTERING as IX_CLUSTERING , IX.CLUSTERED as IX_CLUSTERED , IX.BPOOL as IX_BPOOL ,
260
SAP on DB2 UDB for OS/390 and z/OS: Multiple Components in One Database (MCOD)
IX.ERASERULE as IX_ERASERULE IX.CLOSERULE as IX_CLOSERULE IX.PIECESIZE as IX_PIECESIZE IX.COPY as IX_COPY IP.PQTY as IP_PQTY IP.SQTY as IP_SQTY IP.SECQTYI as IP_SECQTYI IP.STORNAME as IP_STORNAME IP.GBPCACHE as IP_GBPCACHE IP.IPREFIX as IP_IPREFIX from SYSIBM.SYSINDEXES as IX , SYSIBM.SYSINDEXPART as IP where IX.CREATOR = 'SAPR3' and IP.IXCREATOR = 'SAPR3' and IP.STORNAME LIKE 'SAP%' and IX.NAME = IP.IXNAME order by IX_DBNAME , IX_INDEXSPACE , IP_PARTITION , IX_TBNAME
, , , , , , , , ,
PTEPTSAL
The REXX procedure PTEPTSAL generates DDL for altering tablespace sizes. By default, it uses $ZMCTSSR and $IBMTSSR as the input members (members generated by the REXX procedure PQUERYTB, using SQL queries $ZMCTSSR and $IBMTSSR as input members). However, because the metadata tables are defined as ASCCII tables, whereas the DB2 catalog tables are EBCDIC tables, the order of rows in $ZMCTSSR and $IBMTSSR may be different, and you may receive the following error message:
MCD0050E Input files $ZMCINSR and $IBMINSR are out of sync
Therefore, we use the member $ZMCTSSS as input member, instead of $ZMCTSSR. $ZMCTSSS is created as follows: 1. Copy the header part of $ZMCTSSR (lines 1 to 42) in a new member called $ZMCTSHD. 2. Copy the list part of $ZMCTSSR (lines 43 and next) in a new member called $ZMCTSSS.
261
3. Use the following ISPF command to sort $ZMCTSSS according to the EBCDIC order of the field ZM_SRCDBNAME:
SORT 21 29
4. Append $ZMCTSHD at the top of $ZMCTSSS. Example D-37 shows the invocation of the REXX procedure PTEPTSAL.
Example: D-37 Invocation of PTEPTSAL
%PTEPTSAL INPMEMB=$ZMCTSSS
used
262
SAP on DB2 UDB for OS/390 and z/OS: Multiple Components in One Database (MCOD)
Arg tsysid = SC49 Arg tvcat = MCDBLU Tablespaces 3331 processed and written to Tablespaces 3331 are read from $ZMCTSSS Tablespaces 3331 are read from $IBMTSSR Procedure PTEPTSAL RC = 0 Elapsed Time 17 in seconds
BLUTSQ01
Example D-39 shows the JCL generated by the REXX procedure PTEPTSAL.
Example: D-39 JCL generated by PTEPTSAL
EDIT SAPRES1.REXX.BLUJOBS(BLUTSQ01) - 01.00 Columns 00001 00072 Command ===> Scroll ===> CSR 000001 //BLUTSQ01 JOB (999,POK), 000002 // 'SAPRES5', 000003 // CLASS=A, 000004 // MSGCLASS=T, 000005 // NOTIFY=&SYSUID, 000006 // TIME=1440, 000007 // REGION=0M, 000008 // RESTART=HERE 000009 // JCLLIB ORDER=(DB7SU.PROCLIB) 000010 /*JOBPARM SYSAFF=SC49,L=9999 000011 //HERE EXEC PGM=IEFBR14 000012 //* Generated by Procedure PTEPTSAL in Lib SYSEXEC 000013 //* Date 14/01/03 Time 06:13:58 000014 //* using GLOBAL member BLUGLOB in library SAPRES5.REXX.BLUPARM 000015 //* using INPUT member $ZMCTSSS in library SAPRES5.REXX.BLUQURS 000016 //BLUTSQ01 EXEC PGM=IKJEFT01,DYNAMNBR=20,COND=(4,LT) 000017 //STEPLIB DD DSN=DB7S7.SDSNLOAD, 000018 // DISP=SHR 000019 // DD DSN=DB7S7.SDSNEXIT, 000020 // DISP=SHR 000021 //SYSTSIN DD * 000022 DSN SYSTEM(DB7T) 000023 RUN PROGRAM(DSNTEP2) PLAN(DSNTEP71) 000024 LIB('DB7SU.RUNLIB.LOAD') PARMS('/ALIGN(MID)') 000025 //SYSTSPRT DD SYSOUT=* 000026 //SYSPRINT DD SYSOUT=* 000027 //SYSUDUMP DD SYSOUT=* 000028 //SYSIN DD DSN=SAPRES5.REXX.BLUSTIN(BLUTSQ01), 000029 // DISP=SHR
Example D-40 on page 264 shows sample statements created by the REXX procedure PTEPTSAL.
263
PTEPINAL
The REXX procedure PTEPINAL generates DDL for altering index sizes. It works very much like PTEPINTS, but uses by default $ZMCINSR and $IBMINSR as input members (members generated by the REXX procedure PQUERYTB, using SQL queries $ZMCINSR and $IBMINSR as input members). However, we use the member $ZMCINSS as input member, instead of $ZMCINSR: 1. Copy the header part of $ZMCINSR (lines 1 to 43) in a new member called $ZMCINHD. 2. Copy the list part of $ZMCINSR (lines 44 and next) in a new member called $ZMCINSS. 3. Use the following ISPF command to sort $ZMCINSS according to the EBCDIC order of the fields ZM_SRCDBNAME and ZM_SRCINDEXSPACE:
SORT 4 22
264
SAP on DB2 UDB for OS/390 and z/OS: Multiple Components in One Database (MCOD)
Appendix E.
Additional material
This redbook refers to additional material that can be downloaded from the Internet as described below.
Select the Additional materials and open the directory that corresponds with the redbook form number, SG246914.
265
AppendixC.zip
AppendixD.zip
REXX procedures and JCL referred to in Appendix C, Merge in place: Defining source objects in target system on page 197 REXX procedures, parameter files, and JCL referred to in Appendix D, Merge in place: Migrating the data on page 233
266
SAP on DB2 UDB for OS/390 and z/OS: Multiple Components in One Database (MCOD)
access control system authorized program analysis report American Standard Code for Information Interchange Advanced Technical Support bootstrap data set Computer Center Management System central processing unit direct access storage device database database administrator database management system database request module distributed data facility data dictionary data definition language dynamic link library data manipulation language Distributed Relational Database Architecture Enterprise Storage Server File Transfer Protocol gigabyte (1,073,741,824 bytes) graphical user interface Hierarchical File System high-level qualifier homogeneous system copy input/output International Business Machines Corporation
ICF ICLI ID IMG IMIG ISICC ISOBID IT ITSO IX JCL KB LOB LPAR LRSN MB MCOD OBID OLAP OLTP OS PDS PPT PSID PSP PTF QMF RACF RBA
integrated catalog facility Integrated Call Level Interface identifier Implementation Guide incremental migration IBM SAP International Competence Center indexspace object identifier information technology International Technical Support Organization index job control language kilobyte (1,024 bytes) large object logical partition log record sequence number megabyte (1,048,576 bytes) Multiple Components in One Database object identifier online analytical processing online transaction processing operating system partitioned data set prior point in time pageset identifier preventive service planning program temporary fix query management facility Resource Access Control Facility relative byte address
267
RVA SAP SAP AG SAP APO SAP BW SAP CRM SAP SEM SAP WAS SG SMS SQL TB TMS TS UDB UR USS VSAM WLM
RAMAC Virtual Array Systems, Applications, Products in Data Processing SAP Aktiengesell SAP Advanced Planner And Optimizer SAP Business Information Warehouse SAP Customer Relationship Management SAP Strategic Enterprise Management SAP Web Application Server storage group Storage Management Subsystem Structured Query Language table transport management system tablespace Universal Database unit of recovery UNIX system services Virtual Storage Access Method Workload Manager
268
SAP on DB2 UDB for OS/390 and z/OS: Multiple Components in One Database (MCOD)
Related publications
The publications listed in this section are considered particularly suitable for a more detailed discussion of the topics covered in this redbook.
IBM Redbooks
For information on ordering these publications, see How to get IBM Redbooks on page 272.
SAP on DB2 for z/OS and OS/390: DB2 System Cloning, SG24-6287 SAP R/3 on DB2 for OS/390: Database Availability Considerations, SG24-5690 SAP on DB2 for OS/390 and z/OS: High Availability Solution Using System Automation, SG24-6836
Other References
These publications are also relevant as further information sources:
DB2 UDB for OS/390 and z/OS Diagnosis Guide and Reference Version 7, LY37-3740 DB2 Universal Database for OS/390 Data Sharing: Planning and Administration Version 6, SC26-9007
269
DB2 Universal Database for OS/390 and z/OS Data Sharing: Planning and Administration Version 7, SC26-9935 DB2 Universal Database for OS/390 and z/OS V7: Installation Guide, GC26-9936 DB2 Universal Database for OS/390 and z/OS: Utility Guide and Reference Version 7, SC26-9945 SAP R/3 on DB2 UDB for OS/390 and z/OS: Planning Guide, 2nd Edition, SAP R/3 Release 4.6D, SC33-7966 SAP on DB2 UDB for OS/390 and z/OS: Planning Guide, SAP Web Application Server 6.20, SC33-7959 Storage Management for SAP and DB2 UDB: Split Mirror Backup/Recovery with IBMs Enterprise Storage Server (ESS), white paper by Sanjoy Das, Siegfried Schmidt, Jens Claussen, and BalaSanni Godavari, available at:
http://www.storage.ibm.com/hardsoft/products/sap/smdb2.pdf
Program Directory for DB2 Management Tools Package (JDB661D), GI10-8193 Program Directory for IBM DB2 UDB Server for OS/390 and z/OS: DB2 Management Clients Package (JDB771D), GI10-8218 Program Directory for DB2 for OS/390 and z/OS: DB2 Administration Server for z/OS (HDAS810), GI10-8472
The following PSP buckets are referenced in this redbook:
390 Enablement V6 (Upgrade DB2610, subset JDB661D) 390 Enablement V7 (Upgrade DB2710, subset JDB771D) DAS (for DB2/390 V7) (Upgrade DB2710, subset HDAS810)
You must be registered as an SAP Service Marketplace user to access the following resources. The registration requires an SAP installation or customer number. To register, go to:
http://service.sap.com
Installation Guide SAP Web Application Server 6.20 on UNIX: IBM DB2 Universal Database for OS/390 and z/OS, SAP document available at:
http://service.sap.com/instguides
SAP on IBM DB2 UDB for OS/390 and z/OS: Database Administration Guide, SAP Web Application Server, Release 6.20, SAP document available at:
http://service.sap.com/instguides
270
SAP on DB2 UDB for OS/390 and z/OS: Multiple Components in One Database (MCOD)
SAP R/3 Homogeneous System Copy, Release 4.6C SR2, material number 51013678 SAP Web Application Server 6.20: Homogeneous and Heterogeneous System Copy, SAP document available at:
http://service.sap.com/instguides
SAP Notes
You must be registered as an SAP Service Marketplace user to access the following resources. The registration requires an SAP installation or customer number. To register, go to:
http://service.sap.com
DB2/390: APAR List, SAP Note 081737 DB2/390: Backup and Recovery Options, SAP Note 083000 DB2/390: Installing saposcol manually, SAP Note 103135 DB2/390: PTF check tool, SAP Note 183311 DB2/390: DDIC corrections (Releases 4.6A, 4.6B, 4.6C, 4.6D), SAP Note 184399 DB2/390: Transports for 4.6C, SAP Note 217093 DB2/390: Newest version of the CCMS 4.6C, SAP Note 217468 DB2/390: Transports for Release 4.6D, SAP Note 324739 DB2/390: RSDB2MAS new version, SAP Note 330289 DB2/390: Latest version of CCMS 4.6D, SAP Note 337776 DB2/390: Incremental Migration to DB2/390, SAP Note 353558 DB2/390: MCOD installation, SAP Note 399419 DB2/390: New failover support from Release 6.10, SAP Note 402078 DB2/390: DDIC corrections (6.10, 6.20), SAP Note 407663 DB2/390: DB Performance Monitor/IFI Data Collector, SAP Note 426863
Related publications
271
DB2/390: CCMS corrections (6.10, 6.20), SAP Note 427748 DB2/390: MCOD installation tools, SAP Note 580665
You can also download additional materials (code samples or diskette/CD-ROM images) from that site.
272
SAP on DB2 UDB for OS/390 and z/OS: Multiple Components in One Database (MCOD)
Index
Symbols
/etc/services 67 database level recovery 118 database performance analysis 138 database user 4 DB2 Administration Tool for z/OS 44 catalog and directory 8 data sharing 10, 12, 17, 43, 73 maintenance 37 DBA planning calendar 135 DBEXPORT.R3S 35 DBID 59, 61 DBSL 128 DD_GET_STORAGE_CLASS 151 DDIC corrections 37, 128 DDL generation 55 DEFAULT.PFL 36, 66, 107 DEFINE NO 46, 52, 63 DFDSS copy/rename 71 disp+work 128 domain controller 66 DRDA 11 DSN1LOGP 102 DSNACCCx 91 DSNACCMO 90 DSNDB07 113 DSNJU003 64, 112 DSNJU004 22, 102, 111 DSNTEP2 58 DSNUTILS 90
Numerics
390 Enablement (JDB661D or JDB771D) 76
A
ACS routines 6, 59, 85 ADB2GEN 56, 198 alerts 139 application owners 117, 119 application-level recovery 118
B
backup 46, 117 monitor 136 Basis Support Package 128 BIND 36, 67, 129 bufferpools 7, 11, 18
C
cause of error 119, 122 CCMS 128 monitor set 137 transports 37, 128 central DBA planning calendar 131, 134 checklist 19, 23, 47 cloning process 71 wizard 75, 78 cold start 22, 64, 71, 105, 111 conditional restart 70 connect.ini 67 consistency 18, 117 consolidation 19, 118 Control Center 72 creator 5, 59
E
EMC Timefinder 121 environment variables DBS_DB2_SCHEMA 6, 36, 66 DBS_DB2_SSID 66 R3_DB2_SSID 66 SAPDBHOST 66 ESS FlashCopy 70, 73, 117, 121 export 34
D
Database Administration Server (DAS) 76 database layout 145
F
filler tablespaces 57, 230
273
G
GRANT 36, 67
H
hard copy 47 homogeneous system copy (HSC) 70
reasons 43 metadata 46, 53, 5860, 151, 153 mirroring 47 mixed layouts 150 MMCGRTS 101
N I
ICLI 7, 11, 36, 67, 107 IDCAMS ALTER 22, 4546, 63 DELETE 63 Incremental Migration (IMIG) 38 ISOBID 59 ITSO scenarios add one SAP component 30 clone one SAP component 73 merge in place 49 merge using SAP tools 33 recovery of one component 121 system configuration 24 naming conflicts resolution 150 naming convention 7 databases 7, 45, 146, 148 packages 7 plans 7 schema 5, 45 storage groups 6, 45, 146, 148 tablespaces 7, 148 VCAT 6, 45 NPGTHRSH 65
O
OBID 55, 57, 230 offline copy 71 OLAP 10 OLTP 10 online copy 70
J
JES2 internal reader 56
L
license key 1920, 2324 LOB 43 long-running URs 139 LRSN 111, 120
P
partitioned tablespaces 43, 62 patches 36 points of consistency 116, 120 PQ68650 96 PQ68659 76 primary VCAT 72, 84 profile parameters dbs/db2/hosttcp 66 dbs/db2/schema 6, 36, 66 dbs/db2/ssid 66 PSID 59, 61
M
MCOD availability 4 benefits 2 cloning 72, 96 definition 2 drawbacks 3 implementation 9 motivation 2 sizing 16 MCODCE_UNIX_db2.BASE.R3S 36 MCODCE_UNIX_db2.base.R3S 107 MCODMIG_UNIX_db2.BASE.R3S 36 merge in place 43 limitations 43
Q
QUIESCE 120, 122
R
R3SETUP 8, 29 R3trans 128 RBA 22, 44, 111, 120 recovery 18 scenarios 118
274
SAP on DB2 UDB for OS/390 and z/OS: Multiple Components in One Database (MCOD)
steps 123 Redbooks Web site 272 Contact us xvi REORG 52 REPAIR 22, 46 REPAIR INDEX 45, 61 REPAIR LEVELID 45, 63 REPAIR TABLESPACE 45, 61 rfcoscol 128 RSDB2MAS 52, 68 RUNSTATS 23, 60, 65 RVA Snapshot 121
SAPinst 8, 3031 saposcol 128 schema 56, 2021, 3031, 58, 60, 67 security 9 SET LOG SUSPEND 70, 123 SMS 6, 16, 19, 59, 76, 87 soft copy 47 source system 20 split mirror backup 47, 117 STARTRBA 64, 102, 105, 111 statement cache statistics 140 STOSPACE 78, 85, 108
S
SAP components 2, 29 delete 8 install 30 maximum number 17 upgrade 8 SAP Kernel patches 3637, 128 SAP Notes 081737 37 083000 116 183311 37 184399 37 217468 37 330289 52 337776 37 353558 39 399419 30 402078 67 407663 37 427748 37 580665 2930, 35 SAP Service Marketplace quick links MCOD 4, 29 PATCHES 35, 37 quicksizer 16 SAP transactions DB02 133 DB12 136 DB13 135 DB13C 131, 134 DB2 129 DB2J 67 RZ20 137 SM59 131 STMS 66
T
target system 20 templates 29, 35 tp 9, 128 Transport Management System (TMS) 122 transports 128
U
Unicode 11 unique database names 23 unit of recovery 116
V
VCAT 6, 16, 59, 72
X
XMAP member 84, 96
Index
275
276
SAP on DB2 UDB for OS/390 and z/OS: Multiple Components in One Database (MCOD)
SAP on DB2 UDB for OS/390 and z/OS: Multiple Components in One Database (MCOD)
Back cover
SAP on DB2 Universal Database for OS/390 and z/OS: Multiple Components in One Database (MCOD)
Hands-on scenarios to merge SAP components into an MCOD landscape How to clone one SAP component using the Control Center Recovery considerations in an MCOD landscape
The Multiple Components in One Database (MCOD) feature of SAP enables a reduction in the number of DB2 systems that need to be installed and maintained. This significantly simplifies overall database administration and is considered one of the major DB2 competitive advantages. This IBM Redbook will help systems administrators, database administrators, managers, and operation staff to plan, implement, and administer an SAP MCOD landscape with DB2 Universal Database (UDB) for OS/390 and z/OS as the database management system. We describe how to merge existing systems into a single DB2 subsystem. Two different methods are developed, each of them addressing different needs. For small-to-medium SAP systems where high availability is not a requirement, we explain how to use SAP tools. For large systems, where the down time needed by SAP standard procedures is not acceptable, we document a technique to merge SAP components without moving the data. We also provide a cloning procedure using the Control Center. We show how to clone one component out of an MCOD landscape. We address the backup and recovery implications in an MCOD environment, to help database administrators plan accordingly. We also describe how to set up and use the Computer Center Management System (CCMS) in an MCOD landscape.
BUILDING TECHNICAL INFORMATION BASED ON PRACTICAL EXPERIENCE IBM Redbooks are developed by the IBM International Technical Support Organization. Experts from IBM, Customers and Partners from around the world create timely technical information based on realistic scenarios. Specific recommendations are provided to help you implement IT solutions more effectively in your environment.