Académique Documents
Professionnel Documents
Culture Documents
Corinne Baragoin David Bryant Allison Francois Jay Kim Rakesh Ranjan
ibm.com/redbooks
International Technical Support Organization DB2 Warehouse Management: High Availability and Problem Determination Guide March 2002
SG24-6544-00
Take Note! Before using this information and the product it supports, be sure to read the general information in Special notices on page xix.
First Edition (March 2002) This edition applies to IBM DB2 Universal Database V7.2 and IBM DB2 Warehouse Manager V7.2. Comments may be addressed to: IBM Corporation, International Technical Support Organization Dept. QXXE Building 80-E2 650 Harry Road San Jose, California 95120-6099 When you send information to IBM, you grant IBM a non-exclusive right to use or distribute the information in any way it believes appropriate without incurring any obligation to you.
Copyright International Business Machines Corporation 2002. All rights reserved. Note to U.S Government Users Documentation related to restricted rights Use, duplication or disclosure is subject to restrictions set forth in GSA ADP Schedule Contract with IBM Corp.
Contents
Figures . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . ix Tables . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . xv Examples. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . xvii Special notices . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . xix IBM trademarks . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . xx Preface . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . xxi The team that wrote this redbook . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . xxi Notice . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . xxiii Comments welcome . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . xxiv Chapter 1. DB2 warehouse management architecture . . . . . . . . . . . . . . . . 1 1.1 Generic ETML subsystem architecture . . . . . . . . . . . . . . . . . . . . . . . . . . . . 2 1.2 DB2 Warehouse Manager components . . . . . . . . . . . . . . . . . . . . . . . . . . . 4 1.2.1 Warehousing tasks and objects . . . . . . . . . . . . . . . . . . . . . . . . . . . . 11 1.2.2 The Data Warehouse Center . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 13 1.2.3 The warehouse server . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 16 1.2.4 The warehouse control database . . . . . . . . . . . . . . . . . . . . . . . . . . . 16 1.2.5 The warehouse agent . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 16 1.2.6 Publishing metadata to Information Catalog Manager . . . . . . . . . . . 20 1.2.7 Accessing data sources . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 21 1.2.8 DB2 Warehouse Manager Connectors . . . . . . . . . . . . . . . . . . . . . . . 23 1.2.9 Additional tools and functions . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 27 Chapter 2. Possible failure scenarios and their consequences . . . . . . . . 31 2.1 Hardware server failures . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 31 2.1.1 Source server failure . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 32 2.1.2 Target server failure . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 33 2.1.3 Warehouse server failure . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 33 2.2 Network failures. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 33 2.3 Disk failures . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 34 2.4 Failures in DB2 Warehouse Manager server . . . . . . . . . . . . . . . . . . . . . . 34 2.5 Agent failure . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 36 2.6 Recommendations . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 37 Chapter 3. Database backup and recovery . . . . . . . . . . . . . . . . . . . . . . . . . 39
iii
3.1 Overview . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 40 3.2 Planning considerations . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 41 3.2.1 Speed of recovery . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 41 3.2.2 Backup window . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 41 3.2.3 Recovery points . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 42 3.2.4 Unit of recovery . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 42 3.2.5 Backup of other supporting files . . . . . . . . . . . . . . . . . . . . . . . . . . . . 43 3.2.6 Keeping related data together . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 43 3.2.7 Using different operating systems . . . . . . . . . . . . . . . . . . . . . . . . . . . 43 3.3 Recovery concepts and terminology . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 44 3.3.1 Unit of work . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 44 3.3.2 Recovery methods . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 44 3.3.3 Database logs . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 52 3.3.4 Disaster recovery . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 62 3.4 Database backup . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 63 3.4.1 Using the db2 backup db command . . . . . . . . . . . . . . . . . . . . . . . . . 63 3.4.2 Invoking the db2 backup db command . . . . . . . . . . . . . . . . . . . . . . . 65 3.4.3 Displaying backup information . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 66 3.4.4 LAN-free backup . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 66 3.4.5 Backing up to named pipes . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 67 3.4.6 Optimizing backup performance . . . . . . . . . . . . . . . . . . . . . . . . . . . . 68 3.4.7 Backup restrictions . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 69 3.5 Database restore . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 70 3.5.1 Using the db2 restore db command . . . . . . . . . . . . . . . . . . . . . . . . . 70 3.5.2 Invoking the db2 restore db command . . . . . . . . . . . . . . . . . . . . . . . 71 3.5.3 Tablespace redirected restore . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 72 3.5.4 Restoring to an existing database . . . . . . . . . . . . . . . . . . . . . . . . . . . 74 3.5.5 Restoring to a new database . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 75 3.5.6 Optimizing restore performance . . . . . . . . . . . . . . . . . . . . . . . . . . . . 76 3.5.7 Restore restrictions . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 77 3.6 Rollforward recovery . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 77 3.6.1 Using the db2 rollforward db command . . . . . . . . . . . . . . . . . . . . . . 77 3.6.2 Invoking the db2 rollforward db command . . . . . . . . . . . . . . . . . . . . 79 3.6.3 Rollforward cases . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 80 3.6.4 Tablespace rollforward recovery . . . . . . . . . . . . . . . . . . . . . . . . . . . . 81 3.6.5 Point-in-time recovery . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 82 3.6.6 Quiesced state . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 83 3.6.7 Recovering a dropped table . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 85 3.6.8 Rollforward restrictions . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 86 3.7 Backup and restore hints for partitioned databases . . . . . . . . . . . . . . . . . 87 3.8 Useful data movement tools . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 88 3.8.1 The db2move tool . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 89 3.8.2 The db2look tool . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 90
iv
3.8.3 Export and import utilities . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 3.9 Disaster recovery . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 3.9.1 Transport of database backup . . . . . . . . . . . . . . . . . . . . . . . . . . . 3.9.2 Transport of database backup and archived logs . . . . . . . . . . . . . 3.9.3 Standby database via log shipping . . . . . . . . . . . . . . . . . . . . . . . . 3.9.4 Standby database via replication . . . . . . . . . . . . . . . . . . . . . . . . . 3.9.5 Synchronous remote mirroring of all data and log files . . . . . . . . .
.. .. .. .. .. .. ..
92 92 93 93 93 94 95
Chapter 4. High Availability techniques . . . . . . . . . . . . . . . . . . . . . . . . . . . 97 4.1 Overview . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 98 4.2 Clustering and failover support . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 99 4.2.1 Cluster configurations . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 101 4.2.2 High Availability on AIX . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 104 4.2.3 High Availability on the Windows operating system . . . . . . . . . . . . 108 4.3 High Availability of media . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 111 4.3.1 DB2 UDB support for High Availability of media . . . . . . . . . . . . . . . 111 4.3.2 Disk mirroring in AIX . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 112 4.3.3 RAID technology . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 113 4.3.4 High Availability through split mirror . . . . . . . . . . . . . . . . . . . . . . . . 119 4.3.5 Tivoli Storage Manager . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 138 Chapter 5. Warehouse control database recovery scenarios . . . . . . . . . 147 5.1 Before starting to use DB2 Warehouse Manager . . . . . . . . . . . . . . . . . . 148 5.1.1 Configure at least two warehouse servers . . . . . . . . . . . . . . . . . . . 148 5.1.2 Back up the warehouse control database . . . . . . . . . . . . . . . . . . . . 148 5.1.3 Maintain multiple administrative clients . . . . . . . . . . . . . . . . . . . . . . 148 5.1.4 Enable the warehouse control database for rollforward recovery . . 149 5.1.5 Allocate enough logging space . . . . . . . . . . . . . . . . . . . . . . . . . . . . 150 5.2 Warehouse control database recovery overview . . . . . . . . . . . . . . . . . . 151 5.3 Backing up the control database using DB2 UDB . . . . . . . . . . . . . . . . . . 152 5.3.1 Full offline backup . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 152 5.3.2 Full online backup . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 159 5.3.3 Tablespace backup . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 163 5.3.4 Incremental backup . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 168 5.3.5 Verifying DB2 UDB backup image files . . . . . . . . . . . . . . . . . . . . . . 169 5.3.6 Automating DB2 UDB backup . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 173 5.4 Recovering the control database using DB2 UDB . . . . . . . . . . . . . . . . . 180 5.4.1 Restore recovery . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 180 5.4.2 Rollforward recovery . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 185 5.4.3 Point-in-time recovery . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 196 5.4.4 Tablespace redirected recovery . . . . . . . . . . . . . . . . . . . . . . . . . . . 207 5.4.5 Dropped table recovery . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 216 5.4.6 Restoring your control database into a new DB2 UDB instance . . . 219
Contents
5.4.7 Recovering the recovery history file . . . . . . . . . . . . . . . . . . . . . . . . 221 5.4.8 Restarting restore and rollforward . . . . . . . . . . . . . . . . . . . . . . . . . . 222 5.4.9 Restore without rolling forward . . . . . . . . . . . . . . . . . . . . . . . . . . . . 223 5.5 Backup and recovery using Data Warehouse Center . . . . . . . . . . . . . . . 224 5.5.1 Exporting and importing Data Warehouse Center metadata . . . . . 224 Chapter 6. Problem determination methodology . . . . . . . . . . . . . . . . . . . 229 6.1 A methodology in three phases . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 230 6.2 The generic troubleshooting methodology . . . . . . . . . . . . . . . . . . . . . . . 231 6.3 The problem determination phase. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 232 6.3.1 A problem occurs . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 233 6.3.2 How to start problem determination . . . . . . . . . . . . . . . . . . . . . . . . 234 6.3.3 Understanding DB2 Warehouse Manager architecture . . . . . . . . . 239 6.4 The problem source identification phase. . . . . . . . . . . . . . . . . . . . . . . . . 241 6.4.1 Where to find additional error information . . . . . . . . . . . . . . . . . . . . 242 6.4.2 Other resources/tools to use . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 259 6.5 The problem fixing phase . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 262 6.5.1 User errors . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 262 6.5.2 Operating system errors . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 267 6.5.3 Looking at the problem areas identified . . . . . . . . . . . . . . . . . . . . . 270 6.5.4 What to do when the failure area is not identified . . . . . . . . . . . . . . 286 Chapter 7. DB2 Warehouse Manager hints and tips . . . . . . . . . . . . . . . . 287 7.1 Building a restartable application . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 288 7.1.1 Extraction . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 289 7.1.2 Transformation . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 290 7.1.3 Moving and loading data with DB2 Warehouse Manager . . . . . . . . 292 7.2 Application design hints and tips . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 292 7.3 Step and process failures . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 294 7.3.1 Step and process definition . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 294 7.3.2 What happens when a step/process fails . . . . . . . . . . . . . . . . . . . . 296 7.4 Steps and process hints and tips . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 302 7.4.1 Process general design checklist . . . . . . . . . . . . . . . . . . . . . . . . . . 302 7.4.2 SQL steps . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 303 7.4.3 UDPs . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 303 7.4.4 Transformers . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 304 7.5 Specific application hints and tips . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 305 7.5.1 How to set up data exception with DB2 Warehouse Manager . . . . 305 7.5.2 How to update summary records (incremental aggregation) . . . . . 306 7.6 General performance advice . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 306 7.6.1 High resource utilization: CPU, memory, and disk . . . . . . . . . . . . . 307 7.6.2 Overall system-wide performance. . . . . . . . . . . . . . . . . . . . . . . . . . 307 7.6.3 Stored procedures performance considerations . . . . . . . . . . . . . . . 308
vi
7.6.4 Dynamically scale load processing . . . . . . . . . . . . . . . . . . . . . . . . . 310 7.7 Performance checklist when testing applications . . . . . . . . . . . . . . . . . . 311 Appendix A. Using DB2 Warehouse Manager Connector for the Web. . 313 A.1 Using Web Connector: step-by-step procedure . . . . . . . . . . . . . . . . . . . 313 A.1.1 Using WebSphere Site Analyzer administration interface . . . . . . . 313 A.1.2 Using the Data Warehouse Center user interface . . . . . . . . . . . . . 321 A.2 Hints and tips for using the Web Connector . . . . . . . . . . . . . . . . . . . . . . 327 Appendix B. Using DB2 Warehouse Manager Connector for SAP . . . . . 331 B.1 Using SAP R/3 connector: step-by-step procedure . . . . . . . . . . . . . . . . 331 B.2 Hints and tips for using the SAP R/3 Connector . . . . . . . . . . . . . . . . . . . 342 Appendix C. Recovering the Information Catalog Manager database . . 343 C.1 Information Catalog Manager database . . . . . . . . . . . . . . . . . . . . . . . . . 343 C.2 ICM configuration information . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 344 Appendix D. UDP to invoke SQL statements and get SQL codes back . 345 D.1 The UDP source code . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 346 D.2 Procedure to use the UDP under Windows NT/2000 . . . . . . . . . . . . . . . 352 Appendix E. Moving from test to production environment . . . . . . . . . . . 357 E.1 Test to production initial migration . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 357 E.1.1 Demoting and copying the steps . . . . . . . . . . . . . . . . . . . . . . . . . . 358 E.1.2 Copying steps and moving to a different subject area . . . . . . . . . . 358 E.1.3 Changing the database definition . . . . . . . . . . . . . . . . . . . . . . . . . . 358 E.1.4 Creating the test environment. . . . . . . . . . . . . . . . . . . . . . . . . . . . . 359 E.2 Test to production incremental migration . . . . . . . . . . . . . . . . . . . . . . . . 360 E.2.1 Partial migration . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 361 Related publications . . . . . . . . . . . . . . . . . . . . . . IBM Redbooks . . . . . . . . . . . . . . . . . . . . . . . . . . . . Other resources . . . . . . . . . . . . . . . . . . . . . . . . Referenced Web sites . . . . . . . . . . . . . . . . . . . . . . How to get IBM Redbooks . . . . . . . . . . . . . . . . . . . IBM Redbooks collections . . . . . . . . . . . . . . . . . ...... ...... ...... ...... ...... ...... ....... ....... ....... ....... ....... ....... ...... ...... ...... ...... ...... ...... . . . . . . 363 363 363 365 365 365
Index . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 367
Contents
vii
viii
Figures
1-1 1-2 1-3 1-4 1-5 1-6 1-7 1-8 1-9 1-10 1-11 1-12 3-1 3-2 3-3 3-4 3-5 3-6 3-7 3-8 3-9 3-10 3-11 3-12 3-13 3-14 3-15 3-16 3-17 3-18 3-19 4-1 4-2 4-3 4-4 4-5 4-6 4-7 The population subsystem reference architecture . . . . . . . . . . . . . . . . . . 4 DB2 Warehouse Manager architectural view. . . . . . . . . . . . . . . . . . . . . . 7 Pre-built transformers . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 12 Data Warehouse Center GUI Interface . . . . . . . . . . . . . . . . . . . . . . . . . 14 Agent-based architecture . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 17 Agent configuration: all components on the same machine . . . . . . . . . 18 Agent configuration: agent located on the target server . . . . . . . . . . . . 19 Agent configuration: agent located on the source server. . . . . . . . . . . . 20 The Web Connector integration . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 24 WebSphere Site Analyzer and DB2 Warehouse Manager . . . . . . . . . . 25 The SAP R/3 Connector integration. . . . . . . . . . . . . . . . . . . . . . . . . . . . 27 MQ Wizard . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 28 Crash recovery. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 45 Database status from the Control Center . . . . . . . . . . . . . . . . . . . . . . . 46 Restore recovery . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 47 Rollforward recovery . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 50 Incremental backup . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 51 Circular logging . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 53 Online archive logging . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 54 Offline archive logging . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 55 Database configuration parameters related to database logging . . . . . 56 Creating and updating the Recovery History File . . . . . . . . . . . . . . . . . 60 Recovery History File from DB2 UDB journal . . . . . . . . . . . . . . . . . . . . 61 Backup Database notebook in the Control Center. . . . . . . . . . . . . . . . . 66 Restore Database notebook in the Control Center . . . . . . . . . . . . . . . . 72 Restore Database notebook with Redirect option . . . . . . . . . . . . . . . . . 73 How to set a quiesce point for a table . . . . . . . . . . . . . . . . . . . . . . . . . . 84 Information about Quiesced state . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 85 Standby database via log shipping . . . . . . . . . . . . . . . . . . . . . . . . . . . . 94 Standby database via replication . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 95 Remote mirroring for disaster recovery . . . . . . . . . . . . . . . . . . . . . . . . . 95 Clusters and DB2 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 100 High Availability clustering configurations . . . . . . . . . . . . . . . . . . . . . . 101 Idle standby . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 102 Mutual takeover . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 103 Example of a AIX hot standby failover configuration . . . . . . . . . . . . . . 106 Example of a AIX mutual instance failover configuration . . . . . . . . . . . 107 Example MSCS configuration . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 109
ix
4-8 4-9 4-10 4-11 4-12 4-13 4-14 4-15 4-16 4-17 4-18 4-19 4-20 4-21 4-22 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 5-19 5-20 5-21 5-22 5-23 5-24 5-25 5-26 5-27 5-28
MSCS hot standby configuration . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 110 MSCS mutual takeover configuration . . . . . . . . . . . . . . . . . . . . . . . . . 111 RAID-0 (Block interleave data striping without parity) . . . . . . . . . . . . . 115 RAID-1 (Disk mirroring) . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 116 RAID-1 (Disk duplexing) . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 116 RAID-5 (Block interleave data striping with skewed parity) . . . . . . . . . 117 Split mirror concept . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 120 Implementation of FlashCopy . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 124 PPRC write cycle . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 126 StorWatch Expert communicates ESS/ETL through TCP/IP network . 128 DB2 UDB clone database . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 130 DB2 UDB standby database . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 131 DB2 UDB mirror database . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 132 AIX LVM mirroring with three physical copies . . . . . . . . . . . . . . . . . . . 134 Splitcopy read-only filesystem . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 136 Logretain database configuration parameter . . . . . . . . . . . . . . . . . . . . 150 Services window . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 153 Offline backup using DB2 Control Center . . . . . . . . . . . . . . . . . . . . . . 156 Backup Database window in DB2 Control Center . . . . . . . . . . . . . . . . 156 DB2 start backup window . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 157 End of DB2 offline backup message . . . . . . . . . . . . . . . . . . . . . . . . . . 157 DB2 Journal shows the result of the backup . . . . . . . . . . . . . . . . . . . . 158 Online backup using DB2 Control Center . . . . . . . . . . . . . . . . . . . . . . 160 Backup database online in DB2 Control Center . . . . . . . . . . . . . . . . . 161 Select Online in Backup Database Options window . . . . . . . . . . . . . . 161 DB2 start backup window . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 162 End of DB2 online backup message . . . . . . . . . . . . . . . . . . . . . . . . . . 162 DB2 Journal shows the result of the backup . . . . . . . . . . . . . . . . . . . . 163 Select tablespace backup menu . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 165 Select directories or tapes on the backup table space window . . . . . . 166 Select Offline or Online in options window. . . . . . . . . . . . . . . . . . . . . . 166 DB2 start backup window . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 167 End of tablespace backup message . . . . . . . . . . . . . . . . . . . . . . . . . . 167 DB2 Journal shows the result of the tablespace backup . . . . . . . . . . . 168 Select backup database in the DB2 Control Center . . . . . . . . . . . . . . 175 DB2 UDB backup window . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 176 DB2 UDB schedule window . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 176 DB2 UDB message window . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 177 DB2 journal . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 178 DB2 script center . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 179 New command script window . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 179 Restore recovery using the DB2 Control Center . . . . . . . . . . . . . . . . . 183 Backup image selection window . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 184
5-29 5-30 5-31 5-32 5-33 5-34 5-35 5-36 5-37 5-38 5-39 5-40 5-41 5-42 5-43 5-44 5-45 5-46 5-47 5-48 5-49 5-50 5-51 5-52 5-53 6-1 6-2 6-3 6-4 6-5 6-6 6-7 6-8 6-9 6-10 6-11 6-12 6-13 6-14 6-15 6-16 6-17 6-18
DB2 message - Restore job created . . . . . . . . . . . . . . . . . . . . . . . . . . 184 DB2 message window - successful completion . . . . . . . . . . . . . . . . . . 185 Tablespaces window . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 191 Restore using Database drop-down menu . . . . . . . . . . . . . . . . . . . . . 192 Backup image selection . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 193 DB2 message warning . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 193 Table Spaces page . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 194 Roll-forward page. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 194 Options page . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 195 DB2 message - Restore job created . . . . . . . . . . . . . . . . . . . . . . . . . . 195 DB2 message - Successful completion . . . . . . . . . . . . . . . . . . . . . . . . 195 Table Spaces state . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 196 Tablespace point-in-time in the DB2 Control Center . . . . . . . . . . . . . . 204 Backup image selection . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 205 Table Spaces window . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 206 Rollforward options . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 206 Options window . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 207 Tablespace redirected restore in the DB2 Control Center . . . . . . . . . . 211 Backup image selection . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 212 Table Spaces selection . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 212 Container selection . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 213 Change container. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 214 Rollforward option . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 215 Options selection . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 215 Additional information written in Log and Recovery History FIle . . . . . 217 The troubleshooting generic methodology . . . . . . . . . . . . . . . . . . . . . . 232 Problem determination steps . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 233 Error message . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 234 DB2 Information Center . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 235 Troubleshooting Tab in DB2 Information Center . . . . . . . . . . . . . . . . . 236 DB2 Messages. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 237 Search in DB2 documentation . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 238 Error message reference . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 238 Warehouse agent role during population . . . . . . . . . . . . . . . . . . . . . . . 240 Problem source identification steps . . . . . . . . . . . . . . . . . . . . . . . . . . . 242 Data Warehouse Center traces . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 243 Tools settings . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 244 Starting the Control Center trace . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 245 Trace output example . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 246 AS/400 Operations Navigator . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 252 Integrated file systems properties . . . . . . . . . . . . . . . . . . . . . . . . . . . . 253 How to turn the transformer trace on . . . . . . . . . . . . . . . . . . . . . . . . . . 255 Debugging procedure for Web Connector . . . . . . . . . . . . . . . . . . . . . . 258
Figures
xi
6-19 6-20 6-21 6-22 6-23 6-24 6-25 6-26 6-27 6-28 6-29 6-30 6-31 6-32 6-33 6-34 7-1 7-2 7-3 7-4 7-5 7-6 7-7 7-8 7-9 A-1 A-2 A-3 A-4 A-5 A-6 A-7 A-8 A-9 A-10 A-11 A-12 A-13 A-14 A-15 A-16 A-17 A-18
DB2 Warehouse Manager Web site . . . . . . . . . . . . . . . . . . . . . . . . . . 260 List of FAQs on the Web site . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 261 Problem fixing steps. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 262 Linking to the Data Warehouse Center . . . . . . . . . . . . . . . . . . . . . . . . 263 Logon settings . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 264 Logon error example . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 265 db2 list database result . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 265 Warehouse control database initialization . . . . . . . . . . . . . . . . . . . . . . 266 Adding a new user . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 267 Metadata configuration . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 269 Change metadata configuration . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 270 Warehouse server services . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 271 Event log example . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 272 Resolving error symptoms from the process . . . . . . . . . . . . . . . . . . . . 277 Message type. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 279 Hostname defined on agent site definition . . . . . . . . . . . . . . . . . . . . . . 285 ETML phases and processes . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 288 The various steps in the Data Warehouse Center . . . . . . . . . . . . . . . . 295 Step processing options. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 297 Work In Progress Start Screen . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 298 WIP detailed step status . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 298 Run step manually screen . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 299 Manual submission step progress . . . . . . . . . . . . . . . . . . . . . . . . . . . . 300 Step statistics screen example . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 301 Information on the execution history of step . . . . . . . . . . . . . . . . . . . . 302 Using WSA user interface . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 314 Defining a WSA project . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 315 Defining a WSA log file data import . . . . . . . . . . . . . . . . . . . . . . . . . . . 316 Defining a WSA database table . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 317 Defining a Web Tracker data import . . . . . . . . . . . . . . . . . . . . . . . . . . 317 Scheduling a log file data import . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 318 Notification setup for log file data import . . . . . . . . . . . . . . . . . . . . . . . 319 Status for the log file data import extraction. . . . . . . . . . . . . . . . . . . . . 320 Web tracker status monitor window . . . . . . . . . . . . . . . . . . . . . . . . . . . 320 Introducing a new Data Warehouse Center source type . . . . . . . . . . . 321 Defining the WSA interface . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 322 Selecting the data to use . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 323 Storing the data selected . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 323 Introducing the Data Warehouse Center polling step . . . . . . . . . . . . . 324 Defining the polling step parameters . . . . . . . . . . . . . . . . . . . . . . . . . . 325 Define the polling step processing options . . . . . . . . . . . . . . . . . . . . . 325 Using new source and step within the Process Model. . . . . . . . . . . . . 326 Running the process from the Work In Progress window . . . . . . . . . . 327
xii
A-19 B-1 B-2 B-3 B-4 B-5 B-6 B-7 B-8 B-9 B-10 D-1 D-2 D-3 D-4 D-5
Importing Webmart tables flowchart . . . . . . . . . . . . . . . . . . . . . . . . . . 328 Defining SAP R/3 as a new warehouse source . . . . . . . . . . . . . . . . . . 332 Defining application server connection type . . . . . . . . . . . . . . . . . . . . 333 Defining group of server connection type . . . . . . . . . . . . . . . . . . . . . . 334 Selecting SAP R/3 Business Objects. . . . . . . . . . . . . . . . . . . . . . . . . . 335 Defining SAP R/3 as a warehouse source . . . . . . . . . . . . . . . . . . . . . . 336 Defining the parameters of the Business Object selected . . . . . . . . . . 337 Mapping the Business Object parameters . . . . . . . . . . . . . . . . . . . . . . 338 Defining a SAP R/3 process . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 339 Selecting Business Object input parameters . . . . . . . . . . . . . . . . . . . . 340 Selecting SAP R/3 output parameters to be mapped to columns . . . . 341 Define the UDP . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 353 Define UDP parameters . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 354 Define the process . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 354 Process values. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 355 Run the UDP process . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 356
Figures
xiii
xiv
Tables
1-1 1-2 3-1 3-2 4-1 4-2 6-1 6-2 6-3 6-4 6-5 6-6 6-7 6-8 6-9 7-1 Platforms and components . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 10 Client driver program by system . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 21 The logretain and userexit parameters . . . . . . . . . . . . . . . . . . . . . . . . . 59 Disaster recovery methods . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 96 RAID Classifications . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 115 Summary of RAID performance characteristics . . . . . . . . . . . . . . . . . . 118 Log file locations . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 249 UDP trace location . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 250 Levels of trace . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 255 Logtable column definition . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 255 Odbctest program location . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 256 Traces to use with Web Connector . . . . . . . . . . . . . . . . . . . . . . . . . . . 258 Traces to use with SAP Connector . . . . . . . . . . . . . . . . . . . . . . . . . . . 259 Message categories . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 278 iSeries message types . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 280 UNIX commands . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 307
xv
xvi
Examples
3-1 3-2 3-3 4-1 4-2 4-3 4-4 4-5 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 5-19 5-20 5-21 5-22 5-23 5-24 5-25 5-26 5-27 5-28 5-29 5-30 Directory listing . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 64 Restore error message . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 70 Rollforward command results . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 78 Splitcopy example . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 135 db2adutl utility example . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 141 Example db2chkbk. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 143 DB2 list history . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 143 Sample backup and verification script . . . . . . . . . . . . . . . . . . . . . . . . . 144 Update database configuration parameters for rollforward recovery . . 149 Update database configuration parameter to increase logging space . 151 db2start.exe . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 153 Net start command. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 154 List applications command. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 154 Force application command . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 155 Backup command . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 155 Backup online command . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 159 Tablespace backup using the DB2 command line window . . . . . . . . . 164 Setting up TRACKMOD parameter ON using update command . . . . . 169 A full backup before the first incremental backup . . . . . . . . . . . . . . . . 169 Incremental backup . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 169 Checking backup image files using db2ckbckp . . . . . . . . . . . . . . . . . . 170 The db2 list history backup command . . . . . . . . . . . . . . . . . . . . . . . . . 170 db2adutl query . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 171 db2adutl extract . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 171 db2adutl verify . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 172 backpcdb.cmd . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 173 Scheduling backup using AT command. . . . . . . . . . . . . . . . . . . . . . . . 174 Displaying backup schedule . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 174 Container error in db2diag.log . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 181 The list history command results . . . . . . . . . . . . . . . . . . . . . . . . . . . 182 Restoring the warehouse control database . . . . . . . . . . . . . . . . . . . . . 183 List tablespaces to check the state . . . . . . . . . . . . . . . . . . . . . . . . . . . 186 The list history backup command . . . . . . . . . . . . . . . . . . . . . . . . . . . . 187 Restore tablespace command . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 188 List tablespaces command to check the state again . . . . . . . . . . . . . . 189 Rollforward command . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 190 List tablespaces command again. . . . . . . . . . . . . . . . . . . . . . . . . . . . . 190 List tablespaces show detail results . . . . . . . . . . . . . . . . . . . . . . . . 198
xvii
5-31 5-32 5-33 5-34 5-35 5-36 5-37 5-38 5-39 5-40 5-41 5-42 5-43 5-44 5-45 5-46 5-47 5-48 5-49 5-50 5-51 5-52 5-53 5-54 5-55 5-56 5-57 5-58 5-59 5-60 5-61 6-1 6-2 6-3 6-4 6-5 6-6 6-7 6-8 6-9 D-1
The list history command results . . . . . . . . . . . . . . . . . . . . . . . . . . . 200 Restore using the last backup image . . . . . . . . . . . . . . . . . . . . . . . . . . 202 Rollforward to a point-in-time past the minimum recovery time . . . . . . 202 Rollforward stop command . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 203 Tablespace in backup pending state . . . . . . . . . . . . . . . . . . . . . . . . . . 203 Tablespace backup . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 203 List tablespaces to determine the tablespace ID . . . . . . . . . . . . . . . . . 208 List containers for DATASPACE1 . . . . . . . . . . . . . . . . . . . . . . . . . . . . 208 Restore redirect command. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 209 Set tablespace containers command . . . . . . . . . . . . . . . . . . . . . . . . . . 209 Restore continue command . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 209 Rollforward to end of logs and stop . . . . . . . . . . . . . . . . . . . . . . . . . . . 209 List tablespace containers for DATASPACE1 . . . . . . . . . . . . . . . . . . . 210 Alter tablespace with dropped table recover option . . . . . . . . . . . . . . . 216 Checking to see if the dropped table recovery is enabled . . . . . . . . . . 216 List history dropped table . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 217 Restore from backup taken before the drop . . . . . . . . . . . . . . . . . . . . 218 Rollforward with Recover Dropped Table option . . . . . . . . . . . . . . . . . 218 Redefine the table . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 219 Create a database . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 220 Restore into a new database . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 220 Rollforward stop for a new database . . . . . . . . . . . . . . . . . . . . . . . . . . 221 Recover history file command . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 221 Restore USERSPACE1 with a backup image . . . . . . . . . . . . . . . . . . . 222 Rollforward cancel to use different backup image . . . . . . . . . . . . . . . . 222 USERSPACE1 is in restore pending . . . . . . . . . . . . . . . . . . . . . . . . . . 222 Restore USERSPACE1 with a different backup image . . . . . . . . . . . . 223 Rollforward to end of logs . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 223 Restore without rolling forward . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 223 Rollforward query status . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 224 Rollforward with stop . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 224 Using db2level command. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 268 DSPCATRC output . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 275 DSNAOINI file . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 276 Find the corrupted relationships. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 282 Correct the inconsistency. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 282 Identify the steps that have dangling correlation objects . . . . . . . . . . . 283 Delete the dangling correlation objects . . . . . . . . . . . . . . . . . . . . . . . . 283 Delete the relationships to the dangling objects . . . . . . . . . . . . . . . . . 283 Error message example . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 284 Source program . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 346
xviii
Special notices
References in this publication to IBM products, programs or services do not imply that IBM intends to make these available in all countries in which IBM operates. Any reference to an IBM product, program, or service is not intended to state or imply that only IBM's product, program, or service may be used. Any functionally equivalent program that does not infringe any of IBM's intellectual property rights may be used instead of the IBM product, program or service. Information in this book was developed in conjunction with use of the equipment specified, and is limited in application to those specific hardware and software products and levels. IBM may have patents or pending patent applications covering subject matter 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 the IBM Director of Licensing, IBM Corporation, North Castle Drive, Armonk, NY 10504-1785. Licensees of this program who wish to have information about it for the purpose of enabling: (i) the exchange of information between independently created programs and other programs (including this one) and (ii) the mutual use of the information which has been exchanged, should contact IBM Corporation, Dept. 600A, Mail Drop 1329, Somers, NY 10589 USA. Such information may be available, subject to appropriate terms and conditions, including in some cases, payment of a fee. The information contained in this document has not been submitted to any formal IBM test and is distributed AS IS. The use of this information or the implementation of any of these techniques is a customer responsibility and depends on the customer's ability to evaluate and integrate them into the customer's operational environment. While each item may have been reviewed by IBM for accuracy in a specific situation, there is no guarantee that the same or similar results will be obtained elsewhere. Customers attempting to adapt these techniques to their own environments do so at their own risk. Any pointers in this publication to external Web sites are provided for convenience only and do not in any manner serve as an endorsement of these Web sites.
xix
IBM trademarks
The following terms are trademarks of the International Business Machines Corporation in the United States and/or other countries:
e (logo) Redbooks (logo) AIX AS/400 DataJoiner DB2 DB2 Connect DB2 OLAP Server DB2 Universal Database DRDA Enterprise Storage Server ESCON FlashCopy IBM IMS Informix iSeries MQSeries OS/2 OS/390 OS/400 Perform pSeries QMF Redbooks RETAIN S/390 Seascape SP SP1 StorWatch System/390 Tivoli TME Visual Warehouse WebSphere z/OS zSeries Lotus Lotus Notes Notes Working Together
xx
Preface
The majority of warehouse systems run with little or no special protection or availability measures, but as warehouses get bigger or more crucial to the running of a business, then better and better service levels are expected. This IBM Redbook includes many detailed facets of recovery and High Availability. We do not mean to say that every system needs to employ such measures. Rather, we present what is possible and let the reader decide what is appropriate for their environment. The objective of this book is to deliver guidelines for building a High Availability DB2 warehouse environment and to assist with problem determination when using DB2 Warehouse Manager. This book will help you to understand the DB2 Warehouse Manager architecture and components, and to cope with system failures and their consequences. It also provides a set of documentation on the different High Availability techniques that can be used when facing database, server, or disk failures. Finally, we develop a problem determination methodology to help warehouse administrators and implementors to diagnose failures and understand how to solve them or to restart. Application design recommendations and performance advice are also provided to help in designing and building the warehouse population subsystem when using DB2 Warehouse Manager.
xxi
David Bryant is an IBM Consultant IT Specialist working with Business Intelligence and Warehousing systems across Europe. He joined IBM in 1969, and in the first 10 to 15 years worked on many large system installations in the UK, specializing in operating systems and their performance. He then moved into the Business Intelligence and Data Warehousing, an area on which he has concentrated for almost 20 years. David holds a BSc degree in Physics from Southampton University. He has had extensive experience with many customer projects across many different industries. Allison Francois is an IT supporting Business Intelligence technical presales activities in the IBM Americas Business Intelligence Solutions Center in Dallas, Texas. She has over 18 years in the IT field with an emphasize on AS/400 and iSeries. For the past 6 years she has been implementing data warehouse proof-of-concepts on the iSeries. Allison was the coauthor of the Business Intelligence Certification Guide redbook. She holds a degree in Mathematics from Morgan State University, Baltimore, Maryland. Allison expertise includes DB2 UDB, DB2 Warehouse Manager, and DB2 OLAP Server. Jay Kim is an IBM Certified Consulting IT Specialist, currently a member of IBM Global Services Business Metrics and Decision Support organization, located in Southbury, Connecticut. Jay has over 24 years of IT experience, focusing primarily on DB2 across all platforms and Business Intelligence solutions, and he has IBM Certifications in DB2 UDB, including Advanced Technical Expert and Solutions Expert for Application Development and Database Administration. Rakesh Ranjan is a Staff Software Engineer at IBM Silicon Valley Lab in San Jose, CA. He has 8 years of experience working with application development on iSeries (AS/400). Rakesh holds a bachelors degree in Electronics and Communication Engineering from India. His areas of expertise at IBM include DB2 UDB for iSeries, and he currently works as a member of the DB2 Warehouse Manager Agent development team. We would like to especially thank the following people for their contributions in providing contents to be incorporated within these pages: Michio Kikuchi Matthias Tschaffler IBM Silicon Valley Laboratory Also, thanks to the following people for their contributions to this project by providing their support, technical input and/or reviewing this redbook: Rohit Agarwal Lynnette Bakow Aakash Bordia Cathy Drummond
xxii
Julie Jerves Madhu Kochar Jacques Labrie Steve Madsen Cindy Marlow Michele Schwartz IBM Silicon Valley Laboratory Chris Eaton IBM Toronto Laboratory Andy Perkins IBM Advanced Technical Support Business Intelligence IBM Americas Kevin P Jones IBM EMEA Technical Sales Business Intelligence Solutions Simon Woodcock IBM EMEA Technical Sales Data Management Solutions Pierre Carrier IBM CRM and Business Intelligence Services in Canada Karl-Heinz Scheible IBM Technical Sales Data Management Solutions in Germany Ron Fryer IBM WW Business Intelligence Solutions Marketing
Notice
This publication is intended to help warehouse implementors and administrators understand recovery and High Availability techniques to use with DB2 warehouse management and to assist them in problem determination. The information in this publication is not intended as the specification of any programming interfaces that are provided by IBM DB2 Universal Database and DB2 Warehouse Manager products. See the PUBLICATIONS section of the IBM Programming Announcement for the product names above for more information about what publications are considered to be product documentation.
Preface
xxiii
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
xxiv
Chapter 1.
Another issue is synchronization between the core data warehouse and any necessary data marts. The marts need to be kept current and consistent with the warehouse, but in a way which does not require extensive manual intervention: hence, the need for a tool like DB2 Warehouse Manager. Designing a data warehouse/datamart population subsystem is an important phase to build a consistent and maintainable data warehouse. The recommended reference architecture for a data warehouse population subsystem is defined in Figure 1-1. This architecture splits the processing into layers, such that each layer performs a specific function which does not overlay into other layers. The processes in each layer are encapsulated, such that what happens in one layer is of no concern to the other layers. This approach allows us to implement a more modular approach, allows the layers to be modified independently, and allows layers to be moved to other platforms with minimal impact to the other layers. It can be utilized to build an easily recoverable population subsystem. The software architecture and components delivered with DB2 Warehouse Manager represents a framework for the design and construction of some type of run-time system. This allows to make intelligent decisions regarding the sometimes conflicting requirements of: Build-time Adaptability/Reusability/Testability Run-time Efficiency/Reliability/Availability/Security As you can see, this architecture has physical components, each of which provides a certain set of services based on its logical layers. Each physical component will likely be one or more technical functions implemented via user program, database, or file utility provided by DB2 Warehouse Manager or most likely, a combination of all of these.
Physical components
Extract Component
Prepare Component
Load Component
E X T R A C T
P R E F O R M A T
F I L T E R
M E R G E
D E L T A
C L E A N
T R A N S F O R M
B U I L D
L O A D
Logical Layers
Figure 1-1 The population subsystem reference architecture
For additional information on this architecture and on the description of each component, please read Building the Operational Data Store on DB2 UDB, SG24-6413.
Data warehouses are continuing to grow. DB2 warehouse management provides point-to-point data movement in distributed environments for DB2 data warehouses on Windows NT/2000, OS/2, AIX (pSeries), SUN Solaris, OS/400 (iSeries), and z/OS and OS/390 (zSeries). To speed warehouse and datamarts deployment with commonly used, pre-built data cleansing and statistical transformations. These capabilities can be expanded by adding your own user-defined transformation functions or by integrating products from other vendors, like ETI*Extract or Vality INTEGRITY. Information is also deployed across corporations, between corporations, and to consumers. Managing their access is becoming increasingly important. Packaged as part of the Query Manager is a Web-based query and reporting tool called the Query Management Facility (QMF). It also includes an Information Catalog that allows users to find, understand, and access relevant and accurate information about their data warehouses and datamarts, as well as other sources like files, charts, spreadsheets, and reports. To build and manage from a central point of control, integrated in DB2 UDB, utilizing the Data Warehouse Center graphical user interface. Some of the bits of DB2 warehouse management are chargeable. DB2 warehouse management consists of: An administrative client to define and manage data warehousing tasks and objects, and warehouse or datamart operations: the Data Warehouse Center A manager to manage and control the flow of data: the warehouse server Agents residing on DB2 UDB server platforms (that could be also SUN, HP, Dell and so on) to perform requests from the manager or warehouse server: the local or remote warehouse agent A warehouse control database storing the warehouse management metadata on a DB2 UDB database on UNIX or Intel server A metadata administrative and publishing tool with its own administration graphical user interface (GUI): Information Catalog Manager to manage and present both technical and business metadata. The Information Catalog data may be stored on any licensed DB2 UDB platform. Users may access the Information Catalog through a Web browser.
Data sources:
Any IBM DB2 family databases may be used as data sources. Oracle, Sybase, IBM Informix, and Microsoft SQL Server are databases that require installation of the appropriate ODBC client software.
Flat files: Flat files can be accessed via ODBC on UNIX and Windows NT/2000 platforms. Sequential data sets can be first loaded in DB2 UDB using DB2 load utility, specifically in z/OS and OS/390 environment. They can also be sent through File Transfer Program (FTP) to other platforms (UNIX and Windows/NT) and accessed via ODBC there.
Lotus 1.2.3 spreadsheets and Lotus Notes databases through Data Warehouse Center generic ODBC driver Any data access through DataJoiner Any changes propagation using IBM Data Replication Any OLE-DB source IMS and VSAM data through the Classic Connect drivers that are shipped as part of the DB2 Warehouse Manager feature Classic Connect is separate and chargeable. The zSeries (OS/390) warehouse agent can access IMS and VSAM through the Classic Connect ODBC driver. With Classic Connect, you can set up a DB2-like definition of IMS and VSAM data sets, and then access them using ODBC. You must purchase and install Classic Connect separately from the warehouse agent.
Any application source access through: DB2 Warehouse Manager Connector for Web logs DB2 Warehouse Manager Connector for SAP R/3 data WebSphere MQ (MQSeries) queues
Data target or data warehouse (datamarts) on any DB2 UDB database as:
DB2 UDB for OS/400 DB2 UDB for z/OS and OS/390 DB2 UDB for UNIX or Windows NT/2000
Data target or multidimensional datamart integration that are built on IBM DB2 OLAP Server or Hyperion Essbase
Additional data administrator tools and complementary products may be used to enhance the warehousing solution for: Warehouse design and data modeling: Erwin Query reports: QMF for Windows, Brio Enterprise, Business Objects Long running queries monitoring and tuning: Query Patroller OLE DB sources support
Name and address cleansing: Support for INTEGRITY from Vality Support for Trillium Batch System
Additional more complex extraction and transformation than DB2 Warehouse Manager itself can achieve, the following products can also be integrated: ETI*Extract from ETI: development runs on Windows and UNIX environment and it generates code that can be run on many platforms DataStage from Ascential
The different components of DB2 Warehouse Manager are shown in Figure 1-2.
Warehouse Server
Warehouse Agents
Data Data
Databases
End Users
Message Message
Relational Source
Data
DB2 Target
NonRelational Source
Non-DB2 Target
Data
Type title
DB2
1.Typ te e xt
The DB2 warehouse management functionality has been packaged in two parts. Part 1: This basic part is delivered with DB2 UDB servers V7.2 for any edition. It is visualized through the Data Warehouse Center, which is the graphical user interface for warehouse management, integrated under DB2 UDB Control Center. Installing DB2 UDB on Windows NT or 2000 platforms provides: Data Warehouse Center Warehouse server (Windows NT/2000 only) Default Windows NT/2000 warehouse agent, which can only be installed on the warehouse server machine DB2 OLAP Starter Kit, to start building multidimensional applications Note: DB2 UDB set up on AIX and SUN Solaris platforms provides also the Data Warehouse Center graphical user interface on these platforms. Part 2: This extended part is obtained by purchasing DB2 Warehouse Manager additional licences that include support for remote native platform execution, Data Warehouse Center extensions and additional data administrator tools. There are three DB2 Warehouse Manager offerings: DB2 Warehouse Manager V7.2 for UNIX, Windows and OS/2 is a priced option of a licensed copy of DB2 UDB Enterprise Edition V7.2 or DB2 UDB Enterprise - Extended Edition V7.2. Note: For each DB2 Warehouse Manager V7.2 ordered, there must also be a corresponding license of DB2 UDB Enterprise Edition or DB2 UDB Enterprise - Extended Edition V7.2 to which DB2 Warehouse Manager is licensed. DB2 Warehouse manager for UNIX, Windows and OS/2 provides: Data Warehouse Center extensions such as these: Additional distributed warehouse agents for AIX, Solaris, Windows NT/2000 and OS/2 platforms Note: Classic Connect ODBC drivers are provided with the Windows NT/2000 agent for access to IMS or VSAM sources on OS/390 and z/OS, but the Classic Connect product must be purchased separately. Extended transformers that are prebuilt stored procedures and User Defined Functions for warehouse and statistical transformations WebSphere MQ support ODBC targets
Information Catalog Manager to publish metadata DB2 Query Patroller, which may only be used on DB2 UDB Enterprise Edition or DB2 UDB Enterprise - Extended Edition, to which DB2 Warehouse Manager is licensed QMF for Windows, now integrated with Query Patroller and QMF queries, can be submitted to Query Patroller to take advantage of its additional capabilities. Add-on priced features called Connectors: DB2 Warehouse Manager Connector for Web, DB2 Warehouse Manager Connector for SAP R/3 DB2 Warehouse Manager V7.2 for AS/400 (iSeries) is a stand-alone product that provides: Data Warehouse Center extensions as: Additional distributed warehouse agent for iSeries platform that requires at least AS/400 V4.3 or later Extended AS/400 transformers that are prebuilt stored procedures and User Defined Functions for warehouse and statistical transformations that require AS/400 V4.5 with Java Stored Procedure environment Information Catalog Manager to publish metadata QMF for Windows that may only be used to access warehouse data stored on the iSeries machine DB2 UDB V7.2 Enterprise Edition with restricted use to the DB2 warehouse databases management DB2 Warehouse Manager V7.2 for z/OS and OS/390 (zSeries) is a feature code of DB2 UDB Server for OS/390 Version 7 and provides: Data Warehouse Center extensions such as: Additional distributed warehouse agent for zSeries (OS/390) that requires UNIX System Services and TCP/IP Extended zOS and OS/390 transformers that are prebuilt stored procedures and User Defined Functions for warehouse and statistical transformations that require OS/390 V7.2 with Java Stored Procedure support Information Catalog Manager to publish metadata DB2 UDB V7.2 Enterprise Edition with restricted use to the DB2 warehouse databases management The systems and platforms where these components reside are described in Table 1-1. We will use DB2 Warehouse Manager term generically to discuss components in both DB2 UDB and DB2 Warehouse Manager products.
Data Warehouse Center Warehouse Server Warehouse Agent/Transformer Information Catalog Manager Connectors GUI Metadata Web SAP R/3
Y Y Y
Y Y Y Y Y Y
WebSphere MQ integration Classic Connect ODBC drivers QMF for Windows Additional tools Query Patroller OLE DB support Trillium integration
Y
Y Y Y Y
10
11
User Defined Program (UDP) steps: A UDP is an external program or script defined to the Data Warehouse Center that represents a business-specific transformation to be started by the Data Warehouse Center. A UDP can perform many different tasks, for example: Export data from a table Manipulate that data in regard to specific business requirements Write the data to a temporary output resource or a warehouse target
A step can be run on demand and can be scheduled to run at the same time. When scheduling a process, all the root steps in the process run at the scheduled time.
12
bd e m as n i eb d luo hs se lb at te g r a t/ ec ruos
s re mro f sn a r t esuoher aw
s re m ro fs n a r t l ac i tsi t a ts
13
The Data Warehouse Center eases the tasks necessary to do the following: Register and access data sources: DB2 UDB, Informix, Oracle, Microsoft SQL Server, Sybase, flat file sources, OLE-DB sources, application sources like WebSphere MQ queues, SAP R/3 and Web
14
Define extraction steps: Several extraction methods are available within Data Warehouse Center including SQL SELECT, DB2 UDB utility execution (load, import, export and so on). In addition, other extraction tools as ETI*Extract, cleaning tool as Vality INTEGRITY or user-written extraction program can be plugged into the process. Define transformation steps: There are over 100 built-in transformations leveraging SQL: Data Warehouse Center provides rich transformation features based on SQL. DB2 UDB provides a very rich SQL capability enabling a variety of transformation functions. DB2 Warehouse Manager provides specific transformers, including commonly used programs for database utility execution, file transfers, job submission, DB2 OLAP Server cube load and precalculation, and more. Users can extend transformation logic providing user defined functions or other executable. Define data movement and warehouse population: Data Warehouse Center supports several styles of data movement: Full table replacement using delete or load replace. Table histories using inserts or load append. Rolling periods (such as a rolling year) that automatically delete the oldest period and insert or append the most recent. Change replication to enable trickle feeding the warehouse for higher concurrency or managing network bandwidth constraints. Change replication leverages IBMs Data Replication technology that provides insert, update, and delete operations. Model, automate, and monitor processes: The following capabilities are supported for handling processes: Processes will be automatically launched at scheduled times. Processes can be triggered externally. If a problem occurs, retries will be executed automatically. Notifications may be sent out.
Publish metadata to Information Catalog Manager: The following capabilities are supported for handling metadata: Publish metadata from Data Warehouse Center to Information Catalog Manager. Manage and interchange metadata, importing metadata from partners tools as Erwin, ETI*Extract, Vality INTEGRITY and also importing and exporting metadata to and from eXtended Markup Language (XML) files that conform to the Common Warehouse Metamodel (CWM) standard defined by Object Management Group (OMG).
15
16
An agent is controlled by the warehouse server (see Figure 1-5). Agents are temporary processes invoked by the warehouse server via an agent daemon running on the appropriate agent site. They can issue a system command or run User Defined Programs, for example: Request data from the source or target data resources Initiate system commands on the agent site machine Run an user-defined program
Control Database
Source DB
Warehouse NT Server
Messages
Agent
Data Flow
Target DB Transformers
The warehouse server also contains a warehouse agent called the local agent, that is defined as the default warehouse agent for all Data Warehouse Center activities. Note: The default warehouse agent is available only on Windows NT/2000. A warehouse agent started from the Data Warehouse Center on another agent site will be called the remote agent. The agent daemon is responsible for starting an agent process on the remote agent sites. It can also forcibly terminate an agent process if the agent ceases to respond to the warehouse server. These are the different agent configurations: Agent, source, and target are located on the same system. Agent and target are located on the same system. Agent and source are located on the same system. Agent, source, and target are located on three different platforms.
17
This last configuration is mentioned here to let you know that it exists and should be used exceptionally (for performances reasons and limitations on options) to source and target HP or LINUX data, for example.
The agent, source, and target are located on the same machine
TCP/IP
In the configuration where the source and target are not in the same database, the agent: Passes SQL statements that extract data from the source tables on the local database Transforms the data if required Writes the data to the target table on the local database
18
Performance is no better here than when everything is on the same platform. However, performance is much better when source and target tables share the same database.
DRDA
Source
TCP/IP
In this configuration, the agent: Passes SQL statements that extract data from the remote source tables Transforms the data if required Writes the data to the target table on the local database This configuration offers the best performance in distributed environment by optimizing the DB2 data flow (DRDA or DB2 private protocols) and using block fetching for the extraction. This is the recommended configuration to use with DB2 Warehouse Manager when source and target are on physically separate machines.
19
eServer:Agent site Agent DRDA DB2 private protocols Source Agent Daemon Target
In this configuration, the agent: Passes SQL statements that extract data from the local source tables. Transforms the data if required. Writes the data to the target table on the remote database. This configuration does not optimize the DB2data flow (DRDA or DB2 private protocols) and should be justified by specific architecture requirements.
20
Oracle
21
RDBMS
Version V6 V7
Client enabler DB-Library and Net-Library V6.0 DB-Library and Net-Library V7.0 Data Warehouse Center ODBC driver manager (Merant) Open Client Library v10.3 and the appropriate Sybase Net-Library Open Client Library v10 for OS/2, Intersolv V3.6 driver manager and Sybase driver Open Client Library v11.01 and the appropriate Sybase Net-Library Intersolv V3.6 Driver Manager and SYBASE driver
Sybase
For Windows NT/2000 For OS/2 For Alpha systems For UNIX
22
AS/400 (iSeries) and OS/390 (zSeries) agents support access to DB2 UDB family databases. The OS/2 agent does not support Microsoft SQL Server, IBM Informix warehouse sources directly. Setting up warehouse sources with Data Warehouse Center is described, step-by-step, in Data Warehouse Center Administration Guide, SC26-9993.
Prerequisites
The Web Connector supports Windows NT or 2000, AIX or SUN Solaris. It is installed on the same machine as the warehouse agent. Prerequisites before installing the Web Connector are: DB2 Warehouse Manager V7.2 product WebSphere Site Analyzer V4.0 package containing: Site Analyzer V4.0 DB2 UDB V7.2 WebSphere Application Server Advanced Edition V3.5.4
23
WebSphere Site Analyzer V4.0 (WSA) is a Web-based client-server system that: Captures raw data from different types of servers (raw data sources, also called Data Imports) as server logs: HTTP servers FTP servers WebSphere Edge Server WebSphere Portal Server WebSphere Application Server WebSphere Commerce Server WebSphere Personalization Server
Data is also captured as real time data or single pixel data capture feature through the browser (called Web Tracker). Does processing of Data Imports and populates an externalized Webmart star schema database stored in DB2 UDB or Oracle. Generates reports. WSA InfoCenter provides additional documentation on tuning and setup for WSA. WSA can be set up easily, the creation and launching of Web application servers being done automatically by the product install.
DB2 DB
24
In WSA:
Define a project Define a Data Import
WSA WebMart
WebSphere Site Analyzer
Agent
Status = done
DWC SQL step
Warehouse Target
Detailed information on integrating WSA and Data Warehouse Center and hints and tips to start implementing the Web Connector are described in Appendix A, Using DB2 Warehouse Manager Connector for the Web on page 313.
25
Prerequisites
The SAP R/3 Connector supports only Windows NT and 2000 and can access any SAP R/3 server platforms. It is installed on the same machine as the warehouse agent. Prerequisites before installing the SAP R/3 Connector are: DB2 Warehouse Manager V7.2 product SAP R/3 Release 4.6C with an English language option installed RFC Runtime module (LIBRFC32.DLL) from the presentation CD-ROM, SAP Release 4.6D Compilation 4 included with the SAP clients Optionally install SAPGUI for troubleshooting
GetList is used to search for object instances that fulfill a certain selection criteria and returns a list of object key fields GetDetail obtains more information about a specific instance identified in the object key field
26
Integration between SAP R/3 and DB2 Warehouse Manager is shown in Figure 1-9.
SAP R/3
BOR
DB2 DB
These are the main implementation steps, in Data Warehouse Center: Define SAP as a new warehouse source: Specify the right type of connection Select SAP R/3 Business Objects Define properties of Business Objects by selecting and mapping its metadata (parameters) Define the SAP R/3 process using Data Warehouse Center process model: Select Business Object input parameters Select output parameters to be mapped to columns Run the step using the Data Warehouse Center Work In Progress panel. Detailed information on integrating SAP R/3 Servers and Data Warehouse Center and hints and tips to start implementing the SAP Connector are described in Appendix B, Using DB2 Warehouse Manager Connector for SAP on page 331.
27
OLE DB access: DB2 Warehouse Manager can access an OLE DB source from a view of such table function and allows the user to invoke the OLE DB Assist wizard to create the necessary table function and view. The view definition is then imported into DB2 Warehouse Manager to create a warehouse source view. The view can be used as any other DB2 UDB view. The OLE DB support is Windows only. WebSphere MQ integration: DB2 UDB V7.2 marries the cross platform integration strengths of WebSphere MQ with the rich function of SQL for building near real time data warehouses. A set of MQSeries functions are provided with DB2 UDB V7.2 to allow SQL statement to include messaging operations. This support is available to applications written in any supported language for example C, Java, SQL (stored procedures) using any of the database interfaces.
These functions are used within DB2 Warehouse Manager to read data from message queues. DB2 Warehouse Manager provides an MQ Assist Wizard which makes it relatively easy for the user to define the queues as sources. The user invokes the MQ-Assist wizard to: Define the format of the MQSeries messages as fixed or delimited strings Create a table function to expose the MQSeries queue as a table Create a view for this table function The view definition is imported into the Data Warehouse Center (see Figure 1-12) and the new warehouse view source then can be accessed and manipulated with Data Warehouse Center as any other warehouse source. This requires DB2 UDB 7.2 Server to be on the same system as the warehouse agent and WebSphere MQ V5.2.
28
Message queues can also be populated from XML documents. DB2 Warehouse Manager reads the XML data from MQSeries using UDFs and stored procedures provided and populates tables in a warehouse target using DB2 XML Extender functions. Examples of WebSphere MQ integration with DB2 Warehouse Manager are also provided in the redbook Building the Operational Data Store on DB2 UDB, SG24-6413.
Cleansing integration with Trillium Batch System (TBS): Trillium Software System (TSS) is a name and address cleansing product which reformats, standardizes, and verifies address data to produce usable information.
TSS V4 consists of 4 components: Converter Parser Geocoder Matcher
The components can be invoked by set of executables (the Trillium Batch System) and the user writes a command file which calls these executables to execute a name and address cleansing task. DB2 Warehouse Manager provides: The Import Metadata dialog to import the metadata of the TBS command file and create the Trillium User Defined Program (UDP) step The Trillium UDP to execute the TBS command file The import metadata dialog for TBS will create the following Data Warehouse Center objects: Warehouse source Warehouse target TBS User Defined Program (UDP) step in a subject area and process When invoked, the step will execute the TBS command file.The command file can either be local or remote.
QMF for Windows: QMF for Windows provides a tightly integrated, powerful, reliable, scalable query and reporting tool set for IBM's DB2 Family of database systems. QMF is positioned in the easy-to-use query and report writing space for advanced users with some knowledge of data structures, providing as output, charts, reports and applications that may be accessed in client/server mode or using the Web.
29
Query Patroller: Query Patroller is the tool to manage the query workload by tracking resource usage.
Query Patroller allows the database administrator to: Govern queries and trap all dynamic queries Analyze costs Manage resources that means limit workload by server or node and balance workload across node or server clusters Track and report usage Retry automatically the in-progress queries after the DB2 UDB warehouse target is restarted following a failure Query Patroller allows the end-users to: Schedule and prioritize queries for asynchronous execution Save results for later use Reuse result sets from previous queries
30
Chapter 2.
31
We will take each of these in turn. Assume a scenario, which is reasonably typical: The source data is on a remote server (for example, on iSeries, zSeries) The target warehouse database is on a UNIX system. The warehouse server and its warehouse control database is on a Windows 2000 system. In this situation it is highly likely that the data access will be performed by distributed SQL access, and for best performance, we would install a warehouse agent on the UNIX box, accessing the AS/400 or iSeries by a DB2 DRDA mechanism. The warehouse server will issue requests to the agent sitting on the UNIX box which in turn will place an SQL request against the AS/400 (iSeries). So this is just like an application running on the UNIX machine accessing the AS/400 (iSeries) by distributed SQL.
32
33
In this case the data updates would have been committed permanently but because a time-out was received from the agent connection, the warehouse server would believe the step did not complete. Since it would not appear to complete the assumption has to be made that the step did not run and therefore that the updates were not applied. This means that a network failure would appear to be potentially the most problematic when deciding whether to restart work or not. To be on the safe side, every time there has been a failure due to a communication error, the safest action should be to check what data has been committed to the database and take the appropriate action. Log messages give the details of what communications and commands transpired between the server and the agent. Log messages should be checked to see if the server had sent a commit/rollback before the failure occurred.
34
What is important is to understand what to do to recover the situation, how to understand what the latest status of the target database(s) is and which processes and steps have to be re-run (if any). Let us consider several situations:
35
Disks are available as RAID arrays. This can help keep the disk subsystem on-line and allow hot swapping of the faulty device(s) at the convenience of the support staff. Server systems can be configured in such a way as to be able to take over devices belonging to another server. Let us return to the issue of whether to use circular logging or logging which allows roll forward recovery. If you are reading this book, then you are most likely interested in providing a DB2 Warehouse Manager environment that provides a reasonably high service level and one where relatively High Availability of the latest data is important. In this case, our recommendation would be to set up the warehouse control database with roll forward recovery enabled. This means that special measures will need to be taken to archive the logs to a suitable place and to make sure that those logs will be available in a timely way should recovery be required. This is a standard DB2 planning and administrative activity. Once roll forward recovery is enabled, an operations or administration person can restore the database from a backup and also apply all the logs to a point in time thereby ensuring that warehouse control database is restored to its latest possible status. Without roll forward recovery (or in other words with circular logging) the warehouse control database can be restored to the status it had at the last backup. This means that information about the work in progress and related information updated since the last backup would be lost.
36
The operating system on which the agent is running may perform some strange behavior, causing unpredictable actions. It is highly unlikely, but possible, that the operating system on which the agent is running may perform strange behavior, thus causing unpredictable actions. The most likely consequence of this will be some kind or error reported to the server or a time-out reported at the server for that agent. In all cases, the server will assume that the step did not complete, and it is fair to say it is unlikely that the step did actually complete on that failed system.
2.6 Recommendations
When starting to plan and design your warehouse system, these are the main recommendations Take time to brainstorm a list of possible failure scenarios. Agree upon their degree of criticality to your environment, and then decide which scenarios must be accommodated in your system. Document what action should be taken for each of the important scenarios, should they occur. These considerations will be important for the operations staff of the warehouse. Chapter 6, Problem determination methodology on page 229, which covers problem determination in a DB2 Warehouse Manager environment, would help you understand what failure scenario has occurred.
37
38
Chapter 3.
39
3.1 Overview
A database can become unusable because of hardware or software failure, or both. You may, at one time or another, encounter storage problems, power interruptions, and application failures, and different failure scenarios require different recovery actions. You can protect your data against the possibility of loss by having a well rehearsed recovery strategy in place. DB2 UDB provides a range of facilities for backing up, restoring, and rolling data forward, which enable one to build a recovery procedure. Good warehousing practice covers reliability of the target databases together with the warehouse control databases. Just protecting the target databases is not enough if you wish to keep an operational service running satisfactorily. Similarly just maintaining backup of the warehouse metadata helps your IT staff but doesn't satisfy the users who need the data from the target database Some of the questions that you should answer when developing your recovery strategy are: Will the database be recoverable? How much time can be spent recovering the database? How much time will pass between backup operations? How much storage space can be allocated for backup copies and archived logs? Will tablespace level backups be sufficient, or will full database backups be necessary? Your database recovery strategy should ensure that all information is available when it is required for database recovery. You should include a regular schedule for taking database backups. You should also include in your overall strategy procedures for recovering command scripts, applications, user-defined functions (UDFs), stored procedure code in operating system libraries, and load copies. The concept of a database backup is the same as any other data backup: taking a copy of the data and then storing it on a different medium in case of failure or damage to the original. The simplest case of a backup involves shutting down the database to ensure that no further transactions occur, and then simply backing it up. You can then rebuild the database if it becomes damaged or corrupted in some way. The rebuilding of the database is called recovery. Different recovery methods are discussed to fit with your data warehouse business requirements.
40
41
Even if you can perform backups while the database is operational, you need to ensure that any load on processors or networks caused by the backup process does not result in performance or response degradation that is unacceptable to your users.
42
The key point is that your backup and recovery strategy must take into account the needs of the applications that use the data.
43
If you must move tables from one operating system to another, you can use the db2move command, or the export utility followed by the import or the load utility. For more information about these utilities, see the Section 3.8, Useful data movement tools on page 88.
Crash recovery
Crash recovery is the automatic recovery of the database if a failure occurs before all of the changes that are part of one or more units of work (transactions) are completed and committed.
44
DB2 UDB will automatically roll back incomplete transactions and complete committed transactions that were in memory when the crash occurred. If a failure occurs before all of the changes that are part of the unit of work are completed and committed, the database is left in an inconsistent and unusable state. Crash recovery is the process by which the database is moved back to a consistent and usable state. This is managed by the DB2 UDB database manager itself. If you want the rollback of incomplete units of work to be done automatically by the database manager, you want to enable the automatic restart (AUTORESTART) database configuration parameter by setting it to ON. (This is the default value.) The first connection to the database after the crash will cause the database to be restarted or placed into a consistent status. If the AUTORESTART parameter is set to OFF, you must manually execute the restart database command. Figure 3-1 shows the effect of a power failure.
R E S TA R T D B U N IT S O F W O R K D C B A RO LLBACK RO LLBACK
CRASH T IM E
At the time of the crash, units of work in application A and C were in progress but not yet committed. The units of work in application B and D had already been committed. The changes made by application D had been committed but the modified data pages had not been permanently written to the database on disk. When the database is restarted, application D's changes are written on disk and the units of work in application A and C are rolled back. After these events are completed, the database is placed into a consistent state.
45
When DB2 UDB is restarted, you can check the status in the database configuration file.
Attention: The database configuration file would only be useful to check when the database is shutdown. As soon as an application connects to the database, the database is marked as inconsistent and when the database shuts down properly, the database is marked consistent.
Figure 3-2 shows the status of the TBC_MD database.
You can display this screen by selecting Configure...>Status against the TBC_MD database in the Control Center.
46
Restore recovery
Sometimes this method of recovery is called a version recovery. Restore recovery is the restoration of a previous version of the database, using an image that was created during a backup operation at an earlier time. You use this recovery method with databases for which you do not have archived logs. You can also use this method with recoverable databases by using the WITHOUT ROLLING FORWARD option on the restore database command. A database restore operation rebuilds the entire database using a backup image created earlier. A database backup allows you to restore a database to a state identical to the one at the time that the backup was made. All the modifications made in the database after the time of the backup are lost. Figure 3-3 shows an example of restore recovery. A database backup was taken at time t1. Between t1 and t3, some database tables were loaded in the tablespace TBSP1. Just before time t3, the tablespace TBSP1 is dropped by mistake. To recover the tables in TBSP1 at the time of t1, the BCK1 backup could be restored.
t1
time
BCK1
RST1
RESTORE DATABASE
Figure 3-3 Restore recovery
Using the restore recovery method, you must schedule and perform full backups of the database on a regular basis.
47
The restore only method involves making an offline, full database backup copy at scheduled times. With this method, the restored database is only as current as the time that the last backup was made. For instance, if you make a backup copy at the end of each day and you lose the database midway through the next day, you will lose a half-day's worth of changes. The default values of the relevant database configuration parameters are set to use this method of recover: logretain=NO and userexit=NO. A full database backup involves making copies of: User tables used to hold user data System catalog tables used by DB2 UDB Any control files and parameter files that DB2 UDB uses DB2 UDB allows you to perform full database backup when the database is either online or offline. An offline backup is performed when the only process connected to the database is the backup process itself. Offline backup involves shutting the database down before you start the backup and restarting the database after backup is complete.Offline backups are relatively simple to administer. You need to schedule sufficient time to perform the backup to ensure that the periods when the database will be unavailable are acceptable to your users. The simplest approach to database backup is to perform only full, offline backups at regular intervals. This approach is relatively easy to administer, and recovery is relatively straightforward.
Rollforward recovery
Rollforward recovery is the reapplication of transactions recorded in the database log files after a database or a tablespace backup image has been restored. If you cannot afford to risk losing changes made after a database backup, you should plan to use rollforward recovery. To use the rollforward recovery method, you must have taken a backup of the database, and archived the logs by enabling either the logretain or the userexit database configuration parameters, or both.
In the rollforward recovery method, changes made to the database are retained in logs. With this method, you first restore the database or the tablespaces using a backup copy. Then you use the logs to reapply changes that were made to the database since the backup copy was created. There are two types of rollforward recovery to consider:
48
Database rollforward recovery: In this type of rollforward recovery, transactions recorded in database logs are applied following the database restore operation. The database logs record all changes made to the database. This method completes the recovery of the database to its state at a particular point-in-time, or to its state immediately before the failure (that is, to the end of the active logs.) Tablespace rollforward recovery: If the database is enabled for forward recovery, it is also possible to back up, restore, and roll tablespaces forward. To perform a tablespace restore and rollforward operation, you need a backup image of either the entire database (that is, all of the tablespaces), or one or more individual tablespaces. You also need the log records that affect the tablespaces that are to be recovered.
You can roll forward through the logs to one of two points: The end of the logs (called full recovery) or A particular point-in-time (called point-in-time recovery) You can make a tablespace rollforward recovery in the following two situations: After a tablespace restore operation, the tablespace is always in rollforward pending state, and it must be rolled forward. You need to invoke the rollforward database command to apply the logs against the tablespaces to either a point-in-time, or to the end of the logs. If one or more tablespaces are in rollforward pending state after crash recovery, you should correct the tablespace problem first. In some cases, correcting the tablespace problem does not involve a restore database operation. For example, a power loss could leave the tablespace in rollforward pending state. In this case you do not have to do a restore database operation. Once the problem with the tablespace is corrected, you can use the rollforward database command to apply the logs against the tablespaces to the end of the logs. If the problem is corrected before crash recovery, crash recovery may be sufficient to take the database to a consistent, usable state.
Note: If the tablespace in error contains the system catalog tables, you will not be able to start the database. You must restore the SYSCATSPACE tablespace, then perform rollforward recovery to the end of the logs.
Figure 3-4 shows an example of rollforward recovery. We can restore the tablespace TBSP1 and all the changes made to the database since the backup BCK1 by first restoring the BCK1 and then performing a rollforward to a point-in-time just before the drop tablespace command was issued.
49
D R O P TA B L E S P A C E T B S P 1 U N IT S O F W O R K
t2 t3
t1
t im e
BCK1
RST1
1.
RESTO RE D ATABASE
2.
R O LLFO RW A R D D A TA B A S E
With rollforward recovery enabled by setting the logretain=RECOVERY and/or userexit=YES, you can take advantage of online backup and tablespace level backup. When performing an online backup, other applications can be connected to the database. For full database rollforward recovery, you can choose to recover to the end of the logs or to a specified point-in-time. Clearly, if a database is being backed up while users are updating it, it is likely that the data backed up will be inconsistent. DB2 UDB uses log files during the recovery process to recover the database to a fully consistent state. This approach requires that you retain DB2 UDB log files and indicate to DB2 UDB when you are about to start the backup and when you have completed the backup. To perform a point-in-time recovery, you must specify the time in Coordinated Universal Time (CUT). The format is yyyy-mm-dd-hh.mm.ss.nnnnnn. The time stamp used on the backup is based on the local time that the backup started.
Note: The special register, CURRENT TIMEZONE, holds the difference between CUT and the local time. Local time is the CUT plus the value of CURRENT TIMEZONE.
50
DB2 UDB allows you to quiesce activity on portions of the database (for example, a particular tablespace) so that a set of complete tables is temporarily frozen in a consistent state. You then can back up the set of tables that has been frozen. Once the backup has completed, you can reactivate the tablespace. Make sure that the subset you back up (as part of a partial backup) represents a complete logical unit of recovery from the point of view of the application. You may also need to back up data files that DB2 UDB does not manage. You must also ensure that the unit of recovery is consistent from the point of view of DB2 UDB. If you have added a new data file to a tablespace, you must ensure that any control file that DB2 UDB uses to define the relationship between data files and tablespaces is also backed up
Incremental backup
DB2 UDB provides backup facilities for data that has changed since the last offline or online database backup. This will save tape or disk space but may or may not reduce the time to do a backup, because the DB2 UDB still needs to read the data blocks to determine if it they have changed since the last backup. When recovery is needed, the database backup and incremental backups are both required to fully recover the database. This can take more time to recover a database. Figure 3-5 illustrates two examples of incremental backup.
Sunday
Mon.
Tue.
Wed
Th.
Fri.
Sat
Sunday
Full
Full
Cumulative Backups
Full
Delta Backups
Full
51
In the first example, only cumulative backups (or incremental backups) are taken. Each consecutive cumulative backup will grow as it contains all of the changes since the last full backup. However in the case of a recovery, it will be faster because only the last full backup and most recent cumulative backup image would be necessary. In the second example, only delta backups are taken. Each consecutive delta backup will only contain the changes since the last delta backup. In this way, you can reduce the size of each delta backup in comparison to the previous example. However it will be slower for you to recover because, in addition to the last full backup, you would need all delta backups up to the failing point. Incremental backups are useful when saving space or when saving bandwidth when backing up over the network.
Circular logging
Circular logging is the default behavior when a new database is created. (The logretain database configuration parameter setting is NO.) With this type of logging, only full, offline backups of the database are valid.
As the name suggests, circular logging uses a ring of online logs to provide recovery from transaction failures and system crashes. The logs are used in a round-robin fashion and retained only to the point of ensuring the integrity of current transactions. Circular logging does not allow you to roll a database forward through transactions performed after the last full backup operation. All changes occurring since the last backup operation are lost. Only the crash recovery and restore recovery can be performed when this type of logging.
52
Active logs are used during crash recovery to prevent a failure (system power or application error) from leaving a database in an inconsistent state.
The data changes are recorded in the log files and when all the units of work are committed or rolled back in a particular log file, the file can be reused. The number of log files used by circular logging is defined by the logprimary and logsecondary database configuration parameters. If there are UOWs running in a database using all the primary log files and still not reaching a point of consistency, then a secondary log files are allocated one at a time. Figure 3-6 shows how log files are used in circular logging.
DB2 server
Transaction
Circular Logs
Archive logging
Archive logging is used specifically for rollforward recovery. You can configure this logging mode by setting the logretain database configuration parameter to RECOVERY.
Rollforward recovery can use both archived logs and active logs to rebuild a database or a tablespace either to the end of the logs, or to a specific point-in-time. The rollforward utility achieves this by reapplying committed changes found in the following three types of log files:
53
Active logs: Crash recovery also manipulates active logs, which uses them to place the database into a consistent state. They contain transaction records that have not been committed and also the committed transaction information that has not been written to the database on disk. You can locate active log files in the LOGPATH directory. Online archived logs: When changes in the active log are no longer needed for normal processing, the log is closed, and becomes an archived log. An archived log is said to be online when it is stored in the database log path directory (see Figure 3-7).
DB2 server
Transaction
Online Archived
Log Files
Log Retain
Offline archived logs: An archived log is said to be offline when it is no longer found in the database log path directory. When you want to use archive logging (see Figure 3-8) you must make provision for the logs to be stored away from the database. This is done in DB2 UDB by specifying a userexit parameter and interfacing to a suitable archive manager. Full documentation of this is supplied in the DB2 manuals.
54
DB2 server
Transaction
Offline Archived
User Exit
Log Files
Capture logging
Capture logging is used for replication processing. Log files are retained until replication processing has completed, at which time they are deleted automatically.Capture logging can be configured by setting the logretain database configuration parameter to CAPTURE. All DB2 UDB utilities handle this logging mode in the same way as they handle circular logging. Neither online backup operations, nor tablespace backup and restore operations, nor rollforward operations are allowed.
This is unlikely to be used in a warehousing environment that uses DB2 Warehouse Manager.
55
As shown in Figure 3-9, you can use the Control Center. Click Configure... database option to display the Logs page.
56
logprimary
The number of primary logs that will be created. A primary log, whether empty or full, requires the same amount of disk space. Thus, if you configure more logs than you need, you use disk space unnecessarily. If you configure too few logs, you can encounter a log-full condition. As you select the number of logs to configure, you must consider the size you make each log and whether your application can handle a log-full condition. If you are enabling an existing database for rollforward recovery, change the number of primary logs to the sum of the number of primary and secondary logs, plus 1. Additional information is logged for LONG VARCHAR and LOB fields in a database enabled for rollforward recovery. The total log file size limit is 32 GB. That is, the number of log files (logprimary + logsecond) multiplied by the size of each log file, in bytes (logfilsiz * 4096) must be less than 32 GB.
logsecond
The number of secondary log files that are created and used for recovery, if needed. If the primary log files become full, secondary log files (of size logfilsiz) are allocated, one at a time as needed, up to the maximum number specified by this parameter. An error is returned, and activity against the database is stopped, if more than the configured number of secondary log files is required.
logfilsiz
The size of each configured log, in number of 4-KB pages. The size of the log file has a direct bearing on performance. If the database is configured to retain logs, each time a log is filled, a request is issued for allocation and initialization of a new log. Increasing the size of the log reduces the number of requests required to allocate and initialize new logs. (Keep in mind, however, that with a larger log size it takes more time to format each new log). logbufsz The amount of database shared memory to use as a buffer for log records before writing these records to disk. The log records are written to disk when any one of the following events occurs: A transaction commits The log buffer becomes full Some other internal database manager event occurs.
57
Increasing the log buffer size results in more efficient input/output (I/O) activity associated with logging, because the log records are written to disk less frequently, and more records are written each time.
newlogpath
The database logs are initially created in SQLOGDIR, which is a subdirectory of the database directory. You can change the location in which active logs and future archive logs are placed by changing the value of this configuration parameter to point to a different directory or to a device. Archive logs that are currently stored in the database log path directory are not moved to the new location if the database is configured for rollforward recovery.
logretain
If logretain is set to RECOVERY, archived logs are kept in the database log path directory, and the database is considered to be recoverable, meaning that rollforward recovery is enabled. If logretain is set to CAPTURE, the replication capture program calls the prune logfile command to delete log files when the capture program completes. You should not set logretain to CAPTURE if you want to perform rollforward recovery on the database.
userexit
With this parameter set to YES, rollforward recovery is enabled causing the database manager to call a user exit program for archiving and retrieving logs. The log files are archived in a location that is different from the active log path. The parameters described above can be updated using the Control Center. The same task can be performed from a Command Window or Command Center by using the DB2 UDB command: UPDATE DATABASE CONFIGURATION FOR db USING parameter Table 3-1 summarizes the relationship between the values of the logretain and userexit parameters, the mode of database logging, the type of backup that you can choose, and the mode of rollforward.
58
No Recovery
No No
Circular Archive
Database offline Database or Tablespace online or offline Database or Tablespace online or offline Database or Tablespace online or offline
Default Log files stored in SQLOGDIR Log files in SQLOGDIR erased by userexit Log files in SQLOGDIR erased by userexit
No
Yes
Archive
Recovery
Yes
Archive
59
An option on the restore command allows only the recovery history file to be restored. This is useful in recovery situations where the current database is unusable or not available, and the associated recovery history file is damaged or deleted. You can then review the recovery history file to determine which backup to use to restore the database. The recovery history file contains the summarized backup information that you can use to recover all or part of the database to a given point-in-time. The information in the file includes: An identification (ID) field to uniquely identify each entry The part of the database that was copied, and how it was copied The time the copy was made The location of the copy (stating both the device information and the logical way to access the copy) The last time a restore operation was done The time at which a tablespace was renamed, showing the previous and the current name of the tablespace The status of a backup operation: active, inactive, expired, or deleted The last log sequence number saved by the database backup or processed during a rollforward recovery operation. To see the entries in the recovery history file, use the db2 list history command.
60
history containing schema1.table1 for db1 backup containing schema1.table1 for db1 history since 20011122 for db1 backup since 20011122 for db1 history all for db1 backup all for db1
To access the recovery history file from the Control Center, select Journal and then the History tab.
The default retention period for the history file is 366 days, but this may be overridden by using the database configuration parameter rec_his_retentn. The maximum value is 30000.
61
You can also manually remove old entries from the file by using the prune history command. A minimum yyyy may be specified as the timestamp. All entries with timestamps equal to or less than the timestamp provided are deleted from the recovery history file. The WITH FORCE OPTION specifies that the entries will be pruned according to the timestamp provided, even if some entries from the most recent restore set are deleted from the file. Some examples are: db2 prune history 20011122100922 db2 prune history 20011122 with force option
Tablespace state
In a typical recovery situation, it is very important for you to understand the current status of a tablespace indicated by its state. The tablespace states most commonly associated with recovery are:
Rollforward pending: A tablespace is put in this state after it is restored, or following an input/output (I/O) error. After it is restored, the tablespace can be rolled forward to the end of the logs or to a point-in-time. Following an I/O error, the tablespace must be rolled forward to the end of the logs or to a point in time. Rollforward-in-progress: A tablespace is put in this state when a rollforward operation on that tablespace is in progress. Once the rollforward operation completes successfully, the tablespace is no longer in rollforward-inprogress state. The tablespace can also be taken out of this state if the rollforward operation is cancelled. Restore pending: A tablespace is put in this state if a rollforward operation on that tablespace is cancelled, or if a rollforward operation on that tablespace encounters an unrecoverable error, in which case the tablespace must be restored and rolled forward again. Backup pending: A tablespace is put in this state after a point-in-time rollforward operation, or after a load operation with the no copy option. The tablespace must be backed up before it can be used. If it is not backed up, the tablespace cannot be updated, but read only operations are allowed.
62
A site to be used in the event of an emergency A different machine on which to recover the database Off-site storage of database backups and archived logs. If your plan for disaster recovery is to recover the entire database on another machine, you need to have at least one full database backup and all the archived logs for the database. This means that you must make provision for ensuring the database backups and the archived logs are moved (either electronically or using removable media) away from the site. This is covered a little further in 3.9, Disaster recovery on page 92.
63
12,615,680
Backup images are created at the target location that you have the option to specify when you invoke the backup utility. This location can be: A directory (for backups to disk or diskette) A device (for backups to tape) A Tivoli Storage Manager (TSM) server (see 4.3.5, Tivoli Storage Manager on page 138) Another vendors server Specified through a user exit program (OS/2 only). On UNIX based systems, file names for backup images created on disk consist of a concatenation of several elements, separated by periods: DB_alias.Type.Inst_name.NODEnnnn.CATNnnnn.timestamp.Seq_num For example: STAFF.0.DB201.NODE0000.CATN0000.19950922120112.001 On other platforms, a four-level subdirectory tree is used: DB_alias.Type\Inst_name.NODEnnnn\CATNnnnn\yyyymmdd\hhmmss.Seq_num For example, on Windows NT/2000: TBC_MD.0\DB2\NODE0000\CATN0000\20010320\122644.001
DB_alias Type
A 1- to 8-character database alias name that was specified when the backup utility was invoked. Type of backup operation, where: 0 represents a full database-level backup, 3 represents a tablespace-level backup, and 4 represents a backup image generated by the load...copy to command. A 1- to 8-character name of the current instance that is taken from the DB2INSTANCE environment variable. The node number. In non-partitioned database systems, this is always NODE0000.In partitioned database systems, it is NODExxxx, where xxxx is the number assigned to the node in the db2nodes.cfg file.
Inst_name NODEnnnn
64
CATNnnnn
The node number of the catalog node for the database. In non-partitioned database systems, this is always CATN0000. In partitioned database systems, it is CATNxxxx, where xxxx is the number assigned to the node in the db2nodes.cfg file. A 14-character representation of the date and time (timestamp) at which the backup operation was performed. The time stamp is in the form yyyymmddhhnnss, where:
Time stamp
yyyy represents the year (1995 to 9999) mm represents the month (01 to 12) dd represents the day of the month (01 to 31) hh represents the hour (00 to 23) nn represents the minutes (00 to 59) ss represents the seconds (00 to 59)
Seq_num
Before using backup, you should not be connected to the database that is to be backed up: the backup utility automatically establishes a connection to the specified database, and this connection is terminated at the completion of the backup operation. The database can be local or remote. The backup image remains on the database server, unless you are using a storage management product such as Tivoli Storage Manager (TSM).
65
To open the Backup Database notebook or wizard: 1. From the Control Center, expand the object tree until you find the Databases folder. 2. Click the Databases folder. Any existing databases are displayed in the pane on the right side of the window (the contents pane). 3. Right-click the database you want in the contents pane, and select Backup >Database... or Backup> Database Using Wizard from the pop-up menu. The Backup Database notebook or the Backup Database wizard opens.
66
One way to overcome this problem is to use a dedicated LAN for backup so that the data transfer will no longer interfere with the work of other users and applications. However, even when using a dedicated LAN, all the data and metadata (file permissions, owner, and so on) must still be handled by the application that will receive the backup data. This application will need resources such as CPU, memory, or disk space to buffer and manage data and metadata. To free the application from the work needed for handling the backup data itself, a LAN-free solution can be used. LAN-free means that a group of machines are able to share the same storage devices over a high performance connection. A LAN-free solution also provides an easy way of defining storage devices to machines without much cabling effort, as the devices all communicate over the same high performance connection.
3. If this backup image is going to be used by the restore utility, the restore operation must be invoked before the backup operation, so that it will not miss any data:
db2 restore db TBC_MD into mynewdb from /u/dmcinnis/mypipe
67
68
The ideal backup buffer size is a multiple of the tablespace extent size. If you have multiple tablespaces with different extent sizes, specify a value that is a multiple of the largest extent size. Increase the number of buffers (WITH num-buff BUFFERS) If you use multiple buffers and I/O channels, you should use at least twice as many buffers as channels to ensure that the channels do not have to wait for data. The numbers of buffers should be: #sessions + #parallelism +2. Also, the following calculation must fit: (num-buffers * buffer-size) < UTIL_HEAP_SZ (UTIL_HEAP_SZ is the database utility heap size).
69
If you specify y, and a backup image for the TBC_MD database exists, the restore operation should complete successfully. No applications can be running against the database when the operation starts, and the restore utility prevents other applications from accessing the database until the restore operation completes successfully. A tablespace restore operation, however, can be done online. A tablespace is not usable until the restore operation (followed by rollforward recovery) completes successfully. If you have tables that span more than one tablespace, you should back up and restore the set of tablespaces together. When doing a partial or subset restore operation, you can use either a tablespace-level backup image, or a full database-level backup image and choose one or more tablespaces from that image. You need to make available all the log files associated with these tablespaces from the time that the backup image. You should not be connected to the database that is to be restored when restoring to an existing database. The restore utility automatically establishes a connection to the specified database, and this connection is terminated at the completion of the restore operation.
70
When restoring to a new database, an instance attachment is required to create the database. When restoring to a new remote database, you must first attach to the instance where the new database will reside. Then, create the new database, specifying the code page and the territory of the server. The database can be local or remote.
71
72
For a successful restore operation in this case, you need to redirect the data restoration to different containers. DB2 UDB supports adding, changing, or removing tablespace containers. You can redefine tablespace containers by invoking the restore database command and specifying the REDIRECT parameter, or by using the Containers page of the Restore Database notebook in the Control Center (Figure 3-14).
Following is a typical redirected restore scenario for a database whose alias is MYDB: 1. Issue a RESTORE DATABASE command with the REDIRECT option. db2 restore db mydb replace existing redirect After successful completion of step 1, and before completing step 3, the restore operation can be aborted by issuing: db2 restore db mydb abort
73
2. Issue a SET TABLESPACE CONTAINERS command for each tablespace whose containers must be redefined. For example: db2 set tablespace containers for 5 using (file 'f:\ts3con1'20000,file 'f:\ts3con2'20000) To verify that the containers of the restored database are the ones specified in this step, issue the LIST TABLESPACE CONTAINERS command. 3. After successful completion of steps 1 and 2, issue: db2 restore db mydb continue This is the final step of the redirected restore operation. 4. If step 3 fails, or if the restore operation has been aborted, the redirected restore can be restarted, beginning at step 1. During a redirected restore operation, directory and file containers are automatically created if they do not already exist. The database manager does not automatically create device containers. Container redirection provides considerable flexibility for managing tablespace containers. For example, even though adding containers to SMS tablespaces is not supported, you could accomplish this by specifying an additional container when invoking a redirected restore operation. Similarly, you could move a DMS tablespace from file containers to device containers.
74
Retains the database directories for the existing database. The directories define where the database resides, and how it is cataloged. Compares the database seeds. If the seeds are different, the restore utility: Deletes the logs associated with the existing database. Copies the database configuration file from the backup image. Sets NEWLOGPATH to the value of the logpath database configuration parameter if NEWLOGPATH was specified on the restore database command. If the database seeds are the same, the restore utility: Deletes the logs if the image is for a non-recoverable database. Retains the current database configuration file, unless the file has been corrupted, in which case the file is copied from the backup image. Sets NEWLOGPATH to the value of the logpath database configuration parameter if NEWLOGPATH was specified on the RESTORE DATABASE command; otherwise, copies the current log path to the database configuration file. Validates the log path: If the path cannot be used by the database, changes the database configuration to use the default log path.
75
76
77
The general approach to rollforward recovery involves: 1. Invoking the rollforward utility without the STOP or COMPLETE option 2. Invoking the rollforward utility with the QUERY STATUS option If you specify recovery to the end of the logs, the QUERY STATUS option can indicate that one or more log files is missing, if the returned point in time is earlier than you expect. If you specify point-in-time recovery, the QUERY STATUS option will help you to ensure that the rollforward operation has completed at the correct point. 3. Invoking the rollforward utility with the STOP option. After the operation stops, it is not possible to roll additional changes forward. A database must be restored successfully (using the restore utility) before it can be rolled forward, but a tablespace does not. A tablespace may be temporarily put in rollforward pending state, but not require a restore operation to undo it (following a power interruption, for example). When the rollforward utility is invoked: If the database is in rollforward pending state, the database is rolled forward. If tablespaces are also in rollforward pending state, you must invoke the rollforward utility again after the database rollforward operation completes to roll the tablespaces forward. If the database is not in rollforward pending state, but tablespaces in the database are in rollforward pending state: If you specify a list of tablespaces, only those tablespaces are rolled forward. If you do not specify a list of tablespaces, all tablespaces that are in rollforward pending state are rolled forward.
78
A database rollforward operation runs offline. The database is not available for use until the rollforward operation completes successfully, and the operation cannot complete unless the STOP option was specified when the utility was invoked. A tablespace rollforward operation can run offline. The database is not available for use until the rollforward operation completes successfully. This occurs if the end of the logs is reached, or if the STOP option was specified when the utility was invoked. You can perform an online rollforward operation on tablespaces, as long as SYSCATSPACE is not included. When you perform an online rollforward operation on a tablespace, the tablespace is not available for use, but the other tablespaces in the database are available. When you first create a database, it is enabled for circular logging only. This means that logs are reused, rather than being saved or archived. With circular logging, rollforward recovery is not possible: only crash recovery or version recovery can be done. Archived logs document changes to a database that occur after a backup was taken. You enable log archiving (and rollforward recovery) by setting the logretain database configuration parameter to RECOVERY, or setting the userexit database configuration parameter to YES, or both. The default value for both of these parameters is NO, because initially, there is no backup image that you can use to recover the database. When you change the value of one or both of these parameters, the database is put into backup pending state, and you must take an offline backup of the database before it can be used again. The rollforward utility automatically establishes a connection to the specified database, and this connection is terminated at the completion of the rollforward operation. The database can be local or remote.
79
The Rollforward Database notebook in the Control Center. To open the Rollforward Database notebook: a. From the Control Center, expand the object tree until you find the Databases folder. b. Click on the Databases folder. Any existing databases are displayed in the pane on the right side of the window (the contents pane). c. Right-click the database you want in the contents pane, and select Roll-forward from the pop-up menu. The Rollforward Database notebook opens.
Case 1:
The rollforward database command permits specification of multiple operations at once, each being separated with the keyword AND. For example, to roll forward to the end of logs, and complete, the separate commands: db2 rollforward db TBC_MD to end of logs db2 rollforward db TBC_MD complete can be combined as follows: db2 rollforward db TBC_MD to end of logs and complete Although the two are equivalent, it is recommended that such operations be done in two steps. It is important to verify that the rollforward operation has progressed as expected, before stopping it and possibly missing logs. This is especially important if a bad log is found during rollforward recovery, and the bad log is interpreted to mean the end of logs. In such cases, an undamaged backup copy of that log could be used to continue the rollforward operation through more logs.
Case 2:
Roll forward to the end of the logs (two tablespaces have been restored): db2 rollforward db TBC_MD to end of logs db2 rollforward db TBC_MD to end of logs and stop These two statements are equivalent. Neither AND STOP or AND COMPLETE is needed for tablespace rollforward recovery to the end of the logs. tablespace names are not required. If not specified, all tablespaces requiring rollforward recovery will be included. If only a subset of these tablespaces is to be rolled forward, their names must be specified.
80
Case 3:
After three tablespaces have been restored, roll one forward to the end of the logs, and the other two to a point-in-time, both to be done online: db2 rollforward db TBC_MD to end of logs tablespace(TBS1)online db2 rollforward db TBC_MD to 1998-04-03-14.21.56.245378 and stop tablespace(TBS2,TBS3) online Note that two rollforward operations cannot be run concurrently. The second command can only be invoked after the first rollforward operation completes successfully.
81
You cannot, however, roll tablespaces containing system catalog tables forward to a point-in-time. These tablespaces must be rolled forward to the end of the logs to ensure that all tablespaces in the database remain consistent. Before rolling a tablespace forward, invoke the list tablespaces show detail command. This command returns the minimum recovery time, which is the earliest point-in-time to which the tablespace can be rolled forward. The minimum recovery time is updated when data definition language (DDL) statements are run against the tablespace, or against tables in the tablespace. The tablespace must be rolled forward to at least the minimum recovery time, so that it becomes synchronized with the information in the system catalog tables. If recovering more than one tablespace, the tablespaces must be rolled forward to at least the highest minimum recovery time of all the tablespaces being recovered. If the data and the long objects in a table are in separate tablespaces, and the table has been reorganized, the tablespaces for both the data and the long objects must be restored and rolled forward together. You should take a backup of the affected tablespaces after the table is reorganized.
82
If you want to roll a tablespace forward to a point in time, and a table in the tablespace participates in a referential integrity relationship with another table that is contained in another tablespace, you should roll both tablespaces forward simultaneously to the same point in time. If you do not, both tablespaces will be in check pending state at the end of the point-in-time rollforward operation. If you roll both tablespaces forward simultaneously, the constraint will remain active at the end of the point-in-time rollforward operation.
83
Figure 3-15 shows how to set a quiesce point in the Control Center. To set a quiesce point for a table, right-click the table you want in the contents pane, and select Quiesce from the pop-up menu. The Quiesce window opens.
84
In Figure 3-16, you can see that the tablespace USERSPACE1 is in quiesced state.
After a tablespace point-in-time rollforward operation completes, the tablespace is put in backup pending state. You must take a backup of the tablespace, because all updates made to it between the point in time to which you rolled forward and the current time have been removed. You can no longer roll the tablespace forward to the current time from a previous database-level or tablespace-level backup image.
85
DB2s dropped table recovery feature lets you recover your dropped table data using tablespace-level restore and rollforward operations. This will be faster than database-level recovery, and your database will remain available to users. For a dropped table to be recoverable, the tablespace in which the table resides must have the DROPPED TABLE RECOVERY option turned on. This can be done during tablespace creation, or by invoking the ALTER TABLESPACE statement (see the SQL Reference). The DROPPED TABLE RECOVERY option is tablespace-specific and limited to regular tablespaces. To determine if a tablespace is enabled for dropped table recovery, you can query the DROP_RECOVERY column in the SYSCAT.TABLESPACES catalog table. When a DROP TABLE statement is run against a table whose tablespace is enabled for dropped table recovery, an additional entry (identifying the dropped table) is made in the log files. An entry is also made in the recovery history file, containing information that can be used to recreate the table. Only one dropped table can be recovered at a time.
86
If you start another rollforward operation with a different tablespace list before the in-progress rollforward operation is either completed or cancelled, an error message (SQL4908) is returned. Invoke the LIST TABLESPACES command on all nodes to determine which tablespaces are currently being rolled forward (rollforward in progress state), and which tablespaces are ready to be rolled forward (rollforward pending state). You have three options: Finish the in-progress rollforward operation on all tablespaces. Finish the in-progress rollforward operation on a subset of tablespaces. (This may not be possible if the rollforward operation is to continue to a specific point in time, which requires the participation of all nodes.) Cancel the in-progress rollforward operation.
Note: There in no error reported during the backup, and no tool to check the validity of each partition backup, but the restore fails with an SQL1471N error.
87
Restore is similarly performed on a partition by partition basis, with the catalog partition requiring to be restored first (then, as with the backup, the remaining partitions can be restored in parallel).
The db2 rollforward database command must be issued at the catalog partition. If a partition is damaged and only that partition needs to be restored, the process is as follows: (this is an example for partition 3 in the UNIX environment): 1. Access damaged partition (export DB2NODE=3) 2. Capture database configuration 3. Issue the command db2 drop database test at node 3 4. Issue the command: db2 create database test at node 3 5. Update database configuration with correct values 6. The database partition is placed in restore pending state 7. Issue the command: db2 restore database test
88
89
90
For example: Generate the DDL statements for objects created by user walid in database DEPARTMENT. The db2look output is sent to file db2look.sql: db2look -d department -u walid -e -o db2look.sql Generate the UPDATE statements to replicate the statistics for the tables and indexes created by user walid in database DEPARTMENT. The output is sent to file db2look.sql: db2look -d department -u walid -m -o db2look.sql Generate both the DDL statements for the objects created by user walid and the UPDATE statements to replicate the statistics on the tables and indexes created by the same user. The db2look output is sent to file db2look.sql: db2look -d department -u walid -e -m -o db2look.sql Generate the DDL statements for objects created by all users in the database DEPARTMENT. The db2look output is sent to file db2look.sql: db2look -d department -a -e -o db2look.sql Generate the DDL statements for all user defined nodegroups, buffer pools and tablespaces. The db2look output is sent to file db2look.sql: db2look -d department -l -o db2look.sql Generate the UPDATE statements for the database and database manager configuration parameters, as well as the db2set statements for the registry variables in database DEPARTMENT. The db2look output is sent to file db2look.sql: db2look -d department -f -o db2look.sql Generate the DDL for all objects in database DEPARTMENT, the UPDATE statements to replicate the statistics on all tables and indexes in database DEPARTMENT, the GRANT authorization statements, the UPDATE statements for the database and database manager configuration parameters, the db2set statements for the registry variables, and the DDL for all user defined nodegroups, buffer pools and tablespaces in database DEPARTMENT. The output is sent to file db2look.sql: db2look -d department -a -e -m -l -x -f -o db2look.sql Generate the DDL statements for objects created by all users in the database DEPARTMENT. The db2look output is sent to file db2look.sql: db2look -d department -a -e -td %-o db2look.sql db2 -td%-f db2look.sql
91
92
In other simpler situations, if the source operational system is guaranteed to keep the old source data for longer than the interval between warehouse backups then a warehouse backup will be sufficient because the disaster recovery could recover the warehouse backup and then retrieve the originally processed source data. However, this might not be a trivial exercise. Although a site cannot be made 100% failure proof, the data in the database can be saved and operations using the same data can be resumed at another site, using specific disaster recovery scenario as: Transport of database backup Transport of database backup and archived logs Standby database via log shipping Standby database via replication Synchronous remote mirroring of all data and log files
93
The standby machine has its own resources such as disks, but must have the same physical and logical definitions as the production database. This technique is probably the most widely used disaster recovery method among DB2 UDB customers. The operations that are not logged such as NOT LOGGED INITIALLY transactions and CREATE INDEX, will not be replayed on the standby database. As a result, you want to re-synchronize the standby database after such operations. This could be best accomplished through the new Suspended I/O combined with split mirror. Figure 3-17 illustrates a standby database scenario using the Log Shipping technique.
Production Database
Standby Database
split
LOGS
94
Figure 3-18 shows how the data propagator is used to capture logs.
Production Database
Standby Database
split
Log Capture SQL Apply
This method requires additional system resources such as disk and CPU. When replication is present, the system must be sized to accommodate it. This mechanism has the disadvange that the transactions may be lost when the production system crashes. As a result, this configuration is not as popular for disaster recovery protection as the log shipping technique.
PRODUCTION
STANDBY
Synchronous Mirroring
95
For example, the PPRC, one of the advanced copy services provided by IBM ESS, can be used to mirror the data and log files over the high speed network to the remote disaster recovery site. For better performance, you can avoid the extra I/O delay by turning on group commit using mincommit database configuration parameter, This can result in response time tradeoff, but generally improves overall throughput by utilizing log bandwidth more efficiently.Also you want to make page cleaners more aggressive to account for extra data I/O lag. Synchronous disk mirroring provides the highest degree of protection, but also at the highest cost. Table 3-2 summarizes the disaster recovery mechanisms with a variety of tradeoffs.
Table 3-2 Disaster recovery methods
Method
Transport of database backups
Pros
Low cost Recovery to time of last backup Recovery to time of last archived log Low cost
Cons
Lost all transactions since last backup
Loses all transactions in the active logs Longer recovery time (database restore followed by rollforward through all the logs) Standby not available for use while in rollfoward mode Standby needs to be physically and logically identical Transaction loss a possibility Extra cycles on production database for transaction capture Some administrative actions not reflected on standby (e.g. NOT LOGGED operations)
Support for no transaction loss Minimal impact to productions system Can read (and write) standby Standby need not be physically and logically identical Can choose to replicate only critical tables No transaction loss All changes to the database (including administrative) are replicated Shortest restart time
Performance impact of synchronous mirroring to a geographically remote site High price (software/hardware/network)
96
Chapter 4.
97
4.1 Overview
High Availability is the term used to describe systems that run and are available to customers more or less all the time. High Availability means different things to different people.
In some cases, High Availability means provision of more or less instantaneous cutover facilities and continuing on standby hardware/software as if the original failure had never occurred. In other cases High Availability means possibly up to 30 minutes outage and continuing as before, which can be handled by provision of standby machines that can take over the work of the failing machine after some handover process of both hardware and software. This has the important attribute of experiencing no degradation in performance. In many cases, High Availability in a warehousing environment means that users could put up with a small loss of availability and also accept a degraded service until things are corrected in full. This can be achieved by making provision for what is called mutual takeover, whereby a machine with existing work on it can take on the extra work of all or part of the failing machine until such time as things are repaired in full. For High Availability to occur: Transactions must be processed efficiently, without appreciable performance degradations (or even loss of availability) during peak operating periods. Systems must be able to recover quickly when hardware or software failures occur, or when disaster strikes. For example, you may want to use of a journaled file system, which is a file system that automatically logs changes to its structure. This ensures that any changes to the file system structure are safe from system crashes, assuming that the storage medium is not lost or corrupted. After a system crash, the changes in these logs are applied to the file system, in the order that they were initially logged. You can reduce recovery times by using a journaled file system, especially when your environment has large file systems, or when data integrity is particularly important. The ability to recover quickly depends critically on having a proven backup and recovery strategy in place. Software that powers the enterprise databases must be continuously running and available for transaction processing. To keep the database manager running, you must ensure that another database manager can take over if it fails. This is called failover capability and allows for the automatic transfer of workload from one system to another when there is hardware failure.
98
99
Failover strategies are usually based on clusters of systems. A cluster is a group of connected systems that work together as a single system. Each processor is known as a node within the cluster. Clustering allows servers to back each other up when failures occur, by picking up the workload of the failed server (Figure 4-1).
Clients
SCSI bus
Local Disk Local Disk
Node A
Disk 'A' Disk 'B'
Node B
IP address takeover (or IP takeover) is the ability to transfer a server IP address from one machine to another when a server goes down; to a client application, the two machines appear at different times to be the same server. Failover software may use heartbeat monitoring or keepalive packets between systems to confirm availability. Heartbeat monitoring involves system services that maintain constant communication between all the nodes in a cluster. If a heartbeat is not detected, failover to a backup system starts. End users are usually not aware that a system has failed.
100
Active
Idle Standby
Active Fail-over to Node 1 Active Active Active
Mutual Takeover
Active
Active
Active
Active
Active Standby
Figure 4-2 High Availability clustering configurations
Others
101
Idle standby
In this configuration, one system is used to run a DB2 UDB instance, and the second system is idle, or standby mode, ready to take over the instance if there is an operating system or hardware failure involving the first system. Overall system performance is not impacted, because the standby system is idle until needed. Figure 4-3 is an idle standby example. The cluster includes all four nodes and one node is kept idle, standing by to take over the workload of any node that fails. Although this configuration is more costly, it does have the advantage that there is no performance degradation after failover of one machine at a time.
Physical Machines
102
Mutual takeover
In this configuration, each system is the designated backup for another system. Overall system performance may be impacted, because the backup system must do extra work following a failover: it must do its own work plus the work that was being done by the failed system. Figure 4-4 shows an example of a partitioned database consisting of four database partitions, each running on a separate server. The server hardware consists of four nodes connected with a high-speed network. Additional cluster software such as HACMP on AIX or MSCS, also known as Wolfpack, on Windows is installed. The four nodes are separated into two pairs. Each pair is defined as cluster to the cluster software. Each node acts as the failover server for the other node in the same cluster.
Physical Machines
Cluster 1
Cluster 2
3 3 4
4 4
The mutual takeover configuration means that a failure would result in that nodes partition being recovered and its workload being taken over from the other node in a cluster which is already running a workload. The cluster software typically allows the invocation of failover scripts when failover occurs. You use these scripts to adjust various operating parameters when a failover or failback occurs. For example, the failover scripts may be used to shrink the bufferpools of both affected logical partitions when a failover occurs, and restore them to normal on failback. DB2 UDB provides several sample takeover scripts, tailored for the various cluster software environments.
103
is not running any other workload. In a mutual takeover configuration, the AIX
processor node that is the takeover node is running other workloads.
104
Generally, DB2 UDB Enterprise - Extended Edition (EEE) runs in mutual takeover mode with partitions on each node. One exception is a scenario in which the catalog node is part of a hot standby configuration. HACMP ES failover recovery allows pre-defined (also known as cascading) assignment of a resource group to a physical node. The failover recovery procedure also allows floating (or rotating) assignment of a resource group to a physical node. IP addresses, and external disk volume groups, or file systems, or NFS file systems, and application servers within each resource group specify either an application or an application component, which can be manipulated by HACMP ES between physical nodes by failover and reintegration. Failover and reintegration behavior is specified by the type of resource group created, and by the number of nodes placed in the resource group. For example, there is a DB2 UDB database partition (logical node). If its log and tablespace containers were placed on external disks, and other nodes were linked to those disks, it would be possible for those other nodes to access these disks and to restart the database partition (on a takeover node). It is this type of operation that is automated by HACMP. HACMP ES can also be used to recover NFS file systems used by DB2 UDB instance main user directories.
105
Client Workstation
Network: LAN
Processor 1 LAN Connection
db2inst
Processor 1
Processor 2
Both processors have access to the installation directory, the instance directory, and the database directory. The database instance db2inst is being actively executed on processor 1. Processor 2 is not active, and is being used as a hot standby. A failure occurs on processor 1, and the instance is taken over by processor 2. Once the failover is complete, both remote and local applications can access the database within instance db2inst. The database will have to be manually restarted or, if AUTORESTART is on, the first connection to the database will initiate a restart operation.
106
Client Workstation
Node 10 Standby
LAN Connection
Network: LAN
Node 10 Standby
LAN Connection
db2inst 1
db2inst 2
Node 20
Two instances, db2inst1 and db2inst2, are created from a single installation path on a shared file system. Instance db2inst1 is created on /u/db2inst1, and instance db2inst2 is created on /u/db2inst2. Both of these paths are on a shared file system that is accessible to both processors. Each instance has a single database, with a unique path, that is also on a shared resource accessible to both processors. Both instances are accessed via remote clients over the TCP/IP protocol: db2inst1 uses the service name db2inst1_port (port number 5500) db2inst2 uses the service name db2inst2_port (port number 5550)
107
Remote clients accessing the db2inst1 instance have this instance cataloged in their node directory using node10 as the host name. Remote clients accessing the db2inst2 instance have this instance cataloged in their node directory using node20 as the host name. Under normal operating conditions, db2inst1 is running on node10, and db2inst2 is running on node20. If node10 were to fail, the failover script will start db2inst1 on node20, and the external IP address associated with node10 will be switched over to node20. Once the instance has been started by the failover script, and the database has been restarted, the remote clients can connect to the database within this instance as if it were running on node10.
108
After you finish enabling the instance for failover support, your configuration will resemble Figure 4-7.
Machine A Machine B
DB2 Group 0
The following sections describe the different types of failover support, and how to implement them. Before performing any of the steps described below, you must already have the MSCS software installed on every machine that you want to use in an MSCS cluster. In addition, you must also have DB2 UDB installed on every machine.
:E
:C :F
:C
SQLLIB
:D
SQLLIB
109
Cluster
Workstation A
Workstation B
Instance A
Instance A
110
Cluster
Workstation A
Workstation B
Instance A Instance B
Instance A Instance B
111
But that is not enough. You also need to: Assign logs and data to separate devices. The logs are vital. If you lose the log, you are not able to recover to the point of failure and you lose committed transactions. Keep dual logging. DB2 UDB now has the capability to mirror the active log files to protect databases from: Accidental deletion of an active log Data corruption caused by hardware failure A new registry variable, DB2_NEWLOGPATH2, allows the database to write an identical copy of the log files to a different path on a physically separate disk. Take advantage of DB2 UDBs granular tablespace recovery. It allows independent recovery by assigning tables to different tablespaces. Add redundancy to log and data devices through mirroring and RAID. Add redundancy to data path such as dual adaptors. Perform regular backups. Store archived logs and database backups in a safe place.
112
Also, although disk mirroring dramatically reduces the impact of media failures, there is still a risk of damage to both sides of the mirror. If a database is held on one set of physical volumes, and a mirror image of the same database is maintained on a separate set of physical volumes, it is possible for both sets of physical volumes to be damaged or destroyed. This could happen as a result of a disaster or it could just be bad luck. In such instances, it will be necessary to recover the database from backup copies. In DB2 UDB, you should at least consider mirroring the log file directory where the active logs reside. This will help ensure full recoverability to the point of failure.
Disk arrays and RAID are hardware solutions to improve some or all of the following disk characteristics:
Reliability: Using either mirroring or parity information allows operation to continue in the degraded mode, even in the event of a single disk failure. Variety: Disk arrays come in a large variety of configurations with various number of tunable alternatives.
113
Disk arrays
The capacity of single large disks has grown rapidly, but the performance improvements have been modest, when compared to the advances made in the other subsystems that make up a computer system. The reason for this is that disks are mechanical devices, affected by delays in seeks and the rotation time of the media. In addition, disks are often among the least reliable components of the computer systems, yet the failure of a disk can result in the unrecoverable loss of vital business data, or the need to restore a tape backup with consequent delays. The use of arrays of inexpensive disks can offer a solution to these concerns. There is nothing unusual about connecting several disks to a computer to increase the amount of storage. Mainframes and minicomputers have always had banks of disks. The disk subsystem is called a disk array when several disks are connected and accessed by the disk controller in predetermined patterns designed to optimize performance and/or reliability. The driving force behind disk array technology is the observation that it is cheaper to provide a given storage capacity or data rate with several small disks connected together than with a single disk.
RAID classifications
Disk arrays seem to have been invented independently by a variety of groups. One specifically, the Computer Architecture group at the University of California, Berkeley invented the term Redundant Arrays of Inexpensive Disk (RAID). The original RAID classification described five levels of RAID (RAID-1 through 5). To these have been added RAID-0 (data-striping), RAID-1 Enhanced (data stripe mirroring) and Orthogonal RAID-5 (which includes extra redundancy of components such as disk adapters). RAID-0 is not a pure RAID type, since it does not provide any redundancy. Different designs of arrays perform optimally in different environments. The two main environments are those where a high I/O rate is needed, that is: High transfer rates are very important. High I/O rates is needed - that is for applications requesting short length random records. Table 4-1 shows the RAID array classifications.
114
RAID-0 RAID-1 RAID-1 Enhanced RAID-2 RAID-3 RAID-4 RAID-5 Orthogonal RAID-5
Block Interleave Data Striping without Parity Disk Mirroring/Duplexing Data Strip Mirroring Bit Interleave Data Striping with Hamming Code Bit Interleave Data Striping with Parity Check Block Interleave Data Striping with One Parity Disk Block Interleave Data Striping with Skewed Parity RAID-5 with Additional Redundancy (such as disk adapters)
Here we describe RAID-0, RAID-1, and RAID-5 and their function, as follows.
RAID-0
RAID-0 (Figure 4-10) is the data organization term used when striping data across multiple disk drives, without parity protection. Data striping improves performance with large files, since reads/writes are overlapped across all disks. However, reliability is decreased, as the failure of one disk will result in a complete failure of the disk subsystem.
Disk Controller
xxxxx yyyyy
xxxxx zzzzz
xxxxx
xxxxx
xxxxx
Block o
xxxxx = Blocks belonging to long files yyyyy & zzzzz = Blocks belonging to short files
115
RAID-1
RAID-1 is the term used with disk mirroring (Figure 4-11) or duplexing (Figure 4-12) at the hardware level. Whenever the computer makes an update to a disk, it can arrange to duplicate that update to a second disk, thus mirroring the original. This level of RAID is implemented in LAN Server fault tolerance. Either disk can fail, and the data is still accessible. Additionally, because there are two disks, a read request can be serviced from either disk, thus leading to improved throughput and performance on the disk subsystem. However, the down side is the cost of using 50% of disk storage space for mirroring.
D is k C o n tr o lle r
D is k 1
D is k 2
In the case of the IBM RAID controller there are two separate disk SCSI channels available from one card and so duplexing is possible from one disk controller card. Some might argue this is not true duplexing, but is mirroring on separate disk control channels. In any case, the IBM RAID controller provides an extremely cost effective and adaptable method for arranging data on a disk subsystem using RAID-1.
D is k C o n tro lle r
D is k 1
D is k C o n tro lle r
D is k2
116
RAID-5
RAID-5 (Figure 4-13) is the term used when striping data across three or more disks with skewed parity. This means the data organization is essentially the same as RAID-0, but there is an additional element of parity checking. The parity checking is used to encode the data and guard it against loss, and is referred to as a checksum, disk parity or Error Correction Code (ECC). The principle is the same as memory parity, where the data is guarded against the loss of a single bit of data. In RAID-5, the parity information is stored on the disk array to guard against data loss, and skewing is used to remove the bottleneck that would be created by having all the parity information stored on a single drive.
Disk Controller
Block o
Block n
Figure 4-13 RAID-5 (Block interleave data striping with skewed parity)
Using RAID technology to provide striping of data across multiple disks will often improve performance as well as enhance data integrity in an environment where data is predominantly read off the disk without a subsequent update (write).
117
Good Very Good Good Good Good Poor Good Good Very Good
118
With support for the DB2_PARALLEL_IO registry variable, it is no longer necessary to define multiple containers to achieve parallel I/O. Tell DB2 UDB that the container does it's own internal striping during the tablespace creation using the db2set command:
db2set db2_striped_containers=on
You need to do this for all DMS containers because they have a tag which marks the container as owned, and is placed at the start of the container. The presence of this tag means that each extent is not aligned on a RAID stripe boundary, even if the extent size and stripe size are equal. To avoid this undesirable problem, you want to set the DB2_STRIPED_CONTAINERS registry variable to ON. It only has effect on newly created or restored tablespaces.
Split mirror
A backup always degrades the performance of the production system. Especially if the warehouse database is big or in a 7x24 hour environment, it is hard to find a time frame when to plan the backup to not interfere with the normal operation To free the production system from the overhead of backup, a copy or mirror of the database would be nice to be available for backup, report or other purposes.
119
Some intelligent storage servers such as IBM Enterprise Storage Server (ESS), support the split mirror feature. For example, the FlashCopy is the ESSs implementation of the split mirror feature. Split mirror means that identical and independent copies of disk volumes can be established within those storage servers. These copies can normally be established in a very short time (for example, 5 to 20 seconds depending on device). If the database resides on a storage server that supports the split mirror feature, a copy of the disk volumes can be established and assigned to another (backup) machine. On the backup machine, the (backup) database can then be accessed exclusively for backup or other purposes without reference to users. Split mirror allows you to establish an identical and independent copy of a disk volume (see Figure 4-14). The source and target volumes must reside in the storage server.
source system
target system
Storage Server
not assigned to any system
120
As you can see in Figure 4-14, the target volumes should be assigned to another physical machine. If the target volumes are assigned to the same machine where the source volumes are, the operating system may have problems identifying the new disk volume, as it is an exact copy of the original disk. Unique disk identifiers, size of the disk, the copied data itself, and so on will appear twice on the same machine which may cause problems.
121
The ESS Copy Services provide replication of mission critical data; point-in-time with FlashCopy, dynamic synchronous mirroring to a remote with Peer-to-Peer Remote Copy (PPRC) and asynchronous copying to a remote site with Extended Remote Copying (XRC). This last function is only available in a z/OS and OS/390 environment. The IBM Enterprise Storage Server (ESS) is a member of the Seascape family of storage products. The ESS was announced in June 1999 and was generally available in September 1999. Since its announcement it has revolutionized the storage marketplace. It consists of a storage server and attached disk storage devices. The storage server provides integrated caching and RAID support for the attached disk devices. The disk devices are attached via a serial interface. The ESS can be configured in a variety of ways to provide scalability in capacity and performance. Redundancy within the ESS provides continuous availability. It is packaged in one or more enclosures, each with dual line cords and redundant power. The redundant power system allows the ESS to continue normal operation when one of the line cords is deactivated. The ESS provides the image of a set of logical disk devices to the attached servers. The logical devices are configured to emulate disk device types that are compatible with the attached servers. The logical devices access a logical volume that is implemented using multiple disk drives. The ESS can be broken down into different components. The storage server itself is composed of two clusters that provide the facilities with advanced functions to control and manage data transfer. Should one cluster fail, the remaining cluster can take over the functions of the failing cluster. A cluster is made up of the following subcomponents:
Host adapters:
Each cluster has one or more host adapters (HAs). Each host adapter provides one or more host I/O interfaces. A host adapter can communicate with either cluster complex.
Device adapters:
Each cluster has one or more Device Adapters (DAs). Each device adapter provides one or more storage device interfaces. Disk drives are attached to a pair of device adapters, one in each cluster, so that the drives are accessible from either cluster. At any given time, a disk drive is managed by only one device adapter.
122
Cluster complex:
The cluster complex provides the management functions for the ESS. It consists of cluster processors, cluster memory, cache, nonvolatile storage (NVS) and related logic: Cluster processors: The cluster complex contains four cluster processors (CP) configured as symmetrical multiprocessors (SMP). The cluster processors execute the licensed internal code that controls operation of the cluster. Cluster memory / cache: These are used to store instructions and data for the cluster processors. The cache memory is used to store cached data from the disk drives. The cache memory is accessible by the local cluster complex, by device adapters in the local cluster, and by host adapters in either cluster. Nonvolatile storage (NVS): This is used to store a nonvolatile copy of active written data. The NVS is accessible to either cluster-processor complex and to host adapters in either cluster. Data may also be transferred between the NVS and cache. The disk drives provide the primary nonvolatile storage medium for any host data stored within the ESS Storage devices. They are grouped into ranks and managed by the clusters. As a member of the IBM Seascape family, the ESS provides the outboard intelligence required by SAN solutions, off-loading key functions from host servers, which frees up valuable processing power for applications. As a comprehensive SAN-based storage solution, the ESS provides considerable management flexibility to meet the fast-paced requirements of the next century.
ESS Advanced Copy Services Copy Services is a separately sold feature of the Enterprise Storage Server. It
brings powerful data copying and mirroring technologies to Open Systems environments previously available only for mainframe storage. This book deals with the two features of Copy Services for the Open Systems environment: FlashCopy Peer-to-Peer Remote Copy (PPRC)
FlashCopy
FlashCopy provides an instant or point-in-time copy of an ESS logical volume. The point-in-time copy functions give you an instantaneous copy, or view, of what the original data looked like at a specific point-in-time. This is known as the T0 (time-zero) copy.
123
Both the source and target volumes reside in the ESS. Normally, the source volume is only visible to the source machine and the target volume only to the target machine When a FlashCopy is invoked, the command returns to the operating system as soon as the FlashCopy pair has been established and the necessary control bitmaps have been created. This process takes only a few seconds to complete. Thereafter, you have access to a T0 copy of the source volume. As soon as the pair has been established, you can read and write to both the source and the target volumes. The point-in-time copy created by FlashCopy is typically used where you need a copy of production data to be produced with minimal application downtime. It can be used for online backup, testing of new applications, or for creating a database for data-mining purposes. The copy looks exactly like the original source volume and is an instantly available, binary copy. See Figure 4-15 for an illustration of FlashCopy concepts.
Source
Target
Time
Write
Read
Read
Write
124
FlashCopy is possible only between disk volumes. It also requires a target volume to be defined within the same Logical Subsystem (LSS) as the source volume. A source volume and the target can be involved in only one FlashCopy relationship at a time. When you set up the copy, a relationship is established between the source and the target volume and a bitmap of the source volume is created. Once this relationship is established and the bitmap created, the target volume copy can be accessed as though all the data had been physically copied. While a relationship between source and target volumes exists, a background task copies the tracks from the source to the target. The relationship ends when the physical background copy task has completed. You can suppress the background copy task using the Do not perform background copy (NOCOPY) option. This may be useful if you need the copy only for a short time, such as making a backup to tape. If you start a FlashCopy with the Do not perform background copy option, you must withdraw the pair (a function you can select) to end the relationship between source and target. At the time when FlashCopy is started, the target volume is basically empty. The background copy task copies data from the source to the target. The FlashCopy bitmap keeps track of which data has been copied from source to target. If an application wants to read some data from the target that has not yet been copied to the target, the data is read from the source; otherwise, the read is satisfied from the target volume. When the bitmap is updated for a particular piece of data, it signifies that source data has been copied to the target and updated on the source. Further updates to the same area are ignored by FlashCopy. This is the essence of the time-zero point-in-time copy mechanism. Before an application can update a track on the source that has not yet been copied, the track is copied to the target volume. Reads that are subsequently directed to this track on the target volume are now satisfied from the target volume instead of the source volume. After some time, all tracks will have been copied to the target volume, and the FlashCopy relationship will end. You cannot create a FlashCopy on one type of operating system and make it available to a different operating system. You can make the target available to another host running the same type of operating system.
125
Note 1: When establishing the split mirror the data on the source volume must be in a consistent state. This can either be achieved by stopping the application and flushing the data from memory to disk, or if the application cannot be stopped, then by application itself providing a feature to ensure that the data is consistent while the FlashCopy is being established and can recover from that state afterwards on the target side.
Note 2: DB2 UDB provides the suspended I/O feature and db2inidb tools to make use of the split mirror feature. PPRC
PPRC is a synchronous protocol that allows real-time mirroring of data from one Logical Unit (LUN) to another LUN in a second ESS. The secondary ESS can be located at another site some distance away. PPRC is application independent. Because the copying function occurs at the disk subsystem level, the application has no knowledge of its existence. The PPRC protocol guarantees that the secondary copy is up-to-date by ensuring that the primary copy will be written only if the primary system receives acknowledgement that the secondary copy has been written. Figure 4-16 shows the sequence of events.
Host server
1. Write (channel end) 2. Write to secondary 3. Write hit at secondary 4. Acknowledgement (device end)
3 2
126
1. The host server requests a write I/O to the primary ESS. The write is staged through cache into Non-Volatile Storage (NVS). 2. PPRC dispatches the write over an ESCON channel to the secondary ESS. The write hits the secondary ESSs NVS. 3. The primary then expects acknowledgment of the remote write. If the secondary write fails, the write does not return to the host server and is eventually aged from NVS. 4. The write returns to the host servers application. Once acknowledgement of the write has been received by the primary, both the primary and secondary write I/Os are eligible for destage to disk. Destage from the cache to the disk drives on both the primary and the secondary ESS is performed asynchronously. If acknowledgement of the remote write is not received within a fixed period of time, the write is considered to have failed, and is rendered ineligible for destage to disk. At this point, the application receives an I/O error, and in due course, the failed write I/O is aged-out of each NVS.
IBM StorWatch
IBM StorWatch, IBM's Enterprise Storage Resource Management (ESRM) solution, is a growing software family whose goal is to enable storage administrators to efficiently manage storage resources from any location within an enterprise. Widely dispersed, disparate storage resources will ultimately be viewed and managed through a single, cohesive control point. The StorWatch family of ESRM products addresses the storage challenges of today with a clear vision for the future. IBM StorWatch Expert is a program product in the IBM StorWatch software family and it helps you manage your Enterprise Storage Server (ESS) and Enterprise Tape Library (ETL) using a Web browser interface. The StorWatch Expert helps you do the following tasks: Performance management Asset management Capacity management Figure 4-17 shows how the StorWatch Expert works with your ESS and/or ETL. The StorWatch Expert communicates with your ESS/ETL through the TCP/IP network. Therefore, you can gather information on any ESS/ETL across the world as long as you have a communication path between the StorWatch Expert and the ESS/ETL through your intranet.
127
The StorWatch Expert itself runs under a Windows NT 4.0 or AIX V4.3.3 operating system. However, you do not have to operate Expert right where it runs, since the user interface of the Expert is the Web browser interface. In other words, you can operate the Expert through Netscape Navigator or Microsoft Internet Explorer. The StorWatch Expert asks your ESS/ETL to send information about their capacity or performance. When the StorWatch Expert receives this information, it is stored into a DB2 UDB database. Thus, you can prepare and produce reports containing just the information you need.
128
The suspended I/O support is necessary to bring the database into a consistent state before establishing the split mirror. With the write suspend command, the database enters a well defined state where it can recover later using the db2inidb tool. During the suspend of the database, the DB2 UDB clients will see that their transactions will hang. As soon as the database is resumed again for writing (write resume), the transactions will proceed normally. The db2inidb tool is necessary in combination with the split mirror feature, to bring the target database into a running state again after the split mirror was established. The db2inidb tool can perform crash recovery or put a database in rollforward pending. There are three possible options:
Snapshot: This initiates crash recovery, making the database consistent. A new log chain starts, and the database will not be able to roll forward through any of the logs from the original database. The database is available for any operation, including backup. Standby: This places the database in rollforward pending state. Crash recovery is not performed, and the database remains inconsistent. Mirror: This causes a mirrored copy of the database to replace the original database. The database is placed in rollforward pending state, and the write suspend state is turned off. Crash recovery is not performed, and the database remains inconsistent.
129
Active Database
Secondary Database
split
Master Data & Logs Mirror Copy
These are the steps to follow to make a clone database: 1. Suspend I/O on source database. The following DB2 UDB command will suspend all write activities from DB2 UDB clients, but they will not be disconnected from the database:
db2 set write suspend for database
2. Establish split mirror. This step is dependent on the vendor. For example, issue FlashCopy on the IBM ESS. The whole database must be copied to use it on the target machine. 3. Resume I/O on source database. After a few seconds the split mirror is established and the database can be made available again for writing. The transactions will proceed as normal.
db2 set write resume for database
4. Make data visible on target machine. The target volumes will now contain all the data from the time the split mirror was established, but they may not yet be visible to the target operating system. The operating system on the target machine has to provide access to the data (import, mount, and so on). (For initial setup, the database needs to be cataloged at the target machine.) 5. Start target (clone) database Issue the db2start command at the instance at the target machine. 6. Bring the clone database into a consistent state (perform crash recovery) The following command will rollback every uncommitted transaction:
db2inidb <target-database> as snapshot
130
The clone database can now be used for an offline backup, or as a test database.
Note: Any DB2 UDB backup image taken on the cloned database can not be used for restore on the original database for the purpose of performing rollforward recovery using the log files produced on the original database after the split mirror.
Active Database
Secondary Database
split
Master Data & Logs Mirror
Figure 4-19 DB2 UDB standby database
Hot standby Take backups that can be restored on the primary system
offloads cycles from primary
Copy
Note: Do not copy the logfiles using the split mirror feature. This will break your rollforward chain. The necessary logs for rollforward must all be acquired from the source database as soon as they are available (no longer used by the source database). If logfiles have been copied to the target machine using the split mirror feature, then they must be deleted.
The steps required to set up a standby database differ only at the last step of scenario one (setup a clone database). We only cover the last step here. Set the database into rollforward mode: db2inidb <target-database> as standby Now the logfiles from the source-database can be used to rollforward the target-database. As long as there are new logs available at the source-database, the rollforward step can be repeated. (To make the transfer of the logfiles easier, a user exit may be configured.)
131
db2 rollforward db <target-database> to end of logs As long as the database stays in rollforward pending mode, no database backups are allowed. If the source database crashes, the standby database can be activated for access. (Make sure that all data has already been copied to the target volumes.) The rollforward must be stopped with the stop option of the DB2 UDB rollforward command: db2 rollforward db <target-database> stop Then the users can switch over to the standby database to continue their work.
Active Database
Secondary Database
split
Master Data Only Mirror
Figure 4-20 DB2 UDB mirror database
Copy
Note: Do not copy the logfiles using the split mirror feature. All necessary logs for recovery must stay at the source database or on another location, but not on the target database. If logfiles have been copied to the target machine using the split mirror feature, then they must be deleted.
The steps required are: 1. Suspend I/O on source database. The following DB2 UDB command will suspend all write activities from DB2 UDB clients, but they will not be disconnected them from the database.
db2 set write suspend for database
132
2. Establish split mirror. This step is dependent on the vendor. For example, issue FlashCopy on the IBM ESS. The logfiles should not be copied to the target database. Make sure that all data will be copied to the target machine sooner or later. 3. Resume I/O on source database. After a few seconds the split mirror is established and the database can be made available again for writing. The transactions will proceed as normal.
db2 set write resume for database
4. Make data visible on target machine. The target volumes will now contain all the data from the time the split mirror was established, but they may not yet be visible to the target operating system. The operating system on the target machine has to provide access to the data (import, mount, and so on). (For first time setup, the database needs to be cataloged at the target machine.)
Note: No DB2 UDB operations are allowed on the target (split mirror) database after the split mirror was established in order to use the target database for restore on the source database. The database needs to stay in this frozen state.
The target database cannot be backed up using DB2, but can be backed up using operating system tools. If the source database happens to crash it can be restored with the split mirror image at the target database. See the following steps: 1. Stop the source database (we want to restore this database).
db2stop
2. Restore the database. With operating system tools (for example, copy, xcopy, cp, tar and so on) copy the datafiles of the split mirror database over the original database. But do not copy the logfiles from the target database to the source database. (Make sure that all data has already been copied to the target database.) Another restore possibility would be to reverse the split mirror and copy the data on the target disk volumes back to the source disk volumes using the split mirror feature of the storage server again. 3. Start the source database again.
db2start
133
Now a rollforward to end of logs of the database can be started. The logs from the original source database will be used.
logical volume
physical volume
physical volume
physical volume
Physical data
134
The following requirements are necessary to use the AIX splitcopy feature: Logical volume must be mirrored with AIX LVM Journaled files system log (JFS log) must also be mirrored The number of copies for the JFS log must be equal the number of copies for the filesystems logical volume If multiple filesystems needs to use the splitcopy feature at the same time, each filesystem must have its own mirrored journal file system log. Splitcopy separates one physical copy of the mirrored logical volume and assigns it to a new filesystem. This new splitcopy filesystem will be read only. The splitcopy can be established with the following command shown in Example 4-1.
Example 4-1 Splitcopy example
# chfs -a splitcopy=/dbcopy /dbdata splitlvcopy00 backup requested(0x100000)... log redo processing for /dev/splitlvcopy00 syncpt record at de9c08 syncpt record at d69b74 end of log e67488 syncpt record at de9c08 syncpt address d49074 number of log records = 10552 number of do blocks = 59 number of nodo blocks = 4 #lsvg -l rootvg |grep db splitlv jfs 6 12 2 splitlvcopy00 jfs 0 0 0
open/stale open???????
/dbdata /dbcopy
The original JFS will now be in a stale mirrored state, because the one physical disk that was split off the mirror will not be synchronized any more. But the relation between the split off physical volume and the LVM mirrored logical volume still exists. Refer to Figure 4-22.
135
/dbdata
logical volume
logical volume
physical volume
physical volume
physical volume
Physical data
For more information about splitcopy, see 5.8 Online JFS Backup in AIX Version 4.3 Differences Guide, SG24-2014. DB2 UDB can use this splitcopy feature to create a database backup image on the splitcopy filesystem that can be used to restore the DB2 UDB database and also rollforward the logs.
136
4. Establish splitcopy. For each filesystem, issue the following command as root user. It is possible to specify which mirror copy to split off by using the -a copy option. The default is to split off the second copy. Valid options are 1,2, or 3. chfs -a splitcopy=/dbcopy -a copy=3 /dbdata 5. Resume I/O on database. db2 set write resume for database 6. Back up database. As instance owner (or root user) use an AIX backup command to back up the datafile of the database. Ensure that all files are being backed up. For example: cd /dbcopy; tar -cvf /tmp/db2inst1.tar ./db2inst1 7. Re-establish original mirror. This can be done by removing the generated splitcopy filesystem. As root user issue a command like the following: rmfs -r /dbcopy This will synchronize the splitcopy physical volume again into the original mirror.
137
Overview
Tivoli Storage Manager, formerly known as ADSM, is a full-function storage software product that addresses the challenges of complex storage management across distributed environments. It protects and manages a broad range of data, from the workstation to the corporate server environment. Tivoli Storage Manager provides: Centralized administration for data and storage management Efficient management of information growth Customized backup solutions for major groupware and database products Tivoli Storage Manager is the core application of the Tivoli Storage Management solution set. Tivoli Storage Manager is an enterprise-wide storage management application for the network. It provides automated storage management services (including backup and restore, archive and retrieve, hierarchical space management and disaster recovery) to multi-vendor workstations, personal computers, mobile laptops and servers of all sizes and operating systems, which are connected via WAN, LAN, and SAN. Tivoli Storage Manager includes these components:
Server: The server provides backup, archive, and space management services to its defined clients. The server maintains its own database and recovery log for information about Tivoli Storage Manager resources, users, and user data including all backed-up, archived and migrated files. The client data itself is stored in server-controlled entities called storage pools. These are groups of random and sequential access media that store backed-up, archived, and space-managed files.
The Tivoli Storage Manager server is responsible for maintaining the integrity of client sessions, reliably receiving client data, storing client data in storage pools, and efficiently managing that data internally so that it can be restored or retrieved when required. You can set up multiple servers in your enterprise network to balance storage, processor, and network resources. Tivoli Storage Manager allows you to manage and control multiple servers from a single interface that runs in a Web browser (the enterprise console).
138
Administrative interface: The administrative interface allows administrators to control and monitor server activities, define management policies for client files, and set up schedules to provide services at regular intervals.
Administrative functions are available from an administrative client command line and from a Web browser interface. A server console is also available.
Backup-Archive client: The Backup-Archive client allows users to maintain backup versions of their files, which they can restore if the original files are lost or damaged.
Users can also archive files for long-term storage and retrieve the archived files when necessary. A command line interface, native GUI interface, and Web browser interface are available for the Backup-Archive clients.
Application program interface (API): The API allows users to enhance existing application programs with backup, archive, restore, and retrieve services. When users install the Tivoli Storage Manager API client on their clients, they can register as client nodes with a Tivoli Storage Manager server.
139
Here are some of the drawbacks when using the Tivoli Storage Manager Backup-Archive client: Consider a 5 GB database that changes everyday. The Tivoli Storage Manager Backup-Archive client will back up the full 5 GB even if only a 2 MB document has changed. You waste a lot of time and storage space using this strategy. Many databases need to operate twenty four hours a day, seven days a week so they are in use all the time and a consistent backup cannot be taken. The alternative is to quiesce the DB2 UDB database and take backups, but this would result in server unavailability, which is not good for business.
Day-to-day management
In this section we will discuss how to automate the DB2 UDB backup and how to verify the success of these backups.
db2adutl utility
The db2adutl is a very useful command that comes with DB2 UDB to manage old backups and logfiles that reside on the Tivoli Storage Manager server. The tool is located in the $HOME/sqllib/adsm directory of the instance owner in AIX environment. On Windows 2000, the tool is located in the ...\sqllib\bin directory. The db2adutl utility provides the ability to query, extract, delete, and verify backups, loadcopies, and log archives from Tivoli Storage Manager. All backup file names include a time stamp and therefore are unique for every backup to Tivoli Storage Manager. The backup copies in Tivoli Storage Manager are therefore always active and never deleted by normal Tivoli Storage Manager file expiration processing. The db2adutl utility provides a way of deleting backups and log files that are no longer required. Example 4-2 shows the syntax to invoke the db2adutl utility.
140
QUERY queries either tablespace, full backup, loadcopy images, or log archives. If you type query only, it returns all four. EXTRACT, if you do not qualify it, displays the name of each backup image and prompts you to extract the image. If you qualify the command you reduce the scope of the search. For this option, time stamps do not apply to log archives.
141
DELETE, if you do not qualify it, works similarly to extract, except that backup images are marked inactive and archive objects (log files) are deleted.
The VERIFY qualifier, performs consistency checking on the tablespace or backup copy that is on the Tivoli Storage Manager server. This parameter causes the entire backup image to be transferred over the network. The KEEP qualifier n keeps only the newest n images. The OLDER qualifier (THAN is optional) deletes any images older than the specified time stamp (this must be the complete time stamp string) or the specified number of days. Warning: If you automated the deletion of backups using this qualifier, be aware backups may fail and your automation may delete your last valid backups. The TAKEN AT <timestamp> qualifier is the time stamp with which you want to perform the operation. This qualifier is not allowed with LOGS, because LOGS have no time or date association. The SHOW INACTIVE qualifier shows also the inactive versions of full database backup, tablespace or loadcopy images that have been deleted with db2adutl and therefore marked deleted on the Tivoli Storage Manager server. This qualifier will only work if the Tivoli Storage Manager server is configured to allow inactive versions. The DATABASE qualifier restricts the search to a particular database. The WITHOUT PROMPTING qualifier disables the prompt. Be very careful when using this option because it may delete more than you have expected to delete.
142
The relevant information is contained within the first line of each stanza. These lines show the following information: Operation (Op:B=backup) Object (Obj:D=Database) Type (Type:F=Offline,N=Online) Device (Dev:A=TSM) For a more detailed description of the list history command see the DB2 UDB Command Reference, SC09-2951.
143
144
then echo "Backup was not successful" | mail db2inst1@brazil exit 1 fi # # Get the timestamp from backup out of logfile # TIMESTAMP=$(tail -3 $LOG | awk '{print $11}') # # Verify backup # db2adutl verify full taken at $TIMESTAMP db $DB without prompting >> $LOG 2>&1 # # Check if verification is ok # RC=$? if [ $RC != 0 ] then echo "Verify was not successful" | mail db2inst1@brazil exit 1 fi exit 0
145
146
Chapter 5.
147
148
Monitor the execution of agent jobs, ensuring successful completion, and allowing administrators to tune the warehouse build process over time using statistics collected as part of the execution process. Sometimes your primary Data Warehouse Center could fail and no longer function as the user interface to perform the tasks described above. Assuming that there is nothing wrong with your warehouse control database, you can resume your interrupted administrative task by quickly switching to another Data Warehouse Center.
Note: If all the updates to DB2 Warehouse Manager are done in a standalone session in a special administration window, then this is a very controlled environment, and an offline backup could be used satisfactorily for the warehouse control database.
Example 5-1 shows how you can use the DB2 command line interface to issue the update command.
Example 5-1 Update database configuration parameters for rollforward recovery
C:\SQLLIB\BIN>db2 update db cfg for tbc_md using logretain recovery DB20000I The UPDATE DATABASE CONFIGURATION command completed successfully. DB21026I For most configuration parameters, all applications must disconnect from this database before the changes become effective. C:\SQLLIB\BIN>db2 update db cfg for tbc_md using userexit on DB20000I The UPDATE DATABASE CONFIGURATION command completed successfully. DB21026I For most configuration parameters, all applications must disconnect from this database before the changes become effective.
149
You can accomplish the same thing through the DB2 Control Center, as shown in Figure 5-1.
Attention: All applications need to disconnect from the database before the change becomes effective. After all applications are disconnected, the database is in backup pending state, and no new connections are allowed to the database until a full database backup is made.
Select the Control Database and click the Configure... database option and then click the Logs tab to display the Logs page.
150
Example 5-2 shows how you can use the DB2 command line interface to issue the update command.
Example 5-2 Update database configuration parameter to increase logging space
C:\SQLLIB\BIN>db2 update db cfg for tbc_md using logfilsiz 4096 logprimary 10 logsecond 100 DB20000I The UPDATE DATABASE CONFIGURATION command completed successfully. DB21026I For most configuration parameters, all applications must disconnect from this database before the changes become effective. C:\SQLLIB\BIN>
Or you can accomplish the same thing through the DB2 Control Center, as shown in Figure 5-1 on page 150.
151
152
2. Select a warehouse service, and click Stop. 3. Repeat this step for each warehouse service that is listed in the Services window. The warehouse logger and server are linked; if you stop the warehouse logger, the server also stops. However, if you stop the warehouse server, the logger does not stop. When all warehouse services are stopped, click Close. Before you can start a backup or recovery operation, make sure that the database manager is online. In the ...\sqllib\bin directory is an executable db2start.exe. This executable will start the database manager, if it is not running; or if it is running, it will indicate this, as shown in Example 5-3.
Example 5-3 db2start.exe
C:\SQLLIB\BIN>db2start SQL1026N The database manager is already active.
Another way to check is to see if the corresponding Windows service is running. With this method the Windows OS command net start will list the services running (see Example 5-4). Our instance is named DB2, so the corresponding Windows service is DB2 - DB2.
153
C:\SQLLIB\BIN>
In our example, a user is connected to our warehouse control database TBC_MD. You can use the following db2 force command (shown in Example 5-6) to force the user off: db2 force application ( 3 )
154
If there are too many connections to the database, use the following command to force all applications off the instance: db2 force application all
Attention: if you have multiple databases, this command will force off all applications from all databases within the same instance:
Now you can start the backup operation from the DB2 command line: db2 backup database tbc_md to c:\db2backup The to c:\db2backup option tells DB2 UDB to write the output backup file to a directory c:\db2backup. Wait until a message like Example 5-7 appears.
Example 5-7 Backup command
C:\SQLLIB\BIN>db2 backup database tbc_md to c:\db2backup Backup successful. The timestamp for this backup image is : 20011210150125 C:\SQLLIB\BIN>
The backup operation has created an image file of your warehouse control database, TBC_MD.
155
156
Select Media Type: Directories or Tapes. Next, click Backup Now to execute the backup. If there is a problem starting the backup, an error message will appear. Depending on the system where the DB2 Control Center was started, the following windows may differ slightly (Figure 5-5).
Note: The Close button must be selected to actually start the backup. If the window stays open, the backup will not start.
After the backup is finished, another window appears (Figure 5-6).
157
The DB2 Journal will provide additional information about the success of the backup, as shown in Figure 5-7. The DB2 Journal is in the Tools menu of the DB2 Control Center.
158
The backup operation created an image file of your warehouse control database, TBC_MD, in c:\db2backup directory.
159
3. Select the database you want to back up and right-click the database name and select Backup>Database, as shown in Figure 5-8.
160
The Backup Database window appears (Figure 5-9). Select Type: Directories or Tapes.
Click the Options tab and select Online, as shown in Figure 5-10.
161
Then click Backup Now to execute the backup. If there is a problem starting the backup, an error message will be generated. Depending on the system where the DB2 Control Center was started, the following windows may differ slightly (Figure 5-11).
The Close button must be clicked to actually start the backup. If the window stays open, the backup will not start. After the backup is finished, another window appears (Figure 5-12).
162
The DB2 Journal will provide additional information about the success of the backup, as shown in Figure 5-13.
163
The backup operation created an backup image file of the userspace1 tablespace in your warehouse control database and put it in c:\db2backup directory.
164
3. Select the folder of your warehouse control database, then click the tablespace on the expanded tree in the left frame, as shown in Figure 5-14. It displays all the tablespaces that belong to your warehouse control database in the right pane. Right-click the tablespace you want to back up.
165
The Backup Database window appears (Figure 5-15). Select Media Type: Directories or Tapes and the directory where you want to create the backup image file.
Figure 5-15 Select directories or tapes on the backup table space window
Click the Options tab and select the Online radio button, as shown in Figure 5-16.
166
Then click Backup Now to execute the backup. If there is a problem starting, the backup an error message will be generated. Depending on the system where the DB2 Control Center was started, the following windows may differ slightly (Figure 5-17).
You need to click the Close button to actually start the backup. If you leave the window open, the backup will not start. After the backup is finished, another window appears (Figure 5-18).
167
The DB2 Journal will provide additional information about the success of the backup, as shown in Figure 5-19. The DB2 Journal is in the Tools menu of the DB2 Control Center.
Figure 5-19 DB2 Journal shows the result of the tablespace backup
Full: This is a classical full database backup. Also known as level 0 backup. Incremental: This is a database backup that contains only the changes since the last full (level 0) database backup. Incremental backups are also known as level 1 backups. Delta: This is a database backup that contains only the changes since the last backup of every type (full, incremental or delta).
168
To enable the use of incremental backups, the DB2 database configuration parameter TRACKMOD must be set to on, as shown in Example 5-10. To activate this parameter, a db2stop and db2start may be necessary.
Example 5-10 Setting up TRACKMOD parameter ON using update command
C:\SQLLIB\BIN>db2 update db cfg for tbc_md using TRACKMOD ON DB20000I The UPDATE DATABASE CONFIGURATION command completed successfully. DB21026I For most configuration parameters, all applications must disconnect from this database before the changes become effective. C:\SQLLIB\BIN>
You have to take a full database backup before you start a chain of backups. This can be an offline or online backup, as shown in Example 5-11.
Example 5-11 A full backup before the first incremental backup
C:\SQLLIB\BIN>db2 backup db tbc_md online to c:\db2backup Backup successful. The timestamp for this backup image is : 20011211152529 C:\SQLLIB\BIN>
Now we are able to generate incremental or delta backups. To start an incremental backup, the incremental option of the backup command must be specified, as shown in Example 5-12.
Example 5-12 Incremental backup
C:\SQLLIB\BIN>db2 backup db tbc_md online incremental Backup successful. The timestamp for this backup image is : 20011211153137 C:\SQLLIB\BIN>
169
In Example 5-13, we ran the db2ckbkp against the two backup images. The second backup image file does not seem to be useable for recovery.
Example 5-13 Checking backup image files using db2ckbckp
C:\SQLLIB\BIN>db2ckbkp c:\db2backup\TBC_MD.0\DB2\NODE0000\CATN0000\20011211\1525 29.001 c:\db2backup\TBC_MD.0\DB2\NODE0000\CATN0000\20011210\162138.001 [1] Buffers processed: ##### [2] Buffers processed: ##### ERROR! More than one BACKUP.START.RECORD.MARKER! ERROR! More than one LIST.OF.DATA.POOLS! ERROR! More than one history file! ERROR! More than one DATA.POOL.TABLE! ERROR! More than one DB configuration! ERROR! More than one BUFFER.POOL.FILE! ERROR! More than one LOG.FILE.HEADER! ERROR! More than one backup tail! Image Verification Complete - ERRORS DETECTED: 8 C:\SQLLIB\BIN>
170
The interesting information is contained within the first line of each stanza. These lines show the Operation (Op:B=backup); the Object (Obj:P=Tablespace); the Type (Type:F=Offline,N=Online); and the Device (Dev:D=Directory). For an in-depth description of the db2 list history command, see the DB2 UDB Command Reference, SC09-2951.
To do a test, you would download the backup from the Tivoli Storage Manager server first and then would run db2adutl with extract option to see if the whole file is readable (see Example 5-16). However, this is not a very practical method.
Example 5-16 db2adutl extract
C:\SQLLIB\bin>db2adutl extract Query for database TBC_MD Retrieving full database backup information. Please wait. full database backup image: .\TBC_MD.0\DB2\NODE0000\CATN0000\20010328\113323.001, Node: 0 .\TBC_MD.0\DB2\NODE0000\CATN0000\20010328\113323.002, Node: 0 Do you wish to extract ALL of these images (Y/N)? y
171
The best way to verify the backup is to use the verify option of the db2adutl utility. It is basically a way to run the db2ckbkp functionality through Tivoli Storage Manager to verify if the image is restorable. The whole image will be read from the Tivoli Storage Manager server into local memory buffer, not to local disk, piece by piece instead of the whole image at once. db2adutl verify attempts to read through the image in the same way that a true restore does. It will verify that all of the required objects (such as, media header, DB configuration, DB history, list of tablespace, tablespace definitions, and so on) exist in the object (see Example 5-17). The tool performs numerous checks, but it will not and cannot actually check the integrity of the userdata that exists in the backup image.
Example 5-17 db2adutl verify
C:\SQLLIB\bin>db2adutl verify full taken at 20010328113323 db tbc_md Query for database TBC_MD Retrieving full database backup information. Please wait. full database backup image: .\TBC_MD.0\DB2\NODE0000\CATN0000\20010328\113323.001, Node: 0 .\TBC_MD.0\DB2\NODE0000\CATN0000\20010328\113323.002, Node: 0 Do you wish to verify this image (Y/N)? y Verifying file: .\TBC_MD.0\DB2\NODE0000\CATN0000\20010328\113323.001 ================== BUFFER 0 ================== ***BUFFERS 1 - 41 deleted to save space in this redbook.*** ================== BUFFER 42 ================== Read 0 bytes, assuming we are at the end of the image Image Verification Complete - successful. .\TBC_MD.0\DB2\NODE0000\CATN0000\20010328\113323.002 ================== BUFFER 0 ================== ***BUFFERS 1-42 deleted to save space in this redbook.***
172
================== BUFFER 43 ================== WARNING only partial image read, bytes read: 28672 of 4194304 Read 0 bytes, assuming we are at the end of the image Image Verification Complete - successful.
The warning message shown in Example 5-17 is misleading and can be ignored. The last line is the important one and it indicates that the verification was successful.
173
Example 5-19 shows how to schedule backups to run at every 8:00 AM in the morning using AT command.
Example 5-19 Scheduling backup using AT command
C:\SQLLIB\BIN>at 08:00 /every:M,T,W,Th,F,S,Su c:\scripts\bckpcdb.cmd Added a new job with job ID = 1 C:\SQLLIB\BIN>
If you type AT without specifying any parameters, you see the current scheduled jobs, as shown in Example 5-20.
Example 5-20 Displaying backup schedule
C:\SQLLIB\BIN>at Status ID Day Time Command Line ------------------------------------------------------------------------------1 Each M T W Th F S Su 8:00 AM c:\scripts\bckpcdb.cmd C:\SQLLIB\BIN>
174
Open the DB2 Control Center and click down the tree until reaching the database folder. Select the database to be backed up and right-click the database name and select Backup and Database, as shown in Figure 5-20.
175
Choose whether you want to do an online or offline, full or tablespace backup. After you make your selection, click the Schedule button, as shown in Figure 5-21.
176
This window is very useful. Click the desired actions when the backup should take place and for how long, and the backup should be started automatically. The userid and password are required and the userid must have enough privileges to do a backup. When you click the OK button, the DB2 UDB message window shown in Figure 5-23 confirms that the job has been scheduled.
177
To monitor the success of scheduled backups the DB2 Journal can be used. The DB2 Journal is located under the Tools Menu on the DB2 Control Center. Once started a window will open like the one in Figure 5-24.
The system name must be selected first. By clicking the corresponding button, information about the jobs that are already finished (Job History), running (Running Jobs) or are expected to run (Pending Jobs) will appear. In order to read all the information, resize the column by moving the border of the column description. To manage a job, the job must be highlighted. The possible options will be selectable either from the Jobs menu or by right-clicking on the highlighted job. Sometimes, you need to customize the DB2 commands or run a series of commands as a script or batch files. You can use the DB2 Script Center to create a script. This is located under the Tools menu of the DB2 Control Center. Figure 5-25 shows the DB2 Script Center, and the scripts available.
178
You can create a new script from the Scripts>New menu. Figure 5-26 shows a backup script using the buffers and parallelism option.
179
To schedule the script, highlight the entry in the Script Center, and right-click to display the drop-down menu, as shown in Figure 5-25 on page 179. You can then select Schedule to schedule the script.
180
2001-12-12-16.11.23.742000 Instance:DB2 Node:000 PID:1456(db2syscs.exe) TID:2076 Appid:*LOCAL.DB2.011213001106 buffer_pool_services sqlbStartPools Probe:30 Database:TBC_MD Tablespace DATASPACE1 (4) is in state x4000. Starting it failed. rc=1ec1 ffff
181
The command lists entries in the history file, which contain recovery events, such as backups, restore and roll-forward. It is also contains entries of additional events, such as load, run statistics, drop table, reorganize table, and alter tablespace. Use the list history command to select a backup image you want to use for the restore, as shown in Example 5-22, which also shows the results. There can be several entries, so you need to scroll to select the backup image you need. You need the timestamp portion of the Timestamp+Sequence field or you can use the value of the Start Time field.
Example 5-22 The list history command results
C:\SQLLIB\BIN>db2 list history backup all for tbc_md List History File for tbc_md Number of matching file entries = 2 Op Obj Timestamp+Sequence Type Dev Earliest Log Current Log Backup ID -- --- ------------------ ---- --- ------------ ------------ -------------B D 20011211153137001 O D S0000024.LOG S0000025.LOG ---------------------------------------------------------------------------Contains 4 tablespace(s): 00001 SYSCATSPACE 00002 USERSPACE1 00003 FLG32K 00004 DATASPACE1 ---------------------------------------------------------------------------Comment: DB2 BACKUP TBC_MD ONLINE Start Time: 20011211153137 End Time: 20011211153147 ---------------------------------------------------------------------------00001 Location: C:\SQLLIB\BIN\TBC_MD.0\DB2\NODE0000\CATN0000\20011211 Op Obj Timestamp+Sequence Type Dev Earliest Log Current Log Backup ID -- --- ------------------ ---- --- ------------ ------------ -------------B D 20011212134004001 N D S0000026.LOG S0000027.LOG ---------------------------------------------------------------------------Contains 4 tablespace(s): 00001 SYSCATSPACE 00002 USERSPACE1 00003 FLG32K 00004 DATASPACE1 ---------------------------------------------------------------------------Comment: DB2 BACKUP TBC_MD ONLINE Start Time: 20011212134004 End Time: 20011212134046 ---------------------------------------------------------------------------00002 Location: c:\db2backup\TBC_MD.0\DB2\NODE0000\CATN0000\20011212 C:\SQLLIB\BIN>
182
2. Use the restore command (see Example 5-23), specifying the timestamp of the image you want to restore, and then reply y to continue:
Example 5-23 Restoring the warehouse control database
C:\SQLLIB\BIN>db2 restore db tbc_md from c:\db2backup taken at 20011212134004 SQL2539W Warning! Restoring to an existing database that is the same as the backup image database. The database files will be deleted. Do you want to continue ? (y/n) y DB20000I The RESTORE DATABASE command completed successfully. C:\SQLLIB\BIN>
183
2. When the database image selection page appears, as shown in Figure 5-28, select the database image you want to use for the restore, then select OK.
The dialog box in Figure 5-29 appears to tell you that the restore job has been scheduled. Click the Close button to launch the execution of the job.
184
3. When the restore successfully completes, a DB2 message window appears, as shown in Figure 5-30, confirming that the restore was successful. Click Close.
185
= = = = =
= = = = =
= = = = =
In this case, you only need to recover the tablespace DATASPACE1 because all other tablespaces are in normal state.
186
187
Op Obj Timestamp+Sequence Type Dev Earliest Log Current Log Backup ID -- --- ------------------ ---- --- ------------ ------------ -------------R D 20011212162233001 F 20011212134004 ---------------------------------------------------------------------------Contains 4 tablespace(s): 00001 SYSCATSPACE 00002 USERSPACE1 00003 FLG32K 00004 DATASPACE1 ---------------------------------------------------------------------------Comment: RESTORE TBC_MD WITH RF Start Time: 20011212162233 End Time: 20011212162309 ---------------------------------------------------------------------------00003 Location: Op Obj Timestamp+Sequence Type Dev Earliest Log Current Log Backup ID -- --- ------------------ ---- --- ------------ ------------ -------------B P 20011213131258001 F D S0000028.LOG S0000028.LOG ---------------------------------------------------------------------------Contains 1 tablespace(s): 00001 DATASPACE1 ---------------------------------------------------------------------------Comment: DB2 BACKUP TBC_MD OFFLINE Start Time: 20011213131258 End Time: 20011213131321 ---------------------------------------------------------------------------00004 Location: C:\db2backup\TBC_MD.3\DB2\NODE0000\CATN0000\20011213
In this example, there are three database backups and one tablespace backup image. You are going to use only the tablespace backup image to recover the tablespace DATASPACE1. 2. Issue the restore command, as shown in Example 5-26, specifying the timestamp of the image file that you selected.
Example 5-26 Restore tablespace command
C:\SQLLIB\BIN>db2 restore db tbc_md tablespace ( dataspace1 ) online from c:\db2backup taken at 20011213131258 DB20000I The RESTORE DATABASE command completed successfully. C:\SQLLIB\BIN>
3. Now you issue a list tablespaces command again to check the state of DATASPACE1 and find it in rollforward pending state, as shown in Example 5-27.
188
= = = = =
= = = = =
= = = = =
C:\SQLLIB\BIN>
4. Use the rollforward command shown in Example 5-28 to apply the logs to completion.
189
As you can see in Example 5-29, the tablespace DATASPACE1 is now recovered and in normal state.
Example 5-29 List tablespaces command again
C:\SQLLIB\BIN>db2 list tablespaces Tablespaces for Current Database Tablespace ID = 0 Name = SYSCATSPACE Type = System managed space Contents = Any data State = 0x0000 Detailed explanation: Normal Tablespace ID Name Type Contents State Detailed explanation: Normal Tablespace ID Name Type Contents State Detailed explanation: Normal Tablespace ID Name Type Contents State = = = = = 1 TEMPSPACE1 System managed space System Temporary data 0x0000
190
Detailed explanation: Normal Tablespace ID Name Type Contents State Detailed explanation: Normal C:\SQLLIB\BIN> = 4 = DATASPACE1 = Database managed space = Any data = 0x0000
191
2. Right-click the database, and then from the drop-down menu select Restore>Database, as shown in Figure 5-32.
3. When the backup image selection window appears, as shown in Figure 5-33, select a backup image in the list. You choose the backup image for the tablespace DATASPACE1.
192
4. Next go on to the Table Spaces tab. You get the warning message shown Figure 5-34. You can ignore it and click Close.
193
5. Check the Use selected table spaces only. And then select DATASPACE1 and click the > button to move to Use table spaces panel (see Figure 5-35).
6. Then move on to the Roll-forward tab. Check the Roll-forward (reapply the logs) and the Roll-forward to the end of the logs option, and uncheck the Leave in roll-forward pending state option, as shown in Figure 5-36.
7. Go on to the Options tab, as shown in Figure 5-37, and select Online for an online restore. Select OK.
194
You are presented with the DB2 message window, as shown in Figure 5-38. Click Close to launch the execution of the job.
8. A DB2 message box appears, as shown in Figure 5-39, to notify you that the rollforward recovery was successful. Click Close.
195
9. Go back to the DB2 Control Center and click the Table Spaces under your warehouse control database. Refresh it and make sure that the tablespace DATASPACE1 is in normal state.
196
197
= = = = = = = = = = = = = =
2518 2518 2518 Not applicable Not applicable 4096 32 16 1 1 TEMPSPACE1 System managed space System Temporary data 0x0000
= = = = = = =
198
Prefetch size (pages) Number of containers Tablespace ID Name Type Contents State Detailed explanation: Normal Total pages Useable pages Used pages Free pages High water mark (pages) Page size (bytes) Extent size (pages) Prefetch size (pages) Number of containers Tablespace ID Name Type Contents State Detailed explanation: Normal Total pages Useable pages Used pages Free pages High water mark (pages) Page size (bytes) Extent size (pages) Prefetch size (pages) Number of containers Minimum recovery time Tablespace ID Name Type Contents State Detailed explanation: Normal Total pages Useable pages Used pages Free pages
= = = = = = = = = = = = = =
538 538 538 Not applicable Not applicable 4096 32 16 1 3 FLG32K System managed space Any data 0x0000
= = = = = = = = = = = = = = =
29 29 29 Not applicable Not applicable 4096 32 16 1 2001-12-12-20.40.19.000000 4 DATASPACE1 Database managed space Any data 0x0000
= = = =
199
High water mark (pages) Page size (bytes) Extent size (pages) Prefetch size (pages) Number of containers Minimum recovery time C:\SQLLIB\BIN>
= = = = = =
Note that the minimum recovery time of USERSPACE1 is 2001-12-12-20.40.19.000000. the timestamp is in Coordinated Universal Time (CUT) format. In this example, CUT is eight hours ahead of the local time. This means that you need to pick a time after 2001-12-12-12.40.19.000000 in local time. 2. Use the db2 list history command (see Example 5-31) to select a backup image that you want to use for the restore.
Example 5-31 The list history command results
C:\SQLLIB\BIN>db2 list history backup all for tbc_md List History File for tbc_md Number of matching file entries = 6 Op Obj Timestamp+Sequence Type Dev Earliest Log Current Log Backup ID -- --- ------------------ ---- --- ------------ ------------ -------------B D 20011211153137001 O D S0000024.LOG S0000025.LOG ---------------------------------------------------------------------------Contains 4 tablespace(s): 00001 SYSCATSPACE 00002 USERSPACE1 00003 FLG32K 00004 DATASPACE1 ---------------------------------------------------------------------------Comment: DB2 BACKUP TBC_MD ONLINE Start Time: 20011211153137 End Time: 20011211153147 ---------------------------------------------------------------------------00001 Location: C:\SQLLIB\BIN\TBC_MD.0\DB2\NODE0000\CATN0000\20011211 Op Obj Timestamp+Sequence Type Dev Earliest Log Current Log Backup ID -- --- ------------------ ---- --- ------------ ------------ -------------B D 20011212134004001 N D S0000026.LOG S0000027.LOG ---------------------------------------------------------------------------Contains 4 tablespace(s): 00001 SYSCATSPACE 00002 USERSPACE1 00003 FLG32K 00004 DATASPACE1 ----------------------------------------------------------------------------
200
Comment: DB2 BACKUP TBC_MD ONLINE Start Time: 20011212134004 End Time: 20011212134046 ---------------------------------------------------------------------------00002 Location: c:\db2backup\TBC_MD.0\DB2\NODE0000\CATN0000\20011212 Op Obj Timestamp+Sequence Type Dev Earliest Log Current Log Backup ID -- --- ------------------ ---- --- ------------ ------------ -------------R D 20011212162233001 F 20011212134004 ---------------------------------------------------------------------------Contains 4 tablespace(s): 00001 SYSCATSPACE 00002 USERSPACE1 00003 FLG32K 00004 DATASPACE1 ---------------------------------------------------------------------------Comment: RESTORE TBC_MD WITH RF Start Time: 20011212162233 End Time: 20011212162309 ---------------------------------------------------------------------------00003 Location: Op Obj Timestamp+Sequence Type Dev Earliest Log Current Log Backup ID -- --- ------------------ ---- --- ------------ ------------ -------------B P 20011213131258001 F D S0000028.LOG S0000028.LOG ---------------------------------------------------------------------------Contains 1 tablespace(s): 00001 DATASPACE1 ---------------------------------------------------------------------------Comment: DB2 BACKUP TBC_MD OFFLINE Start Time: 20011213131258 End Time: 20011213131321 ---------------------------------------------------------------------------00004 Location: C:\db2backup\TBC_MD.3\DB2\NODE0000\CATN0000\20011213 Op Obj Timestamp+Sequence Type Dev Earliest Log Current Log Backup ID -- --- ------------------ ---- --- ------------ ------------ -------------B P 20011213131258001 F D S0000028.LOG S0000028.LOG ---------------------------------------------------------------------------Contains 1 tablespace(s): 00001 DATASPACE1 ---------------------------------------------------------------------------Comment: DB2 BACKUP TBC_MD OFFLINE Start Time: 20011213131258 End Time: 20011213131321 ---------------------------------------------------------------------------00005 Location: C:\db2backup\TBC_MD.3\DB2\NODE0000\CATN0000\20011213 Op Obj Timestamp+Sequence Type Dev Earliest Log Current Log Backup ID
201
-- --- ------------------ ---- --- ------------ ------------ -------------B D 20011213193727001 F D S0000030.LOG S0000030.LOG ---------------------------------------------------------------------------Contains 4 tablespace(s): 00001 SYSCATSPACE 00002 USERSPACE1 00003 FLG32K 00004 DATASPACE1 ---------------------------------------------------------------------------Comment: DB2 BACKUP TBC_MD OFFLINE Start Time: 20011213193727 End Time: 20011213193810 ---------------------------------------------------------------------------00006 Location: C:\db2backup\TBC_MD.0\DB2\NODE0000\CATN0000\20011213 C:\SQLLIB\BIN>
3. Issue the db2 restore command, specifying the timestamp of the backup image, as shown in Example 5-32.
Example 5-32 Restore using the last backup image
C:\SQLLIB\BIN>db2 restore db tbc_md tablespace (userspace1) online from c:\db2backup taken at 20011213193727 DB20000I The RESTORE DATABASE command completed successfully. C:\SQLLIB\BIN>
4. Use the db2 rollforward command to apply the logs. Let us assume that you deleted the Data Warehouse Process object before 2001-12-13-19.41.00 and you decided to select 2001-12-13-19.40.00 in local time as the recovery time. Specify the point-in-time in CUT format, and it is past the minimum recovery time, as shown in Example 5-33.
Example 5-33 Rollforward to a point-in-time past the minimum recovery time
C:\SQLLIB\BIN>db2 rollforward db tbc_md to 2001-12-14-03.40.00 tablespace (users pace1) online Rollforward Status Input database alias Number of nodes have returned status Node number Rollforward status Next log file to be read Log files processed Last committed transaction = tbc_md = 1 = 0 = TBS working = = = 2001-12-12-21.40.45.000000
202
5. Notice that you did not do a rollforward stop on the previous command. So issue another rollforward command specifying stop, as shown in Example 5-34.
Example 5-34 Rollforward stop command
C:\SQLLIB\BIN>db2 rollforward db tbc_md stop tablespace (userspace1) online Rollforward Status Input database alias Number of nodes have returned status Node number Rollforward status Next log file to be read Log files processed Last committed transaction = tbc_md = 1 = = = = = 0 not pending S0000032.LOG 2001-12-12-21.40.45.000000
6. Finally, take a backup of the USERSPACE1 to clear the backup pending state.
Example 5-36 Tablespace backup
C:\SQLLIB\BIN>db2 backup db tbc_md tablespace (userspace1) online to c:\db2backup Backup successful. The timestamp for this backup image is : 20011213202234 C:\SQLLIB\BIN>
203
204
2. When the backup image selection window appears, as shown in Figure 5-42, select a backup image in the list. This can be a backup image or a tablespace image.
205
3. If you select a database backup image, on the Table Spaces tab, you can select which tablespaces you want to restore, as shown in Figure 5-43. In this example, all the warehouse control database tables reside in USERSPACE1.
4. On the Roll-forward tab, as shown in Figure 5-44, check the Roll-forward (re-apply logs) option, select Roll-forward to a point-in-time, enter the date and time in the Roll-forward to transaction fields, and uncheck the Leave in roll-forward pending state option.
206
5. Go to the Options tab, as shown in Figure 5-45, and select Online for an online restore. Select OK. After completion, a DB2 message box is presented to tell you whether or not the rollforward is successful.
6. Finally take a backup of the database or the tablespace to get it out of the backup pending state.
207
2. Using the tablespace ID, list the containers for DATASPACE1, as shown in Example 5-38.
Example 5-38 List containers for DATASPACE1
C:\SQLLIB\BIN>db2 list tablespace containers for 4 show detail Tablespace Containers for Tablespace 4 Container ID = 0 Name = C:\SW-N100\TBC_MD\DATASPACE1-1.DAT Type = File Total pages = 512 Useable pages = 480 Accessible = Yes Container ID = 1 Name = C:\SW-N100\TBC_MD\DATASPACE1-2.DAT Type = File Total pages = 5120 Useable pages = 5088 Accessible = Yes C:\SQLLIB\BIN>
You see two containers assigned to the DATASPACE1. You decide that the second container is too big and want to reduce the size of containers to 1280 pages in total. 3. Use the restore command with the redirect option, specifying the DATASPACE1 to be restored and the timestamp of the image you want to use for the restore.
208
4. Issue the command set tablespace containers to resize the container for tablespace ID 4, as shown in Example 5-40. The command ignore rollforward container operations means that the ALTER TABLESPACE operations in the logs will be ignored during the roll-forward.
Example 5-40 Set tablespace containers command
C:\SQLLIB\BIN>db2 set tablespace containers for 4 ignore rollforward container operations using (file 'C:\SW-N100\TBC_MD\dataspace1-3.dat' 1280) DB20000I The SET TABLESPACE CONTAINERS command completed successfully. C:\SQLLIB\BIN>
5. Continue the restore with the continue option, as shown in Example 5-41.
Example 5-41 Restore continue command
C:\SQLLIB\BIN>db2 restore db tbc_md continue DB20000I The RESTORE DATABASE command completed successfully. C:\SQLLIB\BIN>
Node number = 0 Rollforward status = not pending Next log file to be read = S0000034.LOG Log files processed = Last committed transaction = 2001-12-14-04.40.51.000000 DB20000I The ROLLFORWARD command completed successfully. C:\SQLLIB\BIN>
209
7. The following list tablespace containers command confirms that the resizing of DATASPACE1 to 1280 pages was successful completed.
Example 5-43 List tablespace containers for DATASPACE1
C:\SQLLIB\BIN>db2 list tablespace containers for 4 show detail Tablespace Containers for Tablespace 4 Container ID Name Type Total pages Useable pages Accessible C:\SQLLIB\BIN> = = = = = = 0 C:\SW-N100\TBC_MD\dataspace1-3.dat File 1280 1248 Yes
210
211
2. When the backup image selection window appears, as shown in Figure 5-47, select the database image you want to use for the restore, and then click the Table Spaces tab.
3. On the Table Spaces window, as shown in Figure 5-48, click the Use selected tablespaces only radio button, select DATASPACE1, click the > button, and then select the Containers tab.
212
4. On the Containers page, when you check the Redirect table space containers, and it displays the list of containers for the tablespace, as shown in Figure 5-49, highlight the container on the lower frame, and then click the Change button.
213
5. A Change Container window appears, as shown in Figure 5-50. Change the file size, and then select OK.
6. You are now back to the Container page, as shown previously in Figure 5-49 on page 213. Select the Roll-forward tab. Check the Roll-forward (re-apply logs) option, uncheck the Leave in roll-forward pending state option, as shown in Figure 5-51. And then select the Options tab.
214
7. On the Options window, as shown in Figure 5-52, select Online if you want to do recovery online. Select OK when done.
8. A DB2 message window appears to tell you that the tablespace redirected restore is successful.
215
To determine if a table space is enabled for dropped table recovery, you can query the DROP_RECOVERY column in the SYSCAT.TABLESPACES catalog table, as shown in Example 5-45.
Example 5-45 Checking to see if the dropped table recovery is enabled
C:\SQLLIB\BIN>db2 select tbspace, drop_recovery from syscat.tablespaces where tbspace='USERSPACE1' TBSPACE DROP_RECOVERY ------------------ ------------USERSPACE1 Y 1 record(s) selected. C:\SQLLIB\BIN>
When a DROP TABLE statement is run against a table whose table space is enabled for dropped table recovery, an additional entry (identifying the dropped table) is made in the log files. An entry is also made in the recovery history file, containing information that can be used to recreate the table. (See Figure 5-53.)
216
Figure 5-53 Additional information written in Log and Recovery History FIle
Only one dropped table can be recovered at a time. You can recover a dropped table by doing the following: 1. Identify the dropped table by invoking the db2 list history dropped table command (see Example 5-46). The dropped table ID is listed in the Backup ID column.
Example 5-46 List history dropped table
C:\SQLLIB\BIN>db2 list history dropped table all for tbc_md List History File for tbc_md Number of matching file entries = 1 Op Obj Timestamp+Sequence Type Dev Earliest Log Current Log Backup ID -- --- ------------------ ---- --- ------------ ------------ -------------D T 20011214133215 00000000000079180002002d ---------------------------------------------------------------------------"IWH "."DATARESOURCE" resides in 1 tablespace(s): 00001 USERSPACE1 ---------------------------------------------------------------------------Comment: DROP TABLE Start Time: 20011214133215 End Time: 20011214133215 ---------------------------------------------------------------------------00001 DDL: CREATE TABLE "IWH "."DATARESOURCE" ( "IWHID" CHAR(10) NOT NULL , "UPDA TED_BY" CHAR(128) NOT NULL , "UPDATE_TS" TIMESTAMP NOT NULL , "NAME" VARCHAR(80) NOT NULL , "SHORT_DESCRIPTION" VARCHAR(254) , "IRNAME" VARCHAR(80) NOT NULL , " FILETYPE" VARCHAR(80) NOT NULL , "KEYLOC" INTEGER NOT NULL , "KEYLEN" INTEGER NO T NULL , "RECLEN" INTEGER NOT NULL , "PCBIND" INTEGER NOT NULL , "MAXSEGLEN" INT EGER NOT NULL , "BLOCKSIZE" INTEGER NOT NULL , "CREATED" TIMESTAMP , "TYPEOFCREA TION" VARCHAR(90) NOT NULL , "PASSWORD" VARCHAR(8) NOT NULL , "DB2TABLENAMESPACE " VARCHAR(90) NOT NULL , "BINARYFLAG" SMALLINT , "KSDSFLAG" SMALLINT , "FIRSTLIN ENAMES" SMALLINT , "CHARDELM" VARCHAR(1) NOT NULL , "VIEWFLAG" SMALLINT , "ALIAS FLAG" SMALLINT , "LARGESCHEMANAME" VARCHAR(128) NOT NULL , "LARGETABLENAME" VARC HAR(255) NOT NULL , "PERSISTENTFLAG" SMALLINT , "MAX_EDITIONS" INTEGER , "GRANTT OPUBLIC" SMALLINT , "LASTCOLSEQNMCREATE" INTEGER , "LASTCOLSEQNMALTER" INTEGER , "CREATETARTAB" SMALLINT , "PRIMARYKEYNEW" SMALLINT , "AUTOGENCREATESTMT" SMALLI NT , "TABLECREATED" SMALLINT , "DIMENSION_TABLE" SMALLINT , "FACT_TABLE" SMALLIN T , "CDTABLENAME" VARCHAR(128) , "CDTABLESCHEMA" VARCHAR(128) , "BEFORE_IMG_PREF IX" VARCHAR(4) , "REPL_ENABLED" SMALLINT , "DB2TABLENAMEINDEX" VARCHAR(90) NOT N
217
ULL , "INPARTTBSP" SMALLINT , "DBNAME390" VARCHAR(8) , "HIGHESTSTATUS" INTEGER N OT NULL , "DATAIMPORTFLAG" SMALLINT , "DATAIMPORTID" INTEGER , "SITEID" INTEGER ) IN "USERSPACE1" ; ---------------------------------------------------------------------------C:\SQLLIB\BIN>
2. Restore a database or table space level backup image taken before the table was dropped, as shown in Example 5-47.
Example 5-47 Restore from backup taken before the drop
C:\SQLLIB\BIN>db2 restore db tbc_md tablespace (userspace1) online from c:\db2backup taken at 20011213202234 DB20000I The RESTORE DATABASE command completed successfully. C:\SQLLIB\BIN>
3. Create an export directory to which files containing the table data are to be written. This directory must either be accessible to all database partitions, or exist on each partition. Subdirectories under this export directory are created automatically by each database partition. These subdirectories are named NODE nnnn, where nnnn represents the database partition or node number. Data files containing the dropped table data as it existed on each database partition are exported to a lower subdirectory called data. For example, \export_directory \NODE0000 \data. As shown In Example 5-48, we use an existing directory c:\db2backup. 4. Roll forward to a point-in-time after the table was dropped, using the RECOVER DROPPED TABLE option on the db2 rollforward command. Alternatively, roll forward to the end of the logs, so that updates to other tables in the table space or database are not lost.
Example 5-48 Rollforward with Recover Dropped Table option
C:\SQLLIB\BIN>db2 rollforward db tbc_md to end of logs and stop tablespace (userspace1) online recover dropped table 00000000000079180002002d to c:\db2backup Rollforward Status Input database alias = tbc_md Number of nodes have returned status = 1 Node number = 0 Rollforward status = not pending Next log file to be read = S0000036.LOG Log files processed = Last committed transaction = 2001-12-14-21.32.16.000000 DB20000I The ROLLFORWARD command completed successfully. C:\SQLLIB\BIN>
218
5. Recreate the table using the CREATE TABLE statement from the recovery history file (see Example 5-49).
Example 5-49 Redefine the table
C:\SQLLIB\BIN>db2 CREATE TABLE "IWH "."DATARESOURCE" ( "IWHID" CHAR(10) NOT NULL , "UPDATED_BY" CHAR(128) NOT NULL , "UPDATE_TS" TIMESTAMP NOT NULL , "NAME" VARCHAR(80) NOT NULL , "SHORT_DESCRIPTION" VARCHAR(254) , "IRNAME" VARCHAR(80) NOT NULL , "FILETYPE" VARCHAR(80) NOT NULL , "KEYLOC" INTEGER NOT NULL , "KEYLE N" INTEGER NOT NULL , "RECLEN" INTEGER NOT NULL , "PCBIND" INTEGER NOT NULL , "M AXSEGLEN" INTEGER NOT NULL , "BLOCKSIZE" INTEGER NOT NULL , "CREATED" TIMESTAMP , "TYPEOFCREATION" VARCHAR(90) NOT NULL , "PASSWORD" VARCHAR(8) NOT NULL , "DB2T ABLENAMESPACE" VARCHAR(90) NOT NULL , "BINARYFLAG" SMALLINT , "KSDSFLAG" SMALLIN T , "FIRSTLINENAMES" SMALLINT , "CHARDELM" VARCHAR(1) NOT NULL , "VIEWFLAG" SMAL LINT , "ALIASFLAG" SMALLINT , "LARGESCHEMANAME" VARCHAR(128) NOT NULL , "LARGETA BLENAME" VARCHAR(255) NOT NULL , "PERSISTENTFLAG" SMALLINT , "MAX_EDITIONS" INTE GER , "GRANTTOPUBLIC" SMALLINT , "LASTCOLSEQNMCREATE" INTEGER , "LASTCOLSEQNMALT ER" INTEGER , "CREATETARTAB" SMALLINT , "PRIMARYKEYNEW" SMALLINT , "AUTOGENCREAT ESTMT" SMALLINT , "TABLECREATED" SMALLINT , "DIMENSION_TABLE" SMALLINT , "FACT_T ABLE" SMALLINT , "CDTABLENAME" VARCHAR(128) , "CDTABLESCHEMA" VARCHAR(128) , "BE FORE_IMG_PREFIX" VARCHAR(4) , "REPL_ENABLED" SMALLINT , "DB2TABLENAMEINDEX" VARC HAR(90) NOT NULL , "INPARTTBSP" SMALLINT , "DBNAME390" VARCHAR(8) , "HIGHESTSTAT US" INTEGER NOT NULL , "DATAIMPORTFLAG" SMALLINT , "DATAIMPORTID" INTEGER , "SIT EID" INTEGER) IN "USERSPACE1" DB20000I The SQL command completed successfully. C:\SQLLIB\BIN>
6. Import the table data that was exported during the rollforward operation into the table. There are some restrictions on the type of data that is recoverable from a dropped table. It is not possible to recover: Large object (LOB) or long field data. The DROPPED TABLE RECOVERY option is not supported for long table spaces. If you attempt to recover a dropped table that contains LOB or LONG VARCHAR columns, these columns will be set to NULL in the generated export file. The DROPPED TABLE RECOVERY option can only be used for regular table spaces, not for temporary or long table spaces. The metadata associated with row types. (The data is recovered, but not the metadata.) The data in the hierarchy table of the typed table will be recovered. This data may contain more information than appeared in the typed table that was dropped.
5.4.6 Restoring your control database into a new DB2 UDB instance
Sometimes you might want to create another warehouse control database for testing purposes. Or you might want to have a standby warehouse control database which serves as a quick backup, in case the original warehouse control database gets corrupted to the extent that the recovery is expected to take quite a long time.
219
In this section, we discuss how to restore your warehouse control database that was backed up on another instance as a new database. The target instance can be on the same system or on another system. These are the steps to follow: 1. Create new target DB2 UDB database. The target database must be created first. Any containers and required disk space for the database must also be available before the restore. If the logfiles are also to be restored, then the new target database name must be the same as that of the original database. Otherwise, the newly created database name can be different. Use a CREATE DATABASE statement, as shown in Example 5-50, to create a database.
Example 5-50 Create a database
C:\SQLLIB\BIN>db2 create database tbc_md2 DB20000I The CREATE DATABASE command completed successfully. C:\SQLLIB\BIN>
2. Update the new database configuration. Use the db2 update database configuration command to change the parameter values from the default to the copying warehouse control database values. 3. Restore the database. Select the database to restore, and use a restore command to restore the database. In our example, we restore a database image from database TBC_MD to database TBC_MD2, as shown in Example 5-51.
Example 5-51 Restore into a new database
C:\SQLLIB\BIN>db2 restore db tbc_md from c:\db2backup taken at 20011213193727 into tbc_md2 SQL2529W Warning! Restoring to an existing database that is different from the backup image database, and the alias name "TBC_MD2" of the existing database does not match the alias name "TBC_MD" of the backup image, and the database name "TBC_MD2" of the existing database does not match the database name "TBC_MD" of the backup image. The target database will be overwritten by the backup version. The Roll-forward recovery logs associated with the target database will be deleted. Do you want to continue ? (y/n) y DB20000I The RESTORE DATABASE command completed successfully.
220
Now you have a new warehouse control database created by restoring a backup image file taken from your existing warehouse control database.
221
Before you finish up the restore by running a rollforward, you realized that you should have used the latest backup image which was taken at 20011217101537. In order for you to be able to restart the restore with the latest backup image, you first have to cancel the current restore, as shown in Example 5-55.
Example 5-55 Rollforward cancel to use different backup image
C:\SQLLIB\BIN>db2 rollforward db tbc_md cancel tablespace (userspace1) SQL4975W Roll-forward operation was cancelled successfully. The database or selected table spaces have to be restored on node(s) "0".
The tablespace that was previously restored will be placed in a restore pending state, as shown in Example 5-56.
Example 5-56 USERSPACE1 is in restore pending
C:\SQLLIB\BIN>db2 list tablespaces Tablespaces for Current Database Tablespace ID Name Type Contents State Detailed explanation: Restore pending = = = = = 2 USERSPACE1 System managed space Any data 0x0100
You can now restart the restoring the tablespace USERSPACE1 by using the backup image taken at 20011217101537 (see Example 5-57), so that the tablespace that was previously in a restore pending state will be in a rollforward pending state.
222
Run a rollforward, as shown in Example 5-58, to apply logs and finish up the recovery of the tablespace.
Example 5-58 Rollforward to end of logs
C:\SQLLIB\BIN>db2 rollforward db tbc_md to end of logs and stop tablespace (userspace1) Rollforward Status Input database alias = tbc_md Number of nodes have returned status = 1 Node number = 0 Rollforward status = not pending Next log file to be read = S0000040.LOG Log files processed = Last committed transaction = 2001-12-17-18.16.02.000000 DB20000I The ROLLFORWARD command completed successfully.
The database will not be in a rollforward pending state most of the time if you use this option. You can query the rollforward state, as shown in Example 5-60.
223
This does not work all the time. Sometimes, DB2 UDB still puts it in rollforward pending state. To remove the rollforward pending state, stop the rollforward, as shown in Example 5-61.
Example 5-61 Rollforward with stop
C:\SQLLIB\BIN>db2 rollforward db tbc_md stop Rollforward Status Input database alias = tbc_md Number of nodes have returned status = 1 Node number = 0 Rollforward status = not pending Next log file to be read = Log files processed = Last committed transaction = 2001-12-17-18.16.02.000000 DB20000I The ROLLFORWARD command completed successfully.
224
Export processes and import processes use a large amount of system resources. You might want to limit the use of other programs while you are exporting and importing object definitions. Because the import and export formats are release-dependent, you cannot use exported files from a previous release to migrate from one release of the Data Warehouse Center to another. If you want to migrate the Data Warehouse Center, see the DB2 Universal Database Quick Beginnings for your operating system. Alternatively, if you want to make a copy of your warehouse control database (such as when you want separate test and production systems), you can use the DB2 UDB export and load utilities to copy the data. However, both databases must have a user ID and password that matches the default warehouse user, so that users can log on to the Data Warehouse Center.
225
Importing metadata
You can import object definitions for use in your Data Warehouse Center system. When you import a tag language file, the metadata that it contains is stored in the warehouse control database. If you are using the import utility to establish a new Data Warehouse Center, you must initialize a new warehouse control database in the target system. After you complete this task, you can import as many tag language files as you want. After you complete the export process, and a tag language file is created, the file is ready to import to a target system. Before you the import the file, consider the following issues:
Naming considerations: If you are using the import utility to move a warehouse source from a test environment to a production environment, make sure that the production environment does not already have a warehouse source with the same warehouse source name unless you want to over write the definition of the warehouse source.
If you import a step into a system that contains a step with the same name, then you must either delete the step that you want to overwrite, or change the step to development mode. Otherwise, the step cannot be updated, and an error will occur.
Ordering the import of objects: You use a logical order to import objects. An object that is referred to but not defined in a tag language file must be defined in the destination warehouse control database. You can do this by first importing the object definition that is referred to in a separate tag language file, or you can define the object in the Data Warehouse Center tree view.
For example, you can import warehouse source definitions first. When the warehouse source definitions are ready for use, you can import subject areas, warehouse target definitions, and any corresponding steps individually.
Other considerations: If you move a tag language file from one system to another, you must move all the associated files along with it and they must reside in the same directory.
Do not use the import function to migrate from a previous version of the Data Warehouse Center. You must always import and export tag language files using the same version of the Data Warehouse Center.
226
227
In addition, the import utility maintains a list of processed objects that it uses to retrieve objects when processing relationships. As the number of objects on this list increases, performance is impacted. Here are some recommendations to improve performance: Use multiple small tag language files instead of one large file. Tag language files smaller than 5 MB are recommended. Tag language files larger than 10 MB are prohibitive. Run import in a maintenance window when no other applications are using the machine. Stop the warehouse server and warehouse logger services and run the import utility from the DB2 command line. For more information about this, on the DB2 command line, enter: iwh2imp2. Increase the virtual memory on the machine where the import is running. A minimum of 200 MB to 300 MB is recommended. Make sure that the application heapsize parameter (APPLHEAP) for the warehouse control database is set at 4096 as a minimum. Use the RUNSTATS, REORG TABLE, and REORGCHK commands against your warehouse control database and the tables within it.
228
Chapter 6.
229
230
Problem fixing: Correcting a user error Installing DB2 Warehouse Manager fixpacks or patches Looking at the specific problem areas.
231
How to start?
PROBLEM DETERMINATION
Understand WM Architecture
Warehouse client location Warehouse Server location Agent location Target DB location
CLI, Server traces (Level 5) Agent logs, Msg queue trace, VWP and transformer traces CLI, ODBC traces
No Yes
User error?
OS error?
No
Area of failure identified?
Yes
Yes
No
PROBLEM FIXING
Server failure
Database issues
Network failure
Solv e is su es : E rror symptom Process does not complete in the ex pected time
Restart from commun ication s errors betw een: Serv er, Agen t, Sou rce, Target
232
Read the DWC error messages from DB2 Information Center Yes
Cor re ct a nd r es tar t
233
For example, the user gets the error message in Figure 6-3 when they try to run a warehouse step which may be used to populate a target table or to run a transformer.
A detailed log of the execution of each step is maintained, so if a step failed, this would be the first place to look for troubleshooting: 1. Right-click the failure step, then select Show Log to get the log screen. 2. Locate the first occurrence of the Run Time Error, then right-click, and select Show Details to obtain additional information on the failure.
234
Here are the various steps to follow: 1. Go to the Help MenuBar and open Information Center (Figure 6-4).
235
236
4. Double-click DB2 Messages, which opens a Web browser on your system. 5. In the Contents page in the left-hand side, click Data Warehouse Center Message. Place the mouse cursor in the right side frame in the browser and then press the Ctrl-F key. 6. This opens a Find window. Type the 4-digit return code and click the Find Next button (Figure 6-7).
237
7. The search result should take you to the appropriate error message reference (Figure 6-8).
238
Remember that the secondary return code (RC2) may display an error number that is returned by the operating system. This gives a better idea of what error actually occurred within the cover. It is clear from the RC1 and RC2 messages in Figure 6-3 on page 234 that either the warehouse agent is not running on the agent system, or something to do with IP sockets has been set up incorrectly, probably on the agent side. The first message says that warehouse server could not establish communication with the agent daemon; the second said it was an error, something to do with sockets. The next step for the user should be to log on to the server, where the warehouse agent is installed, and verify if the agent daemon is up and running At that point, you may also contact the IBM Support Center to receive assistance. You may try, with their help, to recreate the problem, run commands, collect trace data, perform tests, or take whatever steps are suitable to pinpoint what is not working.
239
The warehouse agent receives a command from the warehouse server in the form of agent messages, executes them, and then returns a reply to the warehouse server. The warehouse agent process is controlled by the warehouse server process and works as a conduit for data flow between the warehouse source and target databases (see Figure 6-9).
Agent Site
Agent
SQL SELECT
Source Site
SQL SELECT
Data
DDD Editions
ODBC Driver
Data
Source Database
Control Database
Target Database
SQL INSERT
Data
Warehouse Server
Schedules wake up Reads Step definition from Control Database Starts Agent (through Agent Daemon) Receives and logs result (update operational metadata)
Agent
Acknowledges to Warehouse Server Logic: - Receive command - Execute command - Report status
The warehouse agent can also issue system commands and run user defined programs on the machine which it resides. The warehouse agent can be local or remote. A warehouse agent that runs on an agent machine which is the same as warehouse server is called the local agent. The remote agent is an agent machine that is different from the warehouse server. The important difference between the two agents is that the local agent processes are started by the warehouse server; whereas the remote agent processes are started by an agent daemon. The agent daemon is a continuously running process which listens for agent start or kill requests from the warehouse server, and it is responsible for starting warehouse agent processes on a remote agent machine. It also has capability to forcibly kill a warehouse agent process if the warehouse agent ceases to respond to the warehouse server request.
240
To summarize the event, let us see who does what: 1. The agent daemon starts at the agent machine, listening at port 11001. 2. The warehouse server sends a request to the agent daemon. 3. The agent daemon creates a warehouse agent process listening at a new port, and the warehouse agent responds to the warehouse server with the port number at which it is listening. 4. The warehouse server sends request to the warehouse agent process. 5. The warehouse agent process handles the request and returns the results to the warehouse server. It handles the commit/rollback based on the data movements success. 6. The warehouse agent process tells the warehouse server it is done and goes away.
241
CLI, Server traces (Level 5) Agent logs, Msg queue trace, VWP and transformer traces CLI, ODBC traces
Target DB location
PROBLEM FIXING
242
For example, if we take the previously described problem, where the warehouse server was unable to send a request to the agent daemon to spawn a warehouse agent process, then we know that a warehouse agent trace would not be likely to yield any relevant information (because no warehouse agent got spawned). We do know that a warehouse server trace would be likely to show that it is sending a request and getting an error back, so this would be a good piece of information to collect. We also know from the messages that an inspection of the TCP/IP definitions at the server and remote ends would provide some relevant information too. This section shows the source of information that DB2 Warehouse Manager provides through Data Warehouse Center traces and logs (see Figure 6-11) that is helpful in problem determination phase.
DWC Tracing
Clients
Warehouse Server
Warehouse Agents
Databases
Control Center
DB2 Target
CC Trace
O D B C T R A C E
Relational Source
T R A C E
NonRelational Source
non-DB2 Target
Typ titl e e
. 1Typeext t
Flat Files
243
The following logs or traces are available and are described in this section: Warehouse client location CC Trace or Control Center trace Warehouse server location CLI traces Warehouse server traces Agent site locations Agent logs Message queue traces UDP traces ODBC connectivity traces Connector traces
b. Check the box Add Tools Tracing to DB2 Trace, as shown in Figure 6-13.
244
2. Optionally, you can also use DB2 command line to start the Control Center trace. Type: db2cc -tf <filename> The trace written in the file may not be formatted. A trace formatting utility is provided in DB2. To run this utility, open a command line window. Change the directory to SQLLIB/CC and run this command: jre TraceFormatter <infile> <outfile>
245
The formatted trace output may look like that shown in Figure 6-14.
CC
Thread name
05/2/00 7:42 AM |CC:run() - entry 5/2/00 7:42 AM ||CC:construct(localhost,6790) - entry 5/2/00 7:42 AM |||CommonImageRepository:CommonImageRepository(TreeNav) - entry 5/2/00 7:42 AM |||CommonImageRepository:CommonImageRepository(TreeNav) - return() 5/2/00 7:42 AM |||CommonImageRepository:CommonImageRepository(TreeNav) - entry 5/2/00 7:42 AM |||CommonImageRepository:CommonImageRepository(TreeNav) - return() 5/2/00 7:42 AM |||ImageRepository:ImageRepository(TreeNav) - entry 5/2/00 7:42 AM |||ImageRepository:ImageRepository(TreeNav) - return() 5/2/00 7:42 AM |||CC:initialize(localhost,6790) - entry 5/2/00 7:42 AM ||||CC:initializeWebccServer(hostname,port,parent) - entry 5/2/00 7:42 AM |||||AdminConnection:AdminConnection - entry 5/2/00 7:42 AM ||||||AdminConnection_App:AdminConnection_App(connection) - entry 5/2/00 7:42 AM |||||||CCServerDriver:getConnection() - entry 5/2/00 7:42 AM |||||||CCServerDriver:getConnection() - return(Handle=0 rc=0) 5/2/00 7:42 AM ||||||AdminConnection_App:AdminConnection_App(connection) - return() 5/2/00 7:42 AM ||||||AdminConnection:openConnection() - entry 5/2/00 7:42 AM |||||||JDBC_CC_ExtensionsDriver:call(mid) - entry 5/2/00 7:42 AM ||||||||JDBC_CC_ExtensionsDriver:call(mid,msg,retry,true) - entry 5/2/00 7:42 AM |||||||||JDBC_CC_ExtensionsDriver:runRequest() - entry
Classname
246
To get the CLI trace for the warehouse control database, follow these steps: 1. Shut down all applications to the warehouse control database. 2. Open the DB2 command line processor and connect to the warehouse control database. 3. Type the command: DB2 UPDATE CLI CFG FOR SECTION COMMON USING TRACE 1 TRACEPATHNAME <filename> TRACEFLUSH 1 and press Enter. 4. Restart the DB2 services from the Windows Control Panel - Services. 5. Recreate the problem. To stop the CLI trace, follow these steps: 1. Shut down DB2 services and client. 2. Open the DB2 command line processor and connect to the warehouse control database. 3. Type the command: 4. DB2 UPDATE CLI CFG FOR SECTION COMMON USING TRACE NULL TRACEPATHNAME NULL TRACEFLUSH NULL and press Enter.
Level 1: The level 1 warehouse server trace provides the entry and exit point of a function in the application code. Level 2: The level 2 trace warehouse server provides level 1 trace and some extra warning and error information. Level 3: The level 3 warehouse server trace shows level 2 information and add SQL statements and parameter substitution. Level 4: The level 4 warehouse server trace shows level 3 information and adds the command list execution.
247
There is a level 5 trace which is not documented and can only be set at the DB2 command line window. This level of trace displays the contents of data and communication buffers and may be very useful in isolating problems like user data error or memory errors. This trace should be set up exceptionally if required by IBM Support and should be administered under IBM Support assistance.
Agent logs
The agent log shows all the information that is passed to the warehouse agent from the warehouse server and the command steps that are completed. For example, the agent log shows information such as these activities: Connect to target database Fetch and Insert statements SQL execute statements with parameter substitutions The file AGNTxxxx.LOG contains tracing information, where xxxx is the process ID of the warehouse agent process. Except iSeries system, there is another log file AGNTxxxx.SET created on warehouse agent platforms. This file contains environment information.
.SET files are very helpful in understanding the environment that the warehouse agent is running under and reviewing can resolve many problems. For example, if you are trying to run a step that calls a User Defined Program (UDP) and you get an error that the program was not found, you can examine the .SET file to see what the PATH environment is that the warehouse agent is running under.
Depending on the level of information needed, the agent logs also have 5 different level of trace information. Like the warehouse server trace, the fifth level of agent trace can not be set through warehouse properties panel. This fifth level of trace should be set up exceptionally if required by the IBM support and should be administered under IBM support assistance. The agent logs are created in different locations on different agent platforms. Table 6-1 shows the path of the warehouse traces on different agent platforms.
248
x:\program files\sqllib\logging /var/IWH /qibm/userdata/IWH environment variable vws_logging specifies the directory
UDP traces
These are trace files for sample programs shipped with DB2 Warehouse Manager. They display functional traces of the major events during the execution of the programs. The file name of these trace files on UNIX, Windows NT/2000 and zSeries (OS/390) agent is TRCxxxx.log where xxxx is either the process ID that the warehouse program was started or a timestamp indicating the time the warehouse program started. The file name of these trace files on iSeries agent is VWxxxxx.yyyyyy where xxxxx is the process ID under which the warehouse program was started and yyyyy is the name of the warehouse program.
249
If the warehouse program is started by the warehouse agent process, it will run in the same job as the warehouse agent process, so it will share the same process ID. The message queue trace, agent trace and the warehouse program trace will all share the same xxxxx value. The following table shows the location of UDP traces on different agent platform:
Table 6-2 UDP trace location
Agent sites Location of log files
\sqllib\logging /var/IWH /qibm/userdata/IWH and /qsys.lib/qiwh.lib/ftpcmd.file/MSxxxxx.mbr environment variable vwp_logs specifies the directory
Important: Successful completion of this program does not guarantee that the data was transferred correctly. It only indicates that the FTP command ran. To ensure that the data was transferred correctly, you must check the FTP message logs for warning and non-fatal errors.
The FTP program trace file: The FTP command program trace file can be found in /QIBM/USERDATA/IWH directory on iSeries agent system.
250
iSeries (AS/400) load programs: These programs provide two kinds of diagnostic information:
The return code, as documented in the DB2 Warehouse Manager online help. The load program trace file: The Load program trace files are located in the /QIBM/USERDATA/IWH directory. The Load program trace file has the name format of VWxxxxxx.VWPLOADI or VWPxxxxxx.VWPLOADR depending on the program used. These trace files can be viewed on native iSeries environment or via Client Access Express for Windows on your PC. Here is how to view the trace file on your PC using Client Access Express: 1. Set up a Client Access Express connection to your iSeries system over TCP/IP. 2. Open the Windows Explorer on your PC. 3. From the Explorer menu, select Tools -> Map Network Drive. 4. Type the path name: \\hostname\QIBM where hostname is the fully qualified TCP/IP host name of your iSeries system. 5. Click OK.
Important: If you use Client Access Express to access trace file, you must define the file extension of the trace file to Client Access Express. Defining the extension allows Client Access to translate the contents of files with this extension from EBCDIC to ASCII.
251
2. Right-click Integrated file system by expanding your iSeries system name, as shown in Figure 6-15.
252
3. Click Properties. This should open the properties notebook, as shown in Figure 6-16.
4. Type VWPLOADI in the File Extension field. 5. Click Add. 6. Click OK. You should now be able to load the file into an ASCII editor or word processor. If there was a failure of any of the system commands issued by Load programs, then there will be an exception code recorded in the Load program trace file. Here is how to get an explanation for the iSeries exception: 1. At an iSeries command line, enter DSPMSGD RANGE(xxxxxxx) where xxxxxxx is the exception code. For example, you might enter DSPMSGD RANGE(CPF2817) at the iSeries command line. The Select Message Details to Display panel is displayed.
253
2. Select option 30 to display all information. A message similar to the following message is displayed: Message ID: Message file: Library: Message: Cause: Recovery: Specify CPF2817 QCPFMSG QSYS Copy command ended because of error. An error occurred while the file was being copied. See the messages previously listed. Correct the errors, and then try the request again.
OLAP Server programs for iSeries: The OLAP Server programs provides three kinds of diagnostic information:
The return code, as documented in the DB2 Warehouse Manager online help The OLAP Server program trace: These trace files are located in /qibm/userdata/iwh directory on iSeries agent system. The file format is trcxxxxx.log where xxxx is the process ID of the program execution which produces the trace file. This trace is very useful in diagnosing the IBM DB2 OLAP Server or Hyperion Essbase Server problems The feedback log: The feedback log contains the specific Return code returned from DB2 OLAP or Essbase Server API and contains the relevant error information. The file is located in the same location as trace file and appear as vwpfdbk.log
Important: To diagnose the OLAP server program, first look at the feedback log and then look for the return code message in the trace file.
Transformer traces
DB2 Warehouse Manager transformers provide all diagnostic information in a database table called IWH.LOGTABLE. You can specify your own logging table name in the processing options for a transformer step. The default log table is created in the IWH schema on the agent/target database system, when a transformer step is executed for the first time. After that, the trace information is appended for each execution if trace is ON. It is a good idea to delete the contents of the logtable before you execute the step with diagnostic information. To clear the logtable, simply open the SQL interface on the target database system and run an SQL statement: DELETE FROM IWH.LOGTABLE
254
As with traces, IWH.LOGTABLE can contain different levels of trace information based on the level of trace set in the Properties page of the Transformer step. To turn the trace on, click the Processing Options tab on the Properties notebook, as shown in Figure 6-17.
1 2 3
Only error information Level 1 and warnings Level 2 and informational messages
10 25 4 4
0 0 0 0
255
Column Name
Type Schema
Type Name
Length
Scale
Nulls
MSG_TYPE MSG_TEXT
SYSIBM SYSIBM
CHARACTER VARCHAR
1 2000
0 0
Yes Yes
Message Type field (MSG_TYPE) contains a character value which corresponds to the logging level. For example, Message Types E (Errors), W (Warning) and I (Informational) correspond to the logging levels 1, 2 and 3 respectively. This makes easy for the user to extract the relevant information from the logtable. Users can write a simple SQL statement like this to extract all Data Warehouse Center errors logged in the logtable: SELECT MSG_TEXT FROM IWH.LOGTABLE WHERE MSG_TYPE = E The message text can be longer than the MSG_TEXT column. If the message text exceeds one row limit, it goes to second row and the MSG_TYPE field contains C to specify the continuation of the line.
256
Here is how to validate the connectivity of your ODBC data source for warehouse agents: 1. From a DOS or UNIX command line, type the following: On AIX, run this command: usr/opt/db2_xx_yy/bin/IWH.environment On the Solaris Operating Environment and Linux, run this command: opt/IBM/db2/Vx.y/bin/IWH.environment 2. Type odbctest <dsn> <uid> <pw>, where: <dsn> is the ODBC system (Windows) database to which you are attempting to connect <uid> is a valid user ID to connect to the <dsn> database <pw> is a valid password for user <uid> 3. To verify the connection to the system ODBC data source (called in this example 'target'), type: C:\Program Files\SQLLIB\bin>odbctest target resident my1pw 4. If there is something wrong with either the definition or the connectivity, an error message should be output to the screen.
Connector for the Web: Figure 6-18 explains the debugging strategy for a Web Connector integrated with DB2 Warehouse Manager. To understand how the Web Connectors work, please refer to Connector for the Web on page 23.
257
DWC Error
No
User Error
Error messages from the Connector for the Web are documented in the Data Warehouse Center messages in the following range: DWC08900X - DWC08929X. If you are not getting the WebSphere Site Analyzer (WSA) error token along with the Data Warehouse Center error taken, the first place to look for the error explanation is the Data Warehouse Center Infocenter. The WSA documentation comes with the WSA product. The WSA documentation can also be found on the Web at:
http://www.ibm.com/software/webservers/siteanalyzer/library.html
Table 6-6 lists the different traces you can generate to debug the Web Connector.
Table 6-6 Traces to use with Web Connector
Trace Name Usage
Web Connector trace for import source Web Connector trace for polling step Agent log
To debug problems with data import To debug problems with polling step To debug Data Warehouse Center related problems
258
Connector for SAP R/3: The problem source identification methodology for the SAP Connector is pretty much same as Web Connector. The user should follow the procedure described below to find the cause of the problem:
If the user gets a Data Warehouse Center error message, they should look at the documentation for Data Warehouse Center messages. The range of the message tokens for the SAP Connector is: DWC08930X - DWC08941X The users may be able to find extra error information logged by an RFC module ( librfc32.dll) or by SAP R/3 servers. Such information can be found in the SAP documentation. If the error message explanation does not help you to reach the cause of the problem, you should turn on appropriate trace levels to generate two types of trace information, as shown in Table 6-7.
Note: The 4th or 5th level of agent trace generates SAP Connector trace files.
Table 6-7 Traces to use with SAP Connector
Trace Name Usage
SAPxxxx.log AGNTxxxx.log
To debug SAP Connector specific problems To debug Data Warehouse Center agent related problems
If that does not help solve the problem, you will need to contact IBM support with the trace information you generated.
IBM provides a great deal of technical information free of charge on the Web. This DB2 Warehouse Manager support Web page is the first place you should look for the answer to a problem, especially if it appears to be a software bug.
Note: Any latest changes or quick update to the product user guide are posted in a FAQ or Technote on the support Web site.
The Web site window is shown in Figure 6-19.
259
In addition to the latest FAQ and Technical notes, also known as Technotes, the support Web site contains several types of information and tools, including: Product news Release notes written by Development and Technical support staff White papers/online publications Case Studies Support downloads A complete catalog of books, manuals, redbooks and supplemental materials
260
Finding information is easy. You can navigate using the menus and views, or use the search feature in the support database. For example, here is how you can find the latest FAQ on the import/export problem in DB2 Warehouse Manager: 1. Connect to:
http://www-4.ibm.com/software/data/db2/datawarehouse/support.html
2. Click Frequently Asked Questions (FAQs). 3. In the drop-down box, select Import /Export. 4. Click Go. 5. You can filter the result by searching with keywords. The list of FAQs appears on the Web, as shown in Figure 6-20.
261
No Yes
User error?
OS error?
No
Area of failure identified?
Yes
Yes
No
Server failure
Database issues
Network failure
Solve issues: E rror symptom Process does not complete in the expected time
Restart from communications errors between: Serv er, Agent, Source, Target
262
A DB2 Warehouse Manager uses a remote agent to execute a warehouse step and the remote agent daemon is not started on the remote system. The warehouse agent calls an external program (user defined program) and passes an invalid number of parameters. DB2 Warehouse Manager user does not acquire appropriate authority on database objects.
Note: Follow the steps defined in problem source identification phase to verify it is a user error and then take corrective action.
263
The logon settings are shown in Figure 6-23. During Data Warehouse Center logon, use the Advanced button to specify the warehouse server to which you want to connect. If the warehouse server is installed on the same system, the server host name should point to localhost. But if you are connecting to the warehouse server from a DB2 Administrative client, the server host name field should point to the fully qualified hostname or TCP/IP address of the warehouse server, as shown in Figure 6-23.
Subsequent invocations from the same DB2 Control Center session do not require you to logon again. The warehouse control database name must match the current warehouse control database of the warehouse server. If you are trying to connect to a different or a new warehouse control database, make sure that it is initialized before you connect. If the warehouse control database does not exist or it is not initialized, you may get the error, as shown in Figure 6-24.
264
User's checklist:
1. Verify that the warehouse control database under the logon advanced window matches the current warehouse control database for the warehouse server. To check if the warehouse control database exists already, use the following command on the DB2 command window: db2 list db directory This should list all the databases cataloged locally or remotely, as shown in Figure 6-25.
2. Reinitialize the warehouse control database. To do this, select Start => Programs => IBM DB2 => Warehouse Control Database Management
265
3. Type the new/existing warehouse control database name, your existing user ID and password, and click OK. If initialized successfully, you should see the messages shown in Figure 6-26.
4. Click Cancel to exit. 5. Now logon to Data Warehouse Center using the new warehouse control database name.
Note: If you have recently switched between a LAN connected environment and a standalone warehouse server environment without rebooting, the logon issue usually occurs.
You may be able to get away with just stopping and starting all the DB2 Warehouse Manager services, but a reboot will likely be more effective. If you cannot solve the error, try reinitializing the warehouse control database.
266
3. Expand Warehouse Users and Groups. 4. Right-click Warehouse Users to define a new user. 5. Define a new User, password, and email address, as shown in Figure 6-27. 6. Select the Active user check box, and click OK. 7. Close the Data Warehouse Center and Control Center, and logon with the new user ID.
267
You can also contact IBM support for location of the fixpacks. It is recommended to read the Readme file for the fixpacks before you plan to apply fixes on any of the warehouse components.
3. Write down the word WRxxxx (WR21294 in this case) and call IBM Support to find out what fixpack level of code you have. You can also verify with the second informational token in the above window which corresponds to the date when this fixpack was built.
Will my warehouse control database be affected when I install the product fixpack?
When you apply the fixpack on Windows NT and Windows 2000 systems, you are asked whether you want to migrate the metadata in your warehouse control database. You must migrate your metadata in order to have an operational warehouse environment. The migration can be done during the fixpack installation or later using the Warehouse Control Database Management window on Windows NT or Windows 2000 systems which have the DB2 Administration Client at the fixpack level.
268
It is important for you to make a backup copy of your warehouse control database before your warehouse metadata is migrated. You should also update the configuration of the warehouse control database so that logging space is sufficient for the metadata migration and for use of the database by the Data Warehouse Center. The recommended settings are: Log file size (logfilsiz) = 4096 Number of primary logs (logprimary) = 5 Number of secondary logs (logsecond) = 100 This is how to change the metadata configuration settings: Open the DB2 Control Center and find your warehouse control database. Right-click the warehouse control database (TESTDB in this example) and click Configure, as shown in Figure 6-28.
The Configure Database page opens. Click the Logs tab. Select one parameter at a time and change the value in the Value Text box, as shown in Figure 6-29. Click OK to save.
269
270
User's checklist for warehouse server failures: Here is a quick checklist of what to do in the unlikely event that the warehouse server stops for some reason:
1. Stop all components of the DB2 Warehouse Manager, the remote agent (when it exists), the agent daemon (local Windows NT/2000 agent), warehouse logger, and warehouse server services, as shown in Figure 6-30.
2. Check that all log files are saved in ..\sqllib\logging. 3. Check the Windows NT/2000 Event viewer to see if any logs are generated: a. Select Start -> Settings -> Control Panel -> Administrative Tools -> Event Viewer (see Figure 6-31). b. Select Application Log, Security Log, and System Log to check the error reported. 4. Analyze and report the error to IBM support. 5. Restart the warehouse logger and warehouse server in the NT/2000 Services dialog. 6. Restart the client. After restarting all components, if you are not able to run a step, then rerun the metadata initialization utility mentioned in 6.5.1 User errors on page 262.
271
Database problems
In this section, we focus on database access problems in general when using the warehouse agent and also on encountering corrupted data problems with the warehouse control database.
272
Call Level Interface (CLI): The DB2 CLI is the IBM callable SQL interface to the DB2 family of database servers. It is an application programming interface for relational database access and uses function calls to pass dynamic SQL statements as function arguments. DB2 CLI is based on Microsoft ODBC specification and the International Standard for SQL/CLI.
Using this interface, an application developer can code, compile, and ship an application without targeting a specific Relational Database Management System (RDBMS). The DB2 CLI is an alternative to an embedded dynamic SQL. For the most part, the SQL CLI is syntactically and semantically equivalent to ODBC. This is not to say that everything in the latest level of ODBC is supported, but an application that uses the most common routines will likely run against the CLI with few changes. The SQL CLI is a standard created by the X/Open standards group, and the ODBC is the Microsoft implementation of the X/Open CLI standard.
DB2 CLI problem determination: The DB2 Call Level Interface (or CLI) is at the heart of any access to the database. If there is a problem here, database or operating system problem determination tools should be used. If the problem is in DB2 Warehouse Manager, you can expect it to be:
An application coding error A bug in the function that accesses the DB2 Call Level Interface Instructions on how to set up CLI connectivity are provided in DB2 Warehouse Manager Installation Guide, GC26-9998.
CLI tracing in UNIX and Intel environments: Data Warehouse Center ODBC drivers for several non-DB2 databases are installed when you install a warehouse agent.
To get the CLI trace, follow these steps for a specific database: 1. Shut down all applications to the database. Open the DB2 command line processor and connect to the database 2. Type the command:
DB2 UPDATE CLI CFG FOR SECTION COMMON USING TRACE 1 TRACEPATHNAME <filename> TRACEFLUSH 1
Then press Enter. 3. Restart the DB2 services from Windows Control Panel - Services. 4. Recreate the problem.
273
To stop the CLI trace, follow these steps: 1. Shut down DB2 services and client. 2. Open the DB2 command line processor and connect to the database. 3. Type the command:
DB2 UPDATE CLI CFG FOR SECTION COMMON USING TRACE NULL TRACEPATHNAME NULL TRACEFLUSH NULL
CLI Tracing in iSeries (AS/400) environment: The following information is from the CLI Frequently Asked Questions document available at the Web site:
http://www.as400.ibm.com/db2/clifaq.htm#header_16
The CLI has a trace function built into the code, starting with OS/400 V4R3. To turn on the trace, use the following command: CHGCPATRC JOBNUMBER(*CURRENT) SEV(*INFO) This example turns on *INFO level tracing for the current job. The *INFO level is what is needed for the CLI to start writing out trace records. For a long-running program that uses many CLI calls, this trace can fill up quickly. The CHGCPATRC also has parameters for specifying the buffer size for the trace, whether the trace should wrap when full, and whether the buffer should be resized.
Note: The trace can be turned on for jobs other than *CURRENT, by simply specifying the job number. This allows you to run the CLI trace against batch jobs, prestart jobs, and so forth.
After turning on the trace, and running a CLI program, use the DSPCPATRC command to see the trace records. You will see every CLI function call, along with a display of the parameters. This may be helpful in debugging problems, or just to identify how many times a certain function is called. An alternative for those who do not have the CHGCPATRC and DSPCPATRC commands on their system is to use the CHGUSRTRC and DMPUSRTRC commands instead. However, there is one extra step. When doing the CHGUSRTRC command to set the buffer options, you will notice that this command does not have a way to set the level of tracing. This is accomplished by doing the following: CALL QSYS/QP0WUSRT parm('-l 2' '-c 0' 'xxxxxx') Here, 'xxxxxx' is the job number of the job you want to trace. The program is spelled Q, P, then the number zero, and the first parameter is a lower case l.
274
Make sure you specify the program name correctly. You can simply cut and paste the command line shown above. All the CLI trace records start with 'SQL CLI:' in the text. Since there may be trace records from non-CLI functions, such as thread APIs, you can use those values to quickly locate CLI trace records. Another option is to query the temporary file that contains the data, and use search criteria to just display the CLI trace records, for instance, if your DSPCPATRC output looks as shown in Example 6-2.
Example 6-2 DSPCATRC output
Display Physical File Member File . . . : QAP0ZDMP Library . . : QTEMP Member . . .: QP0Z886434 Record . .: 1 Control . . . . . Column . .. : 1 Find ....... *...+....1....+....2....+....3....+....4....+....5....+....6....+....7....+... 886434:222784 SQL CLI: SQLAllocHandle ( 1 , 0 , SQLINTEGER* ) 886434:246288 Qp0zSGetEnv(QIBM_USE_DESCRIPTOR_STDIO) 886434:246976 Qp0zSGetEnv(QIBM_USE_DESCRIPTOR_STDIO): Could not find string 886434:513040 SQL CLI: SQLSetEnvAttr ( 1 , 10004 , 1 , 0 ) 886434:513352 SQL CLI: SQLAllocHandle ( 2 , 1 , SQLINTEGER* )
You can filter out everything except the CLI trace records. Run the following SQL statement using either Interactive SQL or any query tool SELECT * FROM QTEMP/QAP0ZDMP WHERE SUBSTR(QAP0ZDMP,17,8) = 'SQL CLI:'
CLI tracing in z/OS and OS/390 environments: To set up the CLI environment and trace, follow these steps:
1. Bind ODBC locally and to any remote databases. Because the zSeries (OS/390) agent uses ODBC to communicate with DB2 UDB, you must bind your CLI plan to all of the local and remote databases that your agent will access. 2. When you complete binding the CLI packages, verify that the DSNAOINI environment variable in your .profile file points to the ODBC initialization file that uses the CLI plan that you just bound. For example, if the CLI plan is named DWC6CLI and the local system is named DWC6, the ODBC initialization file should contain the following information:
275
3. Set up your ODBC initialization file. A sample ODBC initialization file, INISAMP, is included in the usr/lpp/DWC/ directory. You can edit this file to work with your system, or you can create your own file. To be sure that the file works correctly, verify that it is properly configured: The DSNAOINI environment variable must point to the initialization file. The file must include CONNECTTYPE=2 in the common stanza. The file must include MVSATTACHTYPE=CAF in the subsystem stanza. Ensure that you have a data source stanza for your DB2 system. It should specify the location name of the local DB2 system. An example of a DSNAOINI file is shown in Example 6-3.
Example 6-3 DSNAOINI file
[COMMON ] MVSDEFAULTSSID=DWC6 CONNECTTYPE=2 ;APPLTRACE=1 ;APPLTRACEFILENAME=/usr/lpp/DWC/logs/application.CLITRACE ;TRACEFLUSH=1 ;Example SUBSYSTEM stanza for V71A subsystem [DWC6 ] MVSATTACHTYPE=CAF PLANNAME=DWC6CLI ;DATA SOURCE stanza for ISC710P1 data source [ISC710P1 ]|
To turn on ODBC tracing, remove the three commented lines in the COMMON section. For more information about binding ODBC and the DSNAOINI file, see the DB2 Universal Database for z/OS and OS/390 ODBC Guide and Reference, SC26-9005.
276
Error Messages
No (Bad data) Locate failing statement and run on application server locally or with SQL interface
Yes
Use error message, SQLCODE or SQLSTATE to determine cause of error and any possible actions
Still Failing
277
Handling iSeries messages: The iSeries system sends a variety of system messages that indicate conditions ranging from simple typing errors to problems with system devices or programs. The system sends informational or inquiry messages for certain system events. Informational messages give you a status on what the system is doing. Inquiry messages give you information about the system, but also request a reply. In most of the message displays, a message is accompanied by a letter and a number code, such as CPF0083.
The first two or three letters indicate the message category. Some message categories for distributed database are shown in Table 6-8.
Table 6-8 Message categories
Category Description Library
Message from the operating system Licensed Internal code messages SQL messages TCP/IP messages
The remaining four digits (five digits if the prefix is SQ) indicate the sequence number of the message. The example message ID shown indicates this is a message from the operating system, number 0083. To obtain more information about a message on the message line of a display or in a message queue, do the following: 1. Move the cursor to the same line as the message. 2. Press the F1 (Help) key. The Additional Message Information display is shown in Figure 6-33.
278
You can get more information about a message that is not showing on your display if you know the message identifier and the library in which it is located. To get this information, enter the Display Message Description (DSPMSGD) command: DSPMSGD RANGE(SQL0204)MSGF(QSYS/QSQLMSG) This command produces a display that allows you to select the following information about a message: Message text Field data Message attributes All of the above
279
The text is the same message and message help text that you see on the Additional Message Information display. The field data is a list of all the substitution variables defined for the message and their attributes. The message attributes are the values (when defined) for severity, logging, level of message, alert, default program, default reply, and dump parameters. You can use this information to help you determine what the user was doing when the message appeared.
Message types: On the Additional Message Information display, you see the message type and severity code for the message. Table 6-9 shows the different message types for AS/400 messages and their associated severity codes.
Table 6-9 iSeries message types
Message type Informational messages. For informational purposes only; no reply is needed. The message can indicate that a function is in progress or that a function has completed successfully. Warning. A potential error condition exists. The program may have taken a default, such as supplying missing data. The results of the operation are assumed to be successful. Error. An error has been found, but it is one for which automatic recovery procedures probably were applied; processing has continued. A default may have been taken to replace the wrong data. The results of the operation may not be correct. The function may not have completed; for example, some items in a list ran correctly, while other items did not. Severe error. The error found is too severe for automatic recovery procedures and no defaults are possible. If the error was in the source data, the entire data record was skipped. If the error occurred during a program, it leads to an abnormal end of program (severity 40). The results of the operation are not correct. Severe error: abnormal end of program or function. The operation has ended, possibly because the program was not able to handle data that was not correct or because the user canceled it. Abnormal end of job or program. The job was not started or failed to start, a job-level function may not have been done as required, or the job may have been canceled. System status. Issued only to the system operator message queue. It gives either the status of or a warning about a device, a subsystem, or the system. Severity code
00
10
20
30
40
50
60
280
Message type Device integrity. Issued only to the system operator message queue, indicating that a device is not working correctly or is in some way no longer operational. System alert and user messages. A condition exists that, although not severe enough to stop the system now, could become more severe unless preventive measures are taken. System integrity. Issued only to the system operator message queue. Describes a condition where either a subsystem or system cannot operate. Action. Some manual action is required, such as entering a reply or changing printer forms.
Severity code
70
80
90 99
The message description indicates what the problem is and provides corrective actions. If you do not receive an error message, you must determine whether distributed relational database is causing the failure. To do this, run the failing statement locally on the warehouse agent platform or use the SQL interface to run the program locally. If you can create the problem locally, the problem is not with distributed relational database support. Use the respective platform specific problem analysis methods. You can generate CLI traces on the relational database to see if a CLI call is failing.
281
A long delay will occur if the system to which you are trying to connect over TCP/IP is not available. A several minute time-out delay will precede the message. A remote host did not respond within the time-out period. An incorrect IP address in the relational database directory (on iSeries) will cause this behavior as well.
Inconsistency error when importing a Data Warehouse Center tag file: An error may occur when importing a Data Warehouse Center tag file, and you may get the error code DWC03807E:
DWC03807E Step <step_name> being created or updated is associated with source resource, but the source tables are not associated with the steps source database
1. First use the SQL statement shown in Example 6-4 to see the steps/entries that are inconsistent and that will be changed.
Example 6-4 Find the corrupted relationships
select * from iwh.relationship rel where rel.relation_name='BV_TO_SourceIR' and rel.target_iwhid not in (select source_iwhid from iwh.relationship where relation_name='IR_TO_DR_Rel' and target_iwhid in (select target_iwhid from iwh.relationship where relation_name='BV_TO_Input_DR' and source_iwhid=rel.source_iwhid))and source_iwhid in (select source_iwhid from iwh.relationship where relation_name='BV_TO_Input_DR')
2. Now change them with the SQL statement shown in Example 6-5.
Example 6-5 Correct the inconsistency
update iwh.relationship rel set rel.target_iwhid = (select min(source_iwhid) from iwh.relationship where relation_name='IR_TO_DR_Rel' and target_iwhid in (select target_iwhid from iwh.relationship where relation_name='BV_TO_Input_DR' and source_iwhid=rel.source_iwhid)) where rel.relation_name='BV_TO_SourceIR' and source_iwhid in (select source_iwhid from iwh.relationship where relation_name='BV_TO_Input_DR' and source_iwhid=rel.source_iwhid)
Objects not found on import: This problem is caused on import, where you will receive an error DWC03142E with a message similar to the following:
DWC03142E Dataresource object 0000023047 was not found in the Data Warehouse Center control database.
282
1. Identify the steps that have dangling correlation objects, as shown in Example 6-6.
Example 6-6 Identify the steps that have dangling correlation objects
select name from iwh.businessview where iwhid in (select rel.source_iwhid from iwh.relationship rel where relation_name='BV_TO_Correlation' and target_iwhid in (select target_iwhid from iwh.relationship where relation_name='DR_TO_Correlation' and source_iwhid not in (select target_iwhid from iwh.relationship where relation_name='BV_TO_Input_DR' and source_iwhid =rel.source_iwhid) and target_iwhid=rel.target_iwhid))
2. Delete the dangling correlation objects for all the steps identified by seeing first (SELECT SQL statement) what we are deleting (Example 6-7).
Example 6-7 Delete the dangling correlation objects
select iwhid from iwh.correlation where iwhid in (select rel.target_iwhid from iwh.relationship rel where rel.relation_name='BV_TO_Correlation' and rel.target_iwhid in (select target_iwhid from iwh.relationship where relation_name='DR_TO_Correlation' and source_iwhid not in (select target_iwhid from iwh.relationship where relation_name='BV_TO_Input_DR' and source_iwhid =rel.source_iwhid) and target_iwhid=rel.target_iwhid)) delete from iwh.correlation where iwhid in (select rel.target_iwhid from iwh.relationship rel where rel.relation_name='BV_TO_Correlation' and rel.target_iwhid in (select target_iwhid from iwh.relationship where relation_name='DR_TO_Correlation' and source_iwhid not in (select target_iwhid from iwh.relationship where relation_name='BV_TO_Input_DR' and source_iwhid =rel.source_iwhid) and target_iwhid=rel.target_iwhid))
3. Delete the relationships to the dangling correlation objects by first seeing (with the SELECT statement) what we are deleting (Example 6-8).
Example 6-8 Delete the relationships to the dangling objects
select * from iwh.relationship where relation_name='BV_TO_Correlation' and target_iwhid not in (select iwhid from iwh.correlation) delete from iwh.relationship where relation_name='BV_TO_Correlation' and target_iwhid not in (select iwhid from iwh.correlation)
select * from iwh.relationship where relation_name='DR_TO_Correlation' and target_iwhid not in (select iwhid from iwh.correlation) delete from iwh.relationship where relation_name='DR_TO_Correlation' and target_iwhid not in (select iwhid from iwh.correlation)
283
Network problems
Communication errors may be encountered when the warehouse server is unable to communicate with agent sites, locally or remotely or when getting any TCP/IP connectivity error with the DB2 Warehouse Manager client/server components.
284
The most common cause of RC7183 is improper configuration of TCP/IP connectivity between the warehouse server and the remote agent system. Communication between the warehouse server and the warehouse agent is bidirectional; the warehouse server sends messages to the warehouse agent, and the warehouse agent sends messages back to the warehouse server. Ensure that the warehouse server is connected to the remote agent system and vice versa. To test the communication between the warehouse server and the warehouse agent: 1. Ping the TCP/IP host name. Your host name is specified on the Parameters page of the remote agent site definition page of the Data Warehouse Center, as shown in Figure 6-34. If the ping fails, check if: The remote agent system is registered with your domain name server or that there is an entry for the system in the TCP/IP HOSTS file in the \winnt\system32 \drivers\etc directory. The agent system is running. The network is active.
285
2. Ping the fully qualified TCP/IP host name of the warehouse server from the remote agent system. You must use the fully qualified name (hostname.domain), for example yourmachine.yourcompany.com. The fully qualified host name is the return address that the warehouse server gives the agent. If the ping fails, be sure that: The warehouse server is registered with your domain name server or has a host table entry on the remote agent system. The warehouse server is up and running. The network is active. If both of the ping attempts were successful, verify that the numeric IP address returned by the ping is actually the IP address of the workstation that you are trying to connect to.
286
Chapter 7.
Performance issues: General performance advice Performance checklist to use when testing applications
287
Operational Environment
flat files
Web
SAP R/3
Connectors for Web or SAP R/3 DB2 SELECT or LOAD process DB2 CAPTURE process Other RDBMS SELECT process Other RDBMS CAPTURE (triggers) process Transaction Program Queues Changes DB2 Apply Process Replicated Changes Transform Process Staging Area
Change Table
DB2 DB
Transform Process
OTHER RDBMS
Change Table
Data Joiner
VSAM files
Extraction Phase
Transformation Phase
288
The DB2 Warehouse Manager would aid in defining these processes, making it easier to restart each step in the process if a failure should occur. Another point to consider in your application design is the importance of understanding what architectural elements are involved in the ETML and are essential to the ETML process flow. The ETML function is there to obtain the data, move it, transform it, and then store it.
7.1.1 Extraction
Consider the following issues in designing processes in the extraction phase: What are the operational sources of your data? Number of sources, and whether this would require creation of temporary tables or files to consolidate the data Purchased and external data, and what would be required to include this data with your other sources Homogeneous data from the DB2 UDB family Heterogeneous data from non IBM RDBMS that may require additional software to give transparent access to data How complex the data is Whether data complexity is aggravated, because this could mean pulling together many unrelated data sources. When will the operational data be available? Hourly Daily Nightly Weekly Monthly
What else can you determine about the data? What is the frequency of the data extraction? Are operational data sources connected to the data warehouse system? What is the amount of data to be moved to the data warehouse? Is the data selected from data sources inserted into a partitioned table? What automation of data extraction is required?
To extract data from the sources, many features may be used: SQL steps to select the source data and insert it into a staging area or in the target table IBM Data Replication to extract changes from data sources
289
Use of replication warehouse programs with a replication source to extract inserts, updates, and deletes performed on relational data sources (rather than simply moving the whole source) DB2 massive loads
7.1.2 Transformation
This phase is the most complex and may involve several processes. You may need to store intermediate results in a staging area. Some issues are: What is the number of changes needed to be performed on the operational data? What level of integrity is required? Will there be some testing involved to ensure the integrity of data? What is the amount of programming required? Business rules can be defined in various ways: Clean transformer capability Unique/ check/ referential/ table constraints, implemented as triggers/user defined functions or stored procedures Adding programmable logic can be accomplished in various ways: Stored procedures using the SQL Procedures Language, C/C++, Java, or COBOL User defined functions User developed programs can be registered with and managed by DB2 Warehouse Manager, including the capability to return statistical metadata to DB2 Warehouse Manager Some specific transformers built on Java stored procedures and user defined functions are provided by DB2 Warehouse Manager to transform data according to statistical and warehouse requirements. There are three transformer groups: 1. Warehouse Transformers 2. Statistical Transformers 3. User-Defined Function These transformers can be used on OS/400 and z-OS and OS/390 as well.The following examples explain how you can use these transformers to solve some of your business problems.
290
Note: FORMATDATE runs as a function against the input date column for each row in the table, and the formatted output date is placed in the output date column (which must exit).
The format of the input and output dates are chosen from menu lists of date and time formats. Optionally, a user can specify their own input or output date format using the pattern characters. If FORMATDATE cannot recognize an input date based on the input pattern string, then NULL is returned for the output date.
291
Following are some examples of how the functions can be used: Given a table associating sales personnel with a region, what is the size of the sales force in each region? (COUNT) Given quarterly revenues by region, what is the yearly revenue for each region? (SUM) Given daily sales for each month: What is the smallest and largest sale? (MINIMUM,MAXIMUM) What is the difference between the maximum and minimum? (RANGE) What is the average monthly sale? (AVERAGE) By how much do the sales amounts vary from the average? (VARIANCE,STANDARD DEVIATION, COEFFICIENT OF VARIATION)
Estimate the potential degree of discrepancy between a sample mean (average) and the population mean. (STANDARD ERROR)
To move a small amount of data: You can use SQL steps to select the source data and insert it into a target table. This process will be discussed later when we describe the SQL transformation step. To move changes to data: Rather than moving the whole source, use the replication warehouse programs with a replication source To move large amounts of data: You can use the export and load warehouse programs to export data from a table into a file, and then load the data into another table.
Never underestimate data modeling: Even if it seems easy to use the graphical user interface (Data Warehouse Center) directly to start building and designing the warehouse population solution, it might be much easier to do the data modelling and physical database design first before defining the processes. Although DB2 Warehouse Manager allows you to define target tables on the fly during process design, it is more thorough and better documented if you do the data definition as part of a proper data modelling exercise. For example, Erwin data can be imported into DB2 Warehouse Manager.
292
Perform one to one mapping: When building a system which accesses data from a number of physically different data sources, it is probably best first to map each source file or table to be extracted to a separate DB2 table and perform a one to one mapping. Joining the data can probably be done later more efficiently. The exception is in situations where two or more large data sources come from the same database. In this case, investigate whether there are efficiencies to be gained by using the source database to do the manipulation or joining. Use DB2 UDB load: The DB2 UDB load utility is significantly faster at loading data into DB2 UDB than any other method. You should experiment early on in the project to determine which sources should be input via the load utility and which should user other methods. You may also have to scale your configuration and use parallel/partitioned loads. Always minimize the number of steps: Once your design has loaded the source table into a DB2 intermediate table, you should try to devise SQL steps which will do the required processing to get to the target in as few SQL steps as possible, ideally one. If both the intermediate and target tables are in the same database, this will be the most efficient since DB2 Warehouse Manager will generate an INSERT from SELECT.
The number of steps per process should be kept reasonable. Perhaps a good guideline is to keep to what you can view on a single screen. By doing this, it is easier to see and understand what a process is designed to do.
Define some naming convention: You should try to maintain some naming convention that assists in understanding:
a. What the object is b. What its purpose is For example, you could prefix every SQL step with S_, UDP with U_.
Use UDP scripts: If you want to delete all the rows in a table, it may be much faster at execution time to use an installation written UDP script which will invoke the load utility to replace load with an empty file than issue the SQL delete statement. The load utility will run in a few seconds; the SQL DELETE might take minutes due to the number of deletions it is logging. Plan to test a subset of data: If possible, develop a subset of the real data for testing purposes: You do not want to wait several hours just to unit-test a simple change of a process. This way, basic testing of a complete system can take only tens of minutes rather than many hours.
293
294
Steps move data and transform data by using SQL statements or by calling programs. When you run a step, the transfer of data between the warehouse source and the warehouse target, and any transformation of that data takes place.
A process contains a series of steps that populates a warehouse target in a warehouse database by extracting data from one or more warehouse sources, which can be database tables or files. However, you can also define a process for launching programs that does not specify any warehouse sources or targets. For example, you can write a program to send a notification to the operator stating the number of records updated after the successful completion of the process. Generally, the first step in a series of interdependent steps is invoked by either a schedule, or an external trigger or manually, then the whole series will process automatically as designed by the warehouse administrator.
295
SQL steps: An SQL step uses an SQL SELECT statement to extract data from a warehouse source and generates an INSERT statement to insert the data into the warehouse target table. Program steps: A process step can work with warehouse programs. There are several types of program steps. These steps run predefined programs and utilities. Transformer steps: Transformer steps are stored procedures and a user-defined function that specify statistical or warehouse transformations that you can use to transform data. The transformers can be used to clean, invert and pivot data, generate primary keys and period tables, and calculate various statistics. When the process runs, the transformer step writes data to one or more warehouse targets. The target table and the sources have to be in the same underlying database. Currently these transformer steps run on DB2 UDB database only. User-defined program steps: A user-defined program step is a logical entity within the Data Warehouse Center that represents an application that you want it to start. These can be locally written programs, or externally purchased programs. These programs can be used in place of an SQL step. The programs can be written in any language that produces an executable, or can be batch files, DLLs, or DB2 Stored Procedures.
296
What happens then depends on how the workflow is defined: Is it based on successful or unsuccessful completion of the step? If the step is designed to notify the operator upon completion via an e-mail, then one is sent so that the appropriate action can be taken. Where is all this taking place? How are the steps monitored? The Data Warehouse Center provides the monitoring capability via the Work In Progress (WIP) graphical user interface. The following screens will walk you through the process: The WIP is launched from the Warehouse drop-down menu on the main Data Warehouse Center window, as shown in Figure 7-4.
297
The WIP screen indicating the type of status messages available (for example, if a step was scheduled to run) is shown Figure 7-5.
298
A step can be run manually by clicking on the Work in Progress drop-down menu then selecting the Run New Step as shown Figure 7-6. It can also be run by reclicking on the object in the WIP panel and by choosing Run Now from the popup menu.
299
As this step (the one that was manually submitted) replaces the data, the previous successful run step of this step is purged, and the new step will populate the table, as shown in Figure 7-7.
300
To see more information on a step, right-click that step to bring up the context menu and select Show Statistics. The Statistics screen will appear. Right-click the step to show additional detail information, as shown in Figure 7-8. The statistics on a step varies by step type. With SELECT and INSERT we can get all the information; with INSERT FROM SELECT we can get all except for the number of bytes; for programs we get very little information; and for UDPs we have no statistics.
More information on the execution history of the step, including the number of rows, and successes or failures of the step, is shown in Figure 7-9.
301
302
During design and testing, satisfy yourself that the steps are truly restartable. This should be a given for SQL steps, but check them out, and also review any UDPs, utilities, or other steps. Keep the unit of work to a reasonable size for the system you are running on (for example, hundreds of thousands of rows on Windows, but not millions; a few millions of rows on UNIX, but not billions)
Scenario where source and target tables are on different databases: When the source and target tables are in different databases (data will flow through the agent), the agent will execute the select (via a cursor fetch) at the source database. Then the agent will execute insert statements at the target database. It is best to have the agent collocated with the target database to take advantage of DB2 block fetches and local inserts Scenario where source and target tables are in the same database: When the source and target tables are in the same database, an INSERT INTO SELECT FROM statement is generated. The agent sends the statement to the database, and all data movement will be within the database engine and will not flow through the agent. Commit count cannot be used.
For any SQL steps which are likely to be extracting from a set of large DB2 tables, it is useful to list the SQL generated, and copy and paste each set of SQL to a special directory (collection) of flat files. Later, these can be run against the SQL Index Advisor and also SQL Explain to help ensure good performance of the system. Additionally, special measures have to be taken if you want to have a target table which exploits DB2's NOT NULL WITH DEFAULTS capability.
7.4.3 UDPs
A user-defined program represents an application that you want the Data Warehouse Center to start. For example, you can write a user-defined program that will perform the following process: 1. Export data from a table. 2. Manipulate that data. 3. Write the data to an interim output resource or a warehouse target.
303
If you write a UDP, you may want to ensure that any errors get signaled back to the DB2 Warehouse Manager error log, displayable through the Work In Progress menus. How to do this is documented in the DB2 UDB Data Warehouse Center Application Integration Guide, SC26-9994. An example is also provided in Appendix D, UDP to invoke SQL statements and get SQL codes back on page 345.
7.4.4 Transformers
Transformer class files are installed with DB2 UDB Server under sqllib/function/com/ibm/data/xf. If DB2 Warehouse Manager has been set up by a custom or standalone installation, transformer class files are not created. Before using transformers and enabling target for transformers, it is important to follow this users checklist: 1. Install a warehouse agent. 2. Install JDK 1.1.8. 3. Update the environment variables as specified in the DB2 Warehouse Manager Installation Guide, GC26-9998. 4. Update the database manager configuration for the target DB2 instance. 5. Update the database configuration for the target database. 6. Enable target for transformers and install transformers. 7. After performing the above steps, if you are still having problems: a. Check that VWS_PATH has been set: By default, this is set to \sqllib on Window NT. By default, this is set to $instance/sqllib on UNIX.
c. Look for files DropXfSQL and CreateXfSQL in sqllib/bin. d. Look for the messages file Xf.Properties in sqllib/function.
304
Attention: It is sometime preferable to validate Referential Integrity during the transformation steps. This will allow faster loading, using the DB2 Load utility, since Referential Integrity will not be done by the database engine, which can have a negative impact on the performance for a large amount of data.
305
4. No duplicate values in certain fields: Just as with check constraints and referential constraints, a unique constraint can be defined on a column and enforced by the database engine. Again, violations will be put into the exception table. If all of these constraints cannot handle the application design scenario, a stored procedure can be used to do the validation of the data and log the results to the exception table, or do whatever logic needs to done.
Response time: Performance is the measure of time spent on an individual operation or a job. Capacity planning or throughput: Performance can be measured in terms of transactions per hour. It can be measured in terms of data transfer rates or resource utilizations, such as CPU utilization or disk storage utilization.
There are many factors which can impact performance in the DB2 Warehouse Manager environment, such as: High resource utilization: CPU, memory, and disk Application design considerations when using stored procedures, UDPs, etc. Object contention Speed of communication links Congestion of network resources Processor speed of the client system In the next sections we focus on: High resource utilization: CPU, memory, and disk Stored procedure performance considerations Load scalability considerations Running application performance checklist
306
sar vmstat format -d c#t#d# format>current format>inquiry vxprint -dl vxprint -vl prtconf sbin/prtdiag
307
Installing warehouse components on systems which are already used to run a line of business applications should be done with a special care. If the average CPU utilization rate is already high (for example over 50%) or disk usage is high (for example 40%), the additional load created by these components may lower the performance of existing applications.
Program malfunctioning
A performance problem may also be the consequence of a malfunction (program loop, for example). A job may use a lot of resources without any sensible reason, and you will need to look for the cause of this problem.
308
For example, if your client application passes the string A SHORT STRING as a CHAR(200) parameter to a stored procedure, DB2 has to pad the parameter with 186 spaces, null-terminate the string, then send the entire 200 character string and null-terminator across the network to the stored procedure. In comparison, passing the string A SHORT STRING as a VARCHAR(200) parameter to a stored procedure results in DB2 simply passing the 14 character string across the network.
309
Note 1: While you can expect performance improvements from running NOT FENCED stored procedures, user code can accidentally or maliciously damage the database control structures. You should only use NOT FENCED stored procedures when you need to maximize the performance benefits. Test all your stored procedures thoroughly prior to running them as NOT FENCED.
Note 2: If a severe error does occur while you are running a NOT FENCED stored procedure, the database manager determines whether the error occurred in the stored procedure code or the database code, and attempts an appropriate recovery.
310
311
The 80:20 rule often applies, meaning that 80 percent of the resource is consumed by 20% of the processes. Understanding this can save a lot of work by allowing you to concentrate on those processes which are the most likely to be improved upon. Do you have any administration tasks scheduled in your warehouse processes to check what tables might need REORGing? Do you have any processes which issue RUNSTATS to update the table statistics in the catalog?
312
Appendix A.
313
Database data imports that are specific traffic tables Web Tracker data imports
Before using the Web Connector in Data Warehouse Center, some preliminary steps need to be done in WSA: 1. Define a project. 2. Define at least one data import. 3. Run the extraction of at least one data import successfully. This step is necessary to create the Webmart tables. The detailed steps are illustrated in the following sections.
314
1. Define a WSA project (see Figure A-2): Project parameters are described in detail in the WSA Infocenter documentation. Website host names are the names of the servers that make up the Website (usually multiple machines). Webmart database can be stored in DB2 UDB or Oracle. The Webmart has to be a UNICODE (UTF-8) database and must be preconfigured in a certain way. This configuration procedure is documented in the WSA Infocenter as well.
315
2. Define a data import As mentioned previously, there are three types of data imports: Log file data import (see Figure A-3) Several industry standard log types are supported and the option also exists to define customizable ones.
316
Web Tracker data import (see Figure A-5) For near real-time analysis, the WSA Web Tracker feature allows you to collect traffic information or visitor behavior on-the-fly. There is one Web Tracker data import per project created automatically at project definition time. This data import cannot be removed.
317
Usually you would have only the Web Tracker data import and maybe some WebSphere Commerce Suite /WebSphere Application Server tables in the same project but no Web server log files to avoid redundancy. 3. Define scheduling and display notifications and status information for data imports in WSA a. Scheduling For log file and database table data imports, a schedule has to be set up from within WSA (see Figure A-6).
The Web Tracker data import cannot be scheduled. The feature can only be turned on or off, as shown in Figure A-5 on page 317.
318
b. Notifications A notification about the outcome of the data extraction in WSA can be set up for all data imports: see Figure A-7 for the log file and database notification example.
See Figure A-5 on page 317 for the Web Tracker data import notification example.
319
c. Extraction status The current status for all data imports can be obtained by clicking on the status icon in the WSA main window (see Figure A-8).
Figure A-8 Status for the log file data import extraction
If the Web Tracker feature is enabled, the status for the Web Tracker data import shows the timestamp of the last Webmart update made by the Web Tracker (see Figure A-9).
320
321
b. Define the WSA interface with this new source type (see Figure A-11).
322
Click OK to save
323
2. Define a Web Traffic Polling step to check whether the WSA Webmart is populated and/or up-to-date (see Figure A-14).
These are the steps to follow: a. Define the polling step parameters (see Figure A-15). The unit of polling is the data import. The warehouse source name menu only shows WSA source types. If no Data Imports were selected at source definition time, none will be shown. The step will always terminate successfully in this case.
324
325
3. Define an SQL step to schedule extracts from the Webmart (see Figure A-17). The Data Warehouse Center Process Model is used to model the data flow in Data Warehouse Center. The polling step tells the SQL step to run the extraction once the Webmart is populated or in other terms when the WSA extraction has finished. The step is successful when the clickstream assimilation process for the data imports selected as step input is completed otherwise a retry will be done and the step will fail if the duration is exceeded. A step will also terminate successfully, if the data imports are not scheduled from within WSA (that is inactive).
Source icon
'data' link
Figure A-17 Using new source and step within the Process Model
326
4. Run steps using the DWC Work In Progress panel This is the step (see Figure A-18) to schedule and start running a step or process.
Figure A-18 Running the process from the Work In Progress window
327
The flow to import Webmart tables in the warehouse target is described in Figure A-19.
5 Web Client
Kernel
Agent
C O N
2
JSP Engine (WAS)
Agent daemon
Agent
C O N
WebMart Admin DB
WSA
DB2 WM
1 - Collect WSA interface input via GUI 2 - Connector calls JSP (HTTP request) 3 - JSP retrieves WSA metadata from the Admin DB and encodes it 4 - Agent retrieves WebMart table/view definitions using data collected in 3 5 - Result of Connector program call is displayed on GUI
Figure A-19 Importing Webmart tables flowchart
Following is a summary of hints and tips you should know about when using the DB2 Warehouse Manager Connector for the Web:
Installation hints: Note: DB2 Warehouse Manager product needs to be installed before the DB2 Warehouse Manager Connector.
The installation prerequisites described in the IBM DB2 Warehouse Manager Installation Guide Version 7, GC26-9998-02 have changed. For Windows NT and 2000: After installing the DB2 Warehouse Manager Connector, you need only to restart Windows NT or 2000 system.
328
DB2 Warehouse Manager product installation automatically installs the Java Runtime environment software and sets CLASSPATH and PATH system environment variables. For AIX and SUN Solaris: Install the Java Developers Kit (JDK Version1.1.8 in the /usr/jdk_base directory When installing the connector feature, update the IWH.environment file Check the CLASSPATH environment variable as shown below:
CLASSPATH=/usr/jdk_base/ib/classes.zip:$(DB2DIR?)/bin/db2_vw_w eb.jar:$(DB2DIR?)/bin/ibmjsse.jar:$(CLASSPATH)
Optionally, to ensure that the agent will read the right executable set, change the path variable to:
PATH =/usr/jdk_base/bin:$(PATH) export PATH
Check that the Webmart tables have been created. You create the tables by running the WSA data extraction process to import data for your project. After you run the WSA data extraction process, bring up the WSA Status Monitor by clicking on the status icon in the WSA user interface main window. The status monitor indicates whether the data extraction process ran successfully. If your data extraction process failed, take the actions indicated by the WSA error message. Check that values supplied in the WSA Project Information window match the corresponding values in the Data Warehouse Center Warehouse Source definition notebook. In the WebSphere Site Analyzer's Project Information window (see Figure A-2), ensure that: The Project name (www.idug.org in Figure A-2 on page 315) is identical to the Site name defined in the WSA Properties window (see Figure A-11 on page 322). The Database URL (SASITE in Figure A-2 on page 315) is the same as the Database name in the Data Warehouse Center warehouse source definition notebook (see Figure A-11 on page 322).
329
When running the Data Warehouse Center Web traffic polling step:
If an unexpected failure occurs when running the Data Warehouse Center Web traffic polling step, check that you have selected a warehouse source name in Data Warehouse Center when the Web traffic polling has been defined (see Figure A-15).
How to use WSA security and secure connections:
Before you can use DB2 Warehouse Manager Connector for the Web with WSA security and Secure Socket Layer (SSL), you must complete the following prerequisites:
a. Install latest Fixpack for DB2 Universal Database Version 7 b. Configure WebSphere Application Server to use security and SSL. Refer to the WebSphere Application Server documentation, available online through the Information Center, for instructions to set up security and SSL. c. Create a Web server keystore file called Serverkey.kdb that contains one or more client or server certificates. To do this, you can use the Java keytool or IBM iKeyman (which is part of the WebSphere Application Server package). d. Configure the Web server used by WebSphere Application Server for SSL using the keystore that you created in Step c. The default port number is 443.
To use Warehouse Manager Connector for the Web with WSA security and Secure Socket Layer (SSL), follow these steps:
a. Use the Java keytool to export the client and server certificates from the server keystore file Serverkey.kdb. b. Use the Java keytool to create a new keystore file called jssecacerts. Import all the certificates that you exported in the previous step into the jssecacerts keystore file. c. Copy the newly created keystore file jssecacerts into the following directory:
330
Appendix B.
331
332
The steps to define the new SAP R/3 warehouse source are: a. Specify the right type of connection: The connection type can be Application server (see Figure B-2).
333
The connection type can also be Group of servers (see Figure B-3).
When the connection fails, the following error message may appear:
DWC07356E An agents processing of a command of type importSAPBONames failed for edition0of step?. RC=7356 RC2 =8455
334
335
336
d. Define properties of Business Objects: By selecting metadata (parameters) (see Figure B-6)
337
338
2. Define the SAP R/3 process using DWC process model A new process is defined using Data Warehouse Center Process Modeler (see SalesOrder process in Figure B-8).
339
SAP R/3 Data Extract step properties need to be defined following these steps: a. Select Business Object input parameters (see Figure B-9).
340
Column mapping and processing options will also be defined when defining the properties of the SAP R/3 step. 3. Run the step using the DWC Work In Progress panel The new process previously defined SalesOrder Process will be launched using the Data Warehouse Center Work In Progress panel and results will be checked in the target warehouse named SalesOrder_All.
341
B.2 Hints and tips for using the SAP R/3 Connector
The following is a summary of hints and tips you should know about the DB2 Warehouse Manager Connector for SAP R/3:
Performance issues with Windows 2000:
When you are using Windows 2000 and import a business object from SAP, the RSVP.EXE process is automatically run. This process uses all of the processor resources. To avoid this: a. Click Start --> Settings --> Control Panel. b. Double-click the System icon. Click the Advanced tab. c. Click the Environment Variables tab. In the System variable field, click the New button. In the Variable Name field, type: QOSDISABLE In the Variable Value field, type: 1 Click OK
To avoid getting the error Time Limit Exceeded during SAP R/3 Data Extract step processing, that means that the step has exceeded the maximum permitted run time on SAP R/3, ask your SAP System Administrator to change the default value for the system profile parameter rdisp/max_wprun_time from 300 seconds (default value) to 600 seconds or more.
Getting problems to access certain Business Object:
This problem may occur when the key field for the business object selected does not have a corresponding GetList export parameter (Refer to Figure B-7 on page 338). Without this export parameter, parameter mapping cannot be completed. Export parameters, which provide the details about their corresponding key fields, are required to run GetDetail. When parameter mapping cannot be completed, you can run GetList for your business object, but you cannot run GetDetail, which provides specific details about the key field that you have selected. On the other hand, incorrect results in your GetDetail report are the result of mapping a key field to the wrong export parameter.
342
Appendix C.
343
You can use either of two methods to back up the ICM database:
Use the DB2 UDB BACKUP utility: To back up the ICM database, you can use the standard procedures for DB2 backup and recovery. Export all of the data into tag language files: You can export the ICM objects and object types in the form of tag language files from your ICM database. You can also import the Information Catalog Manager tag language files into your ICM database.
344
Appendix D.
345
The program runs as a User Defined Program (UDP), and if everything works satisfactorily, it returns a zero return code. However, if an error of any kind is raised, it will obtain the SQL error message and ensure that this is signalled back to the warehouse server. In turn this is available to be displayed in the error log (through the Work In Progress menus).
/*---------------------------------------------------------------------------*/ /* Function declarations. */ /*---------------------------------------------------------------------------*/ void processErrorInfo(FILE * pLogFileName, SQLRETURN clirc, SQLSMALLINT handleType, SQLHANDLE handle, SQLINTEGER * pSQLCode);
346
/*---------------------------------------------------------------------------*/ /* Main function. */ /*---------------------------------------------------------------------------*/ int main(int argc, char *argv[ ], char *envp[ ]) { char * pDatabase; /* Ptr to DB name string. */ char * pUserid; /* Ptr to User ID string. */ char * pPassword; /* Ptr to password string. */ char * pSQLString; /* Ptr to the SQL to execute. */ char * pLogFileName; /* Ptr to the name of log file. */ FILE * pLogFile = NULL; /* Ptr to the log file. */ SQLHANDLE envHandle; /* CLI environment handle. */ SQLHANDLE connection; /* Handle to the connection. */ SQLHANDLE stmt; /* Handle to the SQL statement. */ int exitcode = 0; /* Final program exit code. */ SQLRETURN clirc; /* Return code form CLI calls. */ SQLINTEGER sqlCode; /* SQL status return code. */ SQLSMALLINT colCount; /* Count of columns in a result set. */
/*-------------------------------------------------------------------------*/ /* Try to get the name of the file to log messages to from the environment */ /* variable, and open the log file. */ /*-------------------------------------------------------------------------*/ pLogFileName = getenv("VWP_LOG"); if (pLogFileName != NULL) pLogFile = fopen(pLogFileName, "w"); /*-------------------------------------------------------------------------*/ /* Validate the command line arguments. */ /*-------------------------------------------------------------------------*/ if ((argc != 5) || (argv[1] == NULL) || (argv[2] == NULL) || (argv[3] == NULL) || (argv[4] == NULL)) { if (pLogFile != NULL) fprintf(pLogFile, "Invalid number of command line arguments.\n Usage: execsql <database> <userid> <password> <SQL>\n"); exitcode = -1; return exitcode; } else { pDatabase = argv[1]; pUserid = argv[2]; pPassword = argv[3]; pSQLString = argv[4]; }
Appendix D. UDP to invoke SQL statements and get SQL codes back
347
/*-------------------------------------------------------------------------*/ /* Init the DB2 CLI environment. */ /*-------------------------------------------------------------------------*/ clirc = SQLAllocHandle(SQL_HANDLE_ENV, SQL_NULL_HANDLE, &envHandle); if (clirc == SQL_SUCCESS) { /*-----------------------------------------------------------------------*/ /* Allocate a connection handle. */ /*-----------------------------------------------------------------------*/ clirc = SQLAllocHandle(SQL_HANDLE_DBC, envHandle, &connection); if (clirc == SQL_SUCCESS) { /*---------------------------------------------------------------------*/ /* Connect to the database. */ /*---------------------------------------------------------------------*/ clirc = SQLConnect(connection, pDatabase, (SQLSMALLINT)strlen(pDatabase), pUserid, (SQLSMALLINT)strlen(pUserid), pPassword, (SQLSMALLINT)strlen(pPassword)); if (clirc == SQL_SUCCESS) { /*-------------------------------------------------------------------*/ /* Allocate a statement handle. */ /*-------------------------------------------------------------------*/ clirc = SQLAllocHandle(SQL_HANDLE_STMT, connection, &stmt); if (clirc == SQL_SUCCESS) { /*-----------------------------------------------------------------*/ /* Execute the SQL. */ /*-----------------------------------------------------------------*/ clirc = SQLExecDirect(stmt, pSQLString, SQL_NTS); if (clirc == SQL_SUCCESS) { /*---------------------------------------------------------------*/ /* If the SQL produced a result set, then try to fetch the first */ /* row. */ /*---------------------------------------------------------------*/ clirc = SQLNumResultCols(stmt, &colCount); if (clirc == SQL_SUCCESS) { if (colCount > 0) { clirc = SQLFetch(stmt); if (clirc != SQL_SUCCESS) { processErrorInfo(pLogFile, clirc, SQL_HANDLE_STMT, stmt, &sqlCode); exitcode = sqlCode; }
348
} } else { processErrorInfo(pLogFile, clirc, SQL_HANDLE_STMT, stmt, &sqlCode); exitcode = sqlCode; } } else { processErrorInfo(pLogFile, clirc, SQL_HANDLE_STMT, stmt, &sqlCode); exitcode = sqlCode; } /*-----------------------------------------------------------------*/ /* Free the statement. */ /*-----------------------------------------------------------------*/ clirc = SQLFreeHandle(SQL_HANDLE_STMT, stmt); if (clirc != SQL_SUCCESS) { processErrorInfo(pLogFile, clirc, SQL_HANDLE_STMT, stmt, &sqlCode); exitcode = sqlCode; } } else { processErrorInfo(pLogFile, clirc, SQL_HANDLE_DBC, connection, &sqlCode); exitcode = sqlCode; } /*-------------------------------------------------------------------*/ /* Disconnect from the database. */ /*-------------------------------------------------------------------*/ clirc = SQLDisconnect(connection); if (clirc != SQL_SUCCESS) { processErrorInfo(pLogFile, clirc, SQL_HANDLE_DBC, connection, &sqlCode); exitcode = sqlCode; } } else { processErrorInfo(pLogFile, clirc, SQL_HANDLE_DBC, connection, &sqlCode); exitcode = sqlCode; }
Appendix D. UDP to invoke SQL statements and get SQL codes back
349
/*---------------------------------------------------------------------*/ /* Free the connection handle. */ /*---------------------------------------------------------------------*/ clirc = SQLFreeHandle(SQL_HANDLE_DBC, connection); if (clirc != SQL_SUCCESS) { processErrorInfo(pLogFile, clirc, SQL_HANDLE_DBC, connection, &sqlCode); exitcode = sqlCode; } } else { processErrorInfo(pLogFile, clirc, SQL_HANDLE_ENV, envHandle, &sqlCode); exitcode = sqlCode; } /*-----------------------------------------------------------------------*/ /* Free the environment handle */ /*-----------------------------------------------------------------------*/ clirc = SQLFreeHandle(SQL_HANDLE_ENV, envHandle); if (clirc != SQL_SUCCESS) { processErrorInfo(pLogFile, clirc, SQL_HANDLE_ENV, envHandle, &sqlCode); exitcode = sqlCode; } } else { if (pLogFile != NULL) fprintf(pLogFile, "Couldn't allocate DB2 CLI environment handle.\n"); exitcode = clirc; }
/*--------------------------------------------------------------------------*/ /* Close the log file, if there is one open. */ /*--------------------------------------------------------------------------*/ if (pLogFile != NULL) fclose(pLogFile); return exitcode; }
350
/*---------------------------------------------------------------------------*/ /* Function to get detailed error information, and print it to the log file. */ /*---------------------------------------------------------------------------*/ static void processErrorInfo( FILE * pLogFile, /* Ptr to file to write log info to. */ SQLRETURN clirc, /* The return code from CLI. */ SQLSMALLINT handleType, /* Type of handle. */ SQLHANDLE handle, /* Handle to get error info from. */ SQLINTEGER * pSQLCode) /* Ptr to var for returning SQL code. */ { char message[SQL_MAX_MESSAGE_LENGTH]; char sqlstate[5]; SQLINTEGER sqlcode; SQLSMALLINT length; SQLSMALLINT i = 1; int warning = 0; /* Set the returned SQL code to success, by default. */ *pSQLCode = 0; /* Special processing for SQL_NO_DATA_FOUND, as this does not put any */ /* diagnostic records on the handle. */ if (clirc == SQL_NO_DATA_FOUND) { /* Set the SQL code to 100 and the SQLState to 02000. */ sqlcode = 100; strcpy(sqlstate, "02000"); /* Return the SQL code. */ *pSQLCode = sqlcode; /* If there's a log file available, write to it. */ if (pLogFile != NULL) { fprintf(pLogFile, "<RC>%ld</RC>\n", sqlcode); fprintf(pLogFile, "<MSG>SQL0100W No row was found for FETCH, UPDATE or DELETE; or the result of a query is an empty table.</MSG>\n"); fprintf(pLogFile, "<WARNING>1</WARNING>\n"); fprintf(pLogFile, "<SQLSTATE>%s</SQLSTATE>\n", sqlstate); } } else { /* If CLI returned SQL_SUCCESS_WITH_INFO then treat it as a warning. */ if ((clirc == SQL_SUCCESS_WITH_INFO) || (clirc == SQL_NO_DATA_FOUND)) warning = 1;
Appendix D. UDP to invoke SQL statements and get SQL codes back
351
/* Loop through all the messages for the handle. */ while (SQLGetDiagRec(handleType, handle, i, sqlstate, &sqlcode, message, SQL_MAX_MESSAGE_LENGTH + 1, &length) == SQL_SUCCESS) { /* Return first SQL return code to caller, unless we're processing a */ /* warning, in which case it's just left as success. */ if ((i == 1) && !warning) *pSQLCode = sqlcode; /* If there's a log file available, write to it. */ if (pLogFile != NULL) { fprintf(pLogFile, "<RC>%ld</RC>\n", sqlcode); fprintf(pLogFile, "<MSG>%s</MSG>\n", message); if (warning) fprintf(pLogFile, "<WARNING>1</WARNING>\n"); fprintf(pLogFile, "<SQLSTATE>%s</SQLSTATE>\n", sqlstate); } i++; } } }
Remember that this code is currently Windows only so it will require to run via a Windows agent. If you have to run from agent in UNIX then you will need to re-compile and make the file under UNIX.
352
Other uses of the EXECSQL code which come to mind are: To check that timestamps in one or more warehouse or mart tables conform to timestamps held in a control table To check that the number of rows in a recently updated table are equal to the number of rows before the process started plus the number of rows in the original input table To check that all the values of a particular column in a fact table are contained in the relevant dimension table To use this EXECSQL code: Register it as a User Defined Program with parameters of database, userid, password and SQL string, all of which are character strings (see Figure D-1).
Define parameters of database, userid, password and SQL string, all of which are character strings. The character strings have to be enclosed in double quotes so SAMPLE should be SAMPLE (see Figure D-2).
Appendix D. UDP to invoke SQL statements and get SQL codes back
353
354
Supply the values for database, userid, password and the SQL string to be executed. Figure D-4 shows the use of RAISE_ERROR to help get your own messages into the DB2 Warehouse Manager log. This example will check the number of rows in a table ORG and give an error if there are not 9 rows.
Appendix D. UDP to invoke SQL statements and get SQL codes back
355
Promote the step and test it using the Work in Progress mechanism. If the SQL string executes with a return code of 0 then the step will be successful. If for some reason the SQL fails (this can be intentional for example you can use the RAISE_ERROR function within an SQL statement) then the EXECSQL code will return a none zero return code equal to the SQL code. Additional information will be supplied in the DB2 Warehouse Manager log, viewable from the Work in progress window (see Figure D-5).
356
Appendix E.
357
358
2. Run the command (db2move DBTEST export tn) listing a maximum of 10 tables after tn separated by commas:
db2move DBTEST export -tn BNFT_GP_DESC_LOOKUP, CLAIM_TYPE_DISTINCT, GRP_BAND_DESC_LOOKUP, HLTH_CTR_STAGING_SRC, NDC_FREQ_INCR_STAGING, NDC_SRC_INCR_STAGING, PLN_PROD_TYP_UPDATE_SRC, PROVIDER_INCR_STAGING
3. Issue the command db2move DBPROD import to replace_create the tables. This command must be issued from the same directory that the export files were created in. 4. After all SCHEMA1 and SCHEMA2 tables have been created in the production database, log in to Data Warehouse Center and locate warehouse targets. 5. Right-click Test Database Target and select Properties. 6. Change the Name to Production Database Target under the Warehouse Target tab. 7. Under the Database tab, change the Database name to DBPROD and click OK. All processes will now run in the production database. In addition to the warehouse target switch, the following must also be updated: The DATABASE parameter in all autoloader configuration scripts should be updated to DBPROD CONNECT TO DBPROD should be added to the top of all SQL scripts and TERMINATE should be added to the bottom Because the default connection database for the Warehouse ID is DBTEST, you should remember to CONNECT TO DBPROD when needing to query or change tables in production. When in doubt, issue the following command on a DB2 command window:
359
The production warehouse control database, DWCTRLDB, must be the active warehouse control database on the warehouse server so that the production programs can run on its schedule. Since a server or workstation can have only one active warehouse control database at a time, the test warehouse control database has to run on its own server or workstation. The DWTESTDB warehouse control database will be initialized on the workstation by running Control Database Management. This program sets the active warehouse control database on the workstation to DWTESTDB allowing DB2 Warehouse Manager services to run. When you wish to connect to the test or production databases from your workstation, you proceed to logging in to the Data Warehouse Center. At the log in screen, you press Advanced button and enter the warehouse control database you wish to connect to: When connecting to the production warehouse control database, enter DWCTRLDB as the Control Database and production server name as the server host name. When connecting to the test warehouse control database, enter DWTESTDB as the Control Database and Test server name as the server host name. The server service name, vwkernel, does not change when connecting to either warehouse control database. Since both databases reside on the same server, there is no need to change the Server host name. Since the test warehouse control database is originally a restoration of the production warehouse control database, all of the programs point to the production database. To point the DWTESTDB database to the test database, follow the procedure outlined in Appendix E.1, Test to production initial migration on page 357.
360
Once the tables are created in the production database, the database administrators will restore a copy of DTESTDB to the production warehouse control database name, DWCTRLDB which will restore on top of the old production warehouse control database name, DWCTRLDB. Log in to the production warehouse control database, DWCTRLDB, and change the warehouse target to point to production database. Due to necessity to keep both databases in synchronization, the production jobs in both databases should be secured and have limited access.
361
362
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 365.
Getting Started with Data Warehouse and Business Intelligence, SG24-5415 Business Intelligence Certification Guide, SG24-5747 Building the Operational Data Store on DB2 UDB, SG24-6513 Migrating to DB2 UDB Version 7.1 in a Visual Warehouse Environment, SG24-6107 IBM ESS and IBM DB2 UDB Working Together, SG24-6262 Implementing ESS Copy Services ON UNIX and Windows NT/2000, SG24-5757 Backing Up DB2 Using Tivoli Storage Manager, SG24-6247 WOW! DRDA Supports TCP/IP: DB2 Server for OS/390 and DB2 Universal Database, SG24-2212
Other resources
These publications are also relevant as further information sources:
DB2 UDB Data Recovery and High Availability Guide and Reference, DATA-RCVR DB2 UDB Troubleshooting Guide, GC09-2850 DB2 For Windows Quick Beginnings, GC209-2971 DB2 Warehouse Manager Installation Guide, GC26-9998 DB2 UDB Administration Guide: Planning, SC09-2946 DB2 UDB Administration Guide: Performance, SC09-2945 DB2 UDB Administration Guide: Implementation, SC09-2944 DB2 UDB Command Reference, SC09-2951
363
DB2 UDB Data Movement Utilities Guide and Reference, SC09-2955 DB2 UDB Data Warehouse Center Administration Guide, SC26-9993 DB2 UDB Data Warehouse Center Application Integration Guide, SC26-9994 DB2 Warehouse Manager Managing ETI Extract Conversion Programs with DB2 Warehouse Manager, SC27-1268 DB2 Query Patroller Installation Guide, GC09-2959 DB2 Query Patroller Users Guide, SC09-2960 DB2 Query Patroller Administration Guide, SC09-2958 Information Catalog Manager Users Guide, SC26-9996 Information Catalog Manager Administration Guide, SC26-9995 OLAP Setup and Users Guide, SC27-0702 OLAP Integration Server Model Users Guide, SC27-0783 OLAP Integration Server Metaoutline Users Guide, SC27-0784 OLAP Integration Server Administration Guide, SC27-0787 Data Mining with IBMs Intelligent Miner, GC27-1236 Intelligent Miner Scoring V7R1 Administration and Programming for DB2, SH12-6719 DB2 UDB Installation and Configuration Supplement, GC09-2957 DB2 UDB Message Reference, Volume 1, GC09-2978 DB2 UDB Message Reference, Volume 2, GC09-2979 Replication Guide and Reference, SC26-9920 SQL Reference, Volume 1, SC09-2974 SQL Reference, Volume 2, SC09-2975 AIX Version 4.3 Differences Guide, SG24-2014 DB2 UDB for z/OS and OS/390 ODBC Guide and Reference, SC26-9005 DB2 UDB for z/OS and OS/390 Installation Guide, GC26-9008 DB2 Enterprise Extended Edition for UNIX Quick Beginnings, GC09-2964 Program Directory for IBM DB2 UDB Server for z/OS and OS/390 DB2 Warehouse Manager, GI10-8221 Program Directory for IBM DB2 Warehouse Manager Sourcing Agent, GI10-8244
364
You can also download additional materials (code samples or diskette/CD-ROM images) from that site.
Related publications
365
366
Index
A
ABAP 26 actions unpredictable 37 adaptability 3 administration 170 administrative client 148 agent 4, 1617, 21 AIX 22 AS/400 23 daemon 17, 240 default 8, 17 distributed 89 iSeries 23, 250 local 17, 240 logs 35, 244, 248 messages 240 multiple agents 16, 310 OS/2 23 OS/390 23 remote 17, 240 SUN Solaris 22 Windows NT/2000 22 agents 5 AIX 5, 8, 23 API 72 application 231 design 287, 292, 306 restartable 288 architecture 20 layers 3 archived logs 40 AS/400 39 Ascential 7 assistance 286 automation 2, 13, 16, 140 AUTORESTART 45, 106 availability 3, 113, 289 continuous 121 average 11 AIX splitcopy 136 associated files 43 automation 173 DB2 UDB 174 Windows 173 buffer size 68 control files 48 cost 41 cumulative 52 database 63 delta 52 full database 40, 48, 52 image 63 incremental 51 information 60 management 140 methods 41 notebook 65 offline 41, 48, 52 online 41, 50 parameter files 48 partitioned database 87 pending state 85, 197, 203 performance 68 planning 41 procedures 39 restrictions 69 schedule 40, 47 speed 41 system catalog tables 48 tablespace 40, 50 user tables 48 using Data Warehouse Center 224 using different operating system 43 verification 142, 144 window 41, 119 wizard 65 bandwidth 52 BAPI 26 GetDetail 26 GetList 26 block fetching 19 BO 26 BOR 26
B
backup 36
367
browser 24 business data 26 events 26 rules 2, 26 transactions 26 Business Application Programming Interface 26 Business Object Repository 26 Business Objects 2627, 335
location 60 point-in-time 123 time 60 correlation 11 crash 33 recovery 44 CURRENT TIMEZONE 50 CUT 50, 200, 202 CWM 15
C
Call Level Interface 21, 272 capacity planning 306 cascading 105 catalog partition 88 chi-square 11 cleansing 2 name and address 29 CLI 21, 272 clickstream data 23 client administrative 5 Client Access 251 CLP 65, 71, 79, 154 cluster 100, 104, 122 collocated 303 Commerce data 23 commit 44 Common Warehouse Metamodel 15 communication 239, 306 concurrency 15 configuration 1920, 31 connectivity 21 Connector 9 connector 6 for SAP R/3 23, 26, 259, 331 tips 342 for the Web 23, 313 tips 327 consistency 42 bits 111 constraints 26, 290, 305 container 72, 119 deletion 181 error 207 resize 207 Coordinated Universal Time 50, 200 copy
D
data adding data from external sources 2 calculating 2 changes 52 cleansing 2, 5 consistency 26, 42 converting codes 2 corruption 112 damaged 42 exception 305 flow 20 geo-coding 2 loading 13 lost 42 movement 11, 13, 15, 88, 292 persistent 26 reconciled 2 relationships 4243, 51 transforming 13 data exception 305 data import 2425, 314 notification 319 data sources 5, 21 multiple 2 register 14 data stripe mirroring 114 data warehouse 2, 5 accessing 4 building 4 designing 34 governing 4 maintaining 4 multi-tiered 13 population 2 Data Warehouse Center 5, 8, 13, 16, 147, 151, 313, 321, 331 error message 259
368
error token 233 Infocenter 258 logon 263 shut down 152 database backup 47 cloned 131 configuration file 46, 56, 75, 169 corrupted 63 damaged 44, 63 frozen state 133 local 1819 non-recoverable 75 partition 69 prior state 82 remote 20 restart 45 restore 70 performance 76 to a new database 75 to an existing database 74 restore command 71 rollforward 131 rollforward recovery 49 shut down 48, 63 standby 93 database administrator 30, 359 database partition 105 DataJoiner 19 datamart 2, 4 designing 3 population 2 DataStage 7 data-striping 114 dates converting 291 DB2 Call Level Interface 272 DB2 Command Line Processor 65, 71, 79, 154 DB2 Control Center 13 DB2 Information Center 232, 234 DB2 Journal 158, 163, 168, 174, 178 db2 list history 200 DB2 OLAP Server 13, 15 DB2 private protocols 1920 DB2 Scheduler 174 DB2 Script Center 174 DB2 Suspended I/O feature 121, 126 DB2 UDB 6, 1314, 21, 24, 147 Control Center 8
DB2 UDB Enterprise - Extended Edition 105 DB2 UDB Enterprise Edition 8 DB2 UDB for OS/400 6 DB2 UDB for z/OS and OS/390 6 DB2 Warehouse Manager 5, 8, 23, 26 administration 147, 149 components 1, 4 configuration 148 DB2 XML Extender 29 DB2_PARALLEL_IO 119 db2adutl 140, 144, 171 db2ckbkp 66, 142, 170 db2diag.log 181 db2inidb 99, 126 db2level 268 db2look 90 db2move 44, 89 db2mscs 108 db2set 90, 119 development 147148, 151, 224 devices 112 diagnostic 251, 254 disaster recovery 39, 69, 92 standby via replication 94 transport of database backup 93 transport of logs 93 disk arrays 113 copy 120 corrupted 35 error 207 mirroring 96, 112, 116 parity 117 raid arrays 36 swapping 36 DRDA 1920 dropped table recovery 86, 197, 216 restrictions 219 duplexing 116 DWC 16
E
emergency 63 error application 53 code 233 communication 284 coverage 104
Index
369
disk 33, 81 GUI 244 log 234, 346 message 232233, 238 operating system 37 stored procedure 310 TCP/IP connectivity 284 token 234, 258 Error Correction Code 117 Erwin 15 ESS Advanced Copy Services 119, 121, 123 ETI ETI*Extract 5, 7, 15 ETML 288 architecture 1 logical layers 3 physical components 3 export 13, 44, 90, 92, 151 eXtended Markup Language 15 Extract Transform Move Load 1 extraction 15, 19, 289 automation 289 export 15 frequency 289 import 15 load 15 scheduling 326 SQL SELECT 15 status 320 user-written 15
scenarios 37 software 34 source 32 step 294 storage 147 warehouse server 33, 270 warehouse target 33 failure scenarios 40 failures consequences 31 feedback log 254 File Transfer Program 22 fixpacks 231, 268, 270 check 268 FlashCopy 120, 122123, 133 flat files 6, 11, 1314, 21 LAN 22 z-OS and OS/390 22 FormatDate 291 framework 3 FTP 22 message log 250 program 250 trace file 250 servers 24
G
granularity 82 graphical process modeler 13 graphical user interface 5, 8 GUI 5, 231
F
failover 97, 100, 103104 hot standby 106, 110 mutual takeover 107, 110 failure 3031, 234 agent 36 application 147 communication 32, 36 DB2 Warehouse Manager components 229 disk 111 hardware 31, 229, 271 media 72, 112, 147 network 33 ping 286 point of failure 113 power 40, 45, 53, 147 process 294
H
HACMP 99, 103104 configuration 105 HAGEO 95 hardware error 207 heartbeat 104 heartbeat monitoring 100 high availability 36 techniques 97, 229 High Availability Cluster Multi-Processing 99 high service level 36 Highly Available Geographic Cluster 95 history file 170, 221 HTTP servers 24 Hyperion Essbase Server 13
370
I
IBM Enterprise Storage Server 119 IBM ESS 130, 133 IBM Support 239, 248, 259, 268, 270, 286 idle 102 import 44, 90, 92, 151, 361 ordering 226 IMS 6, 22 Data Propagator 22 inconsistencies 197 incremental commit 32, 302 InfoCenter 24 Information Catalog 5, 20 Information Catalog Manager 5, 9, 15, 20, 63, 231 backup 343 configuration 344 Informix 5, 14, 21 integrity 39, 66, 142, 290 Intel 39 interval parameter 294 iSeries 5, 9, 32, 39 load programs 250251 iwh2exp2 227 iwh2imp2 228
J
Java 28 jobs 178, 271 Journaled File System 98, 134
mirrored 135 logretain 48, 50, 5253, 58, 149 logs 49, 75, 112, 131132, 281 active 53, 113 deletion 112 archive 53, 63, 149 buffer 57 capture 52, 55 circular 36, 52, 149 integrity 111 list history 143 mirrored 136 mirroring 113 offline archived 54 online archived 54 primary 269 primary logs 57 prune 58 secondary 53, 269 secondary log 57 shipping 93, 99 size 57, 269 space 150 logsecond 57 lost data 41 Lotus 1.2.3 6 Lotus Notes 6
M
malfunctions 35 manager 5 mapping 293, 338 message iSeries 278 type 280 message queues 22 messages queue 29 metadata 5, 9, 13, 1516, 2627, 29, 39, 151, 219, 224, 269, 337 business 20 errors 246 export 225 performance 227 import 226 performance 227 interchange 15 migration 226 publishing 20
L
LAN 66 LIST HISTORY 60 listening 241 load 44, 90, 292293 program trace file 251 LOB 219 Local Area Network 66 locking 83 log forwarding 93 primary 53, 57 sequence number 60 logbufsz 57 logfilsiz 57 logging 52 dual 112 logical volume
Index
371
Microsoft Cluster Server 99 Microsoft SQL Server 5, 14, 21 migration 151, 224, 357 mirroring 111112 asynchronous 122 dynamic synchronous 122 logical volumes 134 Mission Critical Linux 99 monitoring 16, 104, 297 monitoring facility 13 MQ-Assist wizard 28 MQSeries 6, 22, 28 MQSeries messages 28 MSCS 99, 103, 108 configuration 109 Multi-Computer/ServiceGuard 99 mutual takeover 101, 103, 105
outage 98
P
parallelism 68, 76, 87 partition 88 partitioned database 103, 289 patches 231, 268 Peer-to-Peer Remote Copy 122 pending state 49 performance 16, 19, 113114, 117118, 231 advice 306 checklist 311 issues 287 problem 281 SAP R/3 connector 342 stored procedure 308309 system 307 VARCHAR 308 physical volume split off 135 planning 92 point of control 5 point-in-time 122 polling step 25 PPRC 95, 122 prerequisites 23, 26 problem analysis procedure 281 cause 230 CLI 273 communication 281 database access 272 DB2 CLI 272 determination 230, 232, 241 DRDA 276 fixing 230 network 284 process 281 source identification 230, 241 warehouse control database 282 process 11, 287 definition 295 in flight 35 monitoring 13 operability 302 SAP R/3 339 SQL 18 transformation 16
N
named pipes 67 naming convention 226, 293 near real time 28 network 231 bandwidth 15 Network File System 22 NFS 22 nodes 100, 104 logical 105 notification 319
O
objects models 26 ODBC 5, 21, 272 generic ODBC driver 6 sources 13 OLAP Server program 250, 254 program trace 254 OLE-DB 6, 1314, 28 operating system error 267, 271 Operational Data Stores 4 operations 231 Oracle 5, 14, 21, 24 orthogonal RAID-5 118 OS/2 5, 8 OS/390 5, 39 OS/400 5
372
production 147148, 151, 224, 357 program malfunction 308 project 25 pSeries 5
Q
QMF for Windows 6, 9, 29 queries 30 govern 30 long running 6 workload 30 query and reporting tool 5 Query Patroller 9, 30 queues 6, 1314 quiesce 51, 83 exclusive mode 83 in share 83 intent 83 reset 83
R
RAID 111, 113 DB2 UDB 119 RAID-0 114115, 117 RAID-1 114, 116, 118 RAID-5 114, 117118 real time 24 recommendations 31, 37, 147, 229, 292, 331 recovery 35 AIX splitcopy 137 crash 53, 129 critical tables 85 disaster 62 dropped table 85 end of the logs 50 history file 59 prune 62 retention period 61 minimum time 197 partitioned database 69 point-in-time 42, 4950, 69, 82 procedures 39, 41 remote site 95 restore database command 47 rollforward 48 speed 41 strategy 40
time 60 unit of recovery 42, 51 using Data Warehouse Center 224 version recovery 47 WITHOUT ROLLING FORWARD option 47 Redbooks Web site 365 Contact us xxiv redirect 73 redundancy 111, 114 Redundant Arrays of Inexpensive Disks 113 referential integrity 83 regression 11 relational database 13, 21 reliability 3 remote mirroring 95 site 122 replication 13, 15, 52, 55, 292, 306 reports 24 requirements build-time 3 run-time 3 resources utilization 30, 307 response time 306 restart 34, 41 restartability 32 restore 99 buffers 76 size 76 method 48 partitioned database 88 restart 222 restrictions 77 without rolling forward 223 wizard 71 retry parameter 294 return code 233, 250251, 254 RC1 239 reusability 3 RFC 26, 259 rollback 4445 rollforward 77 examples 80 invoking 79 partitioned database 88 pending state 49, 81 restart 222 restrictions 86
Index
373
S
SAN 123 SAP Connector 259 SAP R/3 1314, 26 SAPGUI 26 scalability 4 scheduling 13 security 3 service level 2, 41 SET files 248 sockets 239 software corrupted 35 Solaris 8 source 17, 21 error 36 local 20 recovery 32 remote 19 split mirror 97, 99, 119, 129130 backup image 132 to clone a database 129 splitcopy AIX 134 SQL error 32 SQL step 25 SQLOGDIR 58 sqlrestore 72 standby 99, 102 hot 104 idle 104 standby machine 99 star schema 24 statistics 16, 291, 301 Steeleye 99 step 11, 287 checking 345 definition 294 design 302 execution 302 failure 296, 301 in flight 35 number of rows 301 number of steps 293
on demand 12 processing option 296 program 296 SQL 11, 296, 303 success 301 transformer 11, 296, 304 UDP 303 user-defined program 296 Web Traffic Polling 321 steps 35 storage 66, 98 devices 67 management 138 off-site 63 problems 40 space 40 stored procedures 11, 2829, 40, 290 subtotals 11 summary records 306 summary tables 11 Sun Cluster 99 SUN Solaris 5, 23 Sybase 5, 14, 21 synchronization 359 system catalog 49, 81, 197 system catalogs 309
T
table frozen 51 function 28 histories 15 tablespace critical 69 drop 49 list 82 quiesce 83 redirected restore 72 rollforward recovery 49 status 62 tag file 151, 225226, 282 move 226 target 17 error 36 table 1820 TCP/IP 22, 284 test 293, 311, 357 testability 3
374
threads 239 throughput 306 time-out 3233, 37 Tivoli Storage Manager 64, 138, 144, 171 API 140 Backup-Archive client 139 tools data administrator tools 6 trace 242 CLI 244, 246, 274 Connector 244 Control Center 244 level 1 247 level 2 247 level 3 247 level 4 247 level 5 248 message queue 244, 249 ODBC connectivity 244 transformer 244, 254 UDP 244, 249 warehouse server 244, 247 traffic 314 transactions 44, 77, 83, 129 transformations 11, 147, 239, 290 built-in 15 cube load and precalculation 15 integrating products 5 SQL 15 statistical 5 user-defined 5 transformer User-Defined Function 290 transformers 11, 15 clean 11, 290 generate period tables 11 generate primary keys 11 pivot 11 scheduled 12 statistical 11, 290 to invert 11 warehouse 290 triggers 197, 290 Trillium Batch System 7 Trillium Software System 29 troubleshooting 26, 234 TSM 64, 76, 171
U
UDF 29 UDFs 40 UDP 12, 29, 248, 301 program example 346 scripts 293 using 352 UNICODE 315 unit of work 44, 53, 302 incomplete 45 UNIX 8, 32, 39, 64, 67 UOW 44 user checklist 265, 271, 292, 302, 304 corruption 35 error 231, 262, 271 User Defined Function 11, 40 User Defined Program 17, 240, 248 user-defined program 12 userexit 48, 50, 58, 149 users 5, 20
V
Vality INTEGRITY 15 Integrity 5, 7 VERITAS Cluster Server 99 view 28 VSAM 6, 22
W
warehouse development 11 log 32 management 13 infrastructure 4 population 15 process 16 warehouse agent 11, 16, 23, 26, 231, 240, 272 distributed 4 local 5 monitoring 149 remote 5 warehouse control database 16, 20, 39, 63, 147, 231, 264, 268 backup 147 backup verification 169171 corrupted 219, 246
Index
375
delta backup 168 incremental backup 168 migration 246 offline backup 154155 online backup 159 point-in-time recovery 197198, 204 recovery 151 reinstate 35 restore recovery 181, 183 rollforward recovery 36, 149, 185 standby 219 tablespace backup 164 tablespace redirected recovery 207208, 210 tablespace rollforward 187, 191 warehouse server 5, 8, 16, 18, 32, 148, 230231, 239, 286, 346 crash 34 warehouse source 11, 22, 25, 2729, 231, 240, 321, 331 corruption 32 warehouse target 11, 29, 39, 231, 240, 295, 321 Web 1314 site health 23 traffic measures 23 visitor behavior 23 Web channel 23 Web server log 318 Web Tracker 24, 317 Webmart 2425, 314, 321 WebSphere Application Server 2324, 316 WebSphere Commerce Server 24 WebSphere Commerce Suite 316 WebSphere Edge Server 24 WebSphere MQ 6, 1314, 22, 28 WebSphere Personalization Server 24 WebSphere Portal Server 24 WebSphere Site Analyzer 24, 258, 313 Windows 2000 5, 1617, 23, 26 NT 5, 1617, 23, 26 Windows 2000 8, 63, 239 Windows NT 8, 63, 239 Wolfpack 103 workflow 16, 297 workload 30 write suspend 130, 132 WSA 24, 258 Infocenter 315
project 315
X
XML 15, 29 XRC 122
Z
z/OS 5, 39 zSeries 5, 9, 32
376
Back cover
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.