TSM DB2 Backup Management
TSM DB2 Backup Management
TSM DB2 Backup Management
Covers all aspects of protecting DB2 databases on multiple platforms Backup, restore, and disaster recovery Practical scenarios and how-tos
Deirdre Hewgill Art Balingit Martin Bruegger Wolfgang Postl James Thompson
ibm.com/redbooks
SG24-6247-00
International Technical Support Organization Backing up DB2 with IBM Tivoli Storage Management
Take Note! Before using this information and the product it supports, be sure to read the general information in Notices on page 321.
First Edition (May 2001) This edition applies to Version 4, Release 1 of Tivoli Storage Manager, Program Number 5698-TSM and Version 7, Release1 of IBM DB2 UDB, Program Number 5648-D48, for use with the IBM AIX, Sun Solaris,HP-UX and Microsoft Windows NT and Windows 2000 operating systems. 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 2001. 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 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 11 Tables. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 17 Preface . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 19 The team that wrote this redbook. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 19 Comments welcome. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 21 Part 1. Tivoli Storage Manager and DB2 primer . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1 Chapter 1. Tivoli Storage Manager for database administrators . 1.1 Introducing Tivoli Storage Management . . . . . . . . . . . . . . . . . . . 1.1.1 Tivoli Storage Manager Backup-Archive client . . . . . . . . . . 1.1.2 Tivoli Storage Manager API . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .3 .3 .5 .5
Chapter 2. Relational databases and DB2 UDB product overview . . . . 7 2.1 Fundamentals of Relational Database Management Systems . . . . . . . 7 2.1.1 Database . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 7 2.1.2 Tables . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 7 2.1.3 Indexes . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 8 2.1.4 Tablespaces . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 9 2.1.5 Partitioning options . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 11 2.1.6 Log files . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 11 2.1.7 Control files . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 13 2.1.8 Configuration parameters . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 13 2.2 DB2 UDB concepts . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 13 2.2.1 DB2 UDB products . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 14 2.2.2 Instance . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 16 2.2.3 Database and database partitions . . . . . . . . . . . . . . . . . . . . . . . 16 2.2.4 Nodegroups . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 17 2.2.5 Tablespaces . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 17 2.2.6 Recovery logs. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 18 2.2.7 Recovery history file . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 19 Chapter 3. Planning considerations 3.1 Backup requirements . . . . . . . . . . 3.1.1 Types of events . . . . . . . . . . 3.1.2 Speed of recovery . . . . . . . . 3.1.3 Backup windows . . . . . . . . . . 3.1.4 Recovery points . . . . . . . . . . 3.1.5 Units of recovery . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 21 . 21 . 22 . 24 . 24 . 25 . 25
3.1.6 Backup of RDBMS supporting files . . . . 3.2 Backup techniques . . . . . . . . . . . . . . . . . . . . 3.2.1 Disk mirroring . . . . . . . . . . . . . . . . . . . . 3.2.2 Offline backup . . . . . . . . . . . . . . . . . . . 3.2.3 Online backup . . . . . . . . . . . . . . . . . . . 3.2.4 Database export . . . . . . . . . . . . . . . . . . 3.2.5 Full database backup . . . . . . . . . . . . . . 3.2.6 Partial database backup . . . . . . . . . . . . 3.2.7 Incremental backup . . . . . . . . . . . . . . . 3.2.8 Log file backup (simulated incremental) 3.2.9 LAN-free backup . . . . . . . . . . . . . . . . . 3.2.10 Backup using split mirror features. . . .
. . . . . . . . . . . .
. . . . . . . . . . . .
. . . . . . . . . . . .
. . . . . . . . . . . .
. . . . . . . . . . . .
. . . . . . . . . . . .
. . . . . . . . . . . .
. . . . . . . . . . . .
. . . . . . . . . . . .
. . . . . . . . . . . .
. . . . . . . . . . . .
. . . . . . . . . . . .
. . . . . . . . . . . .
. . . . . . . . . . . .
. . . . . . . . . . . .
. . . . . . . . . . . .
. . . . . . . . . . . .
. . . . . . . . . . . .
. 25 . 26 . 26 . 27 . 27 . 28 . 28 . 29 . 29 . 30 . 30 . 31
Chapter 4. Tivoli Storage Manager server considerations. . . . . . . . . . 33 4.1 Initial requirements . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 33 4.2 Tivoli Storage Manager server base functionality explained . . . . . . . . 33 4.2.1 Registering a node with the Tivoli Storage Manager server . . . . 34 4.2.2 Installing the Tivoli Storage Manager client. . . . . . . . . . . . . . . . . 34 4.2.3 Configure the Tivoli Storage Manager client . . . . . . . . . . . . . . . . 35 4.3 Tivoli Storage Manager data objects . . . . . . . . . . . . . . . . . . . . . . . . . 35 4.3.1 Archive or backup object . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 36 4.3.2 Managing Tivoli Storage Manager data objects . . . . . . . . . . . . . 36 4.3.3 Management class to which to bind object . . . . . . . . . . . . . . . . . 39 4.3.4 Life cycle of Tivoli Storage Manager data objects . . . . . . . . . . . . 43 4.4 Tivoli Storage Manager server considerations for UDB DB2 backups . 46 4.4.1 How UDB DB2 stores data objects . . . . . . . . . . . . . . . . . . . . . . . 47 4.5 Policy management considerations . . . . . . . . . . . . . . . . . . . . . . . . . . 47 4.5.1 Domain considerations . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 47 4.5.2 Tivoli Storage Manager management class considerations . . . . . 48 4.5.3 Tivoli Storage Manager client include-exclude option . . . . . . . . . 50 4.6 Node considerations. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 53 4.6.1 Choosing a nodename . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 53 4.6.2 Choosing a password . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 54 4.6.3 Setting the BACKDELETE option . . . . . . . . . . . . . . . . . . . . . . . . 54 4.6.4 Setting the ARCHDELETE option . . . . . . . . . . . . . . . . . . . . . . . . 54 4.6.5 Specifying the domain . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 54 4.6.6 Setting the MAXNUMMP . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 54 4.7 Storage pool considerations . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 55 4.8 Our Tivoli Storage Manager server setup . . . . . . . . . . . . . . . . . . . . . . 56
Part 2. Backing up DB2 on UNIX platforms . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 59 Chapter 5. Backing up DB2 on AIX using Tivoli Storage Manager . . 5.1 System requirements . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 5.2 Installation of Tivoli Storage Manager related software. . . . . . . . . . . 5.2.1 Verification of Tivoli Storage Manager client API installation. . . 5.3 Configuration and setup of Tivoli Storage Manager client API . . . . . 5.3.1 API client setup . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 5.4 Setting up the DB2 user exit for Tivoli Storage Manager. . . . . . . . . . 5.4.1 Compile the user exit for Tivoli Storage Manager . . . . . . . . . . . 5.4.2 Enable the database for roll-forward recovery. . . . . . . . . . . . . . 5.5 Optional DB2 configurations . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 5.6 Using the Tivoli Storage Manager baclient in conjunction with DB2 . 5.6.1 Using the baclient include/exclude file . . . . . . . . . . . . . . . . . . . 5.6.2 Using the archive utility. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 5.7 Backing up DB2 using Tivoli Storage Manager . . . . . . . . . . . . . . . . . 5.7.1 Full offline backup . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 5.7.2 Online database backup . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 5.7.3 Tablespace backup . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 5.7.4 Load utility . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . Chapter 6. Backing up DB2 UDB on the Sun Solaris platform. . 6.1 Installation of Tivoli Storage Manager related software. . . . . . . 6.1.1 System requirements . . . . . . . . . . . . . . . . . . . . . . . . . . . . 6.1.2 Installing the Tivoli Storage Manager client. . . . . . . . . . . . 6.2 Configuration and setup of Tivoli Storage Manager client API . 6.2.1 Setup prerequisites . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 6.2.2 Define the environment variables . . . . . . . . . . . . . . . . . . . 6.2.3 Create the Tivoli Storage Manager configuration files . . . . 6.3 Setting up the DB2 user exit for Tivoli Storage Manager. . . . . . 6.3.1 Compile the user exit for Tivoli Storage Manager . . . . . . . 6.3.2 Enable the database for roll-forward recovery. . . . . . . . . . 6.4 Using Tivoli Storage Manager baclient in conjunction with DB2 6.5 Backing up DB2 using Tivoli Storage Manager . . . . . . . . . . . . . 6.5.1 Full offline backup . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 6.5.2 Online database backup . . . . . . . . . . . . . . . . . . . . . . . . . . 6.5.3 Tablespace backup . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 6.5.4 Load utility . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 61 . 61 . 61 . 62 . 63 . 64 . 67 . 68 . 69 . 69 . 71 . 72 . 72 . 73 . 73 . 78 . 83 . 88
Chapter 7. Day to day management: DB2 backups on UNIX . . . . . . . 119 7.1 The db2adutl utility . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 119 7.2 Information about backups using Tivoli Storage Manager commands121 7.3 Verification of DB2 backups . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 124
7.3.1 Verify backup using db2ckbkp . . . . . . . . . . . . . . . . . . . . . . . . . 124 7.3.2 Verification using DB2 list history . . . . . . . . . . . . . . . . . . . . . . . 125 7.3.3 Verification using db2adutl . . . . . . . . . . . . . . . . . . . . . . . . . . . . 126 7.3.4 Sample script for backup and verification . . . . . . . . . . . . . . . . . 128 7.3.5 Automatic notification for user exit failure . . . . . . . . . . . . . . . . . 129 7.4 Deletion of backups and logfiles . . . . . . . . . . . . . . . . . . . . . . . . . . . . 131 7.4.1 Deletion of backup objects . . . . . . . . . . . . . . . . . . . . . . . . . . . . 131 7.4.2 Deletion of logfiles . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 131 7.4.3 Automated deletion of backups and logfiles . . . . . . . . . . . . . . . 133 7.5 Automation of DB2 backup . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 134 7.5.1 Automate DB2 backup using cron. . . . . . . . . . . . . . . . . . . . . . . 134 7.5.2 Automate DB2 backup using DB2 . . . . . . . . . . . . . . . . . . . . . . . 135 7.5.3 Automate DB2 backup using Tivoli Storage Manager . . . . . . . . 141 7.6 Maintaining the history file . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 145 Part 3. Backing up DB2 on the Windows 2000 platform . . . . . . . . . . . . . . . . . . . . . . . 147 Chapter 8. Backing up DB2 on Windows 2000 . . . . . . . . . . . . . 8.1 Registering a node on the TSM server for DB2 backups. . . . . 8.2 Downloading latest Tivoli Storage Manager baclient and API . 8.3 Installation . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 8.4 Configuring the API . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 8.5 Configuring the client options file . . . . . . . . . . . . . . . . . . . . . . 8.6 Generating the encrypted password . . . . . . . . . . . . . . . . . . . . 8.7 Setting up the DB2 user exit for Tivoli Storage Manager. . . . . 8.7.1 Modifying the user exit . . . . . . . . . . . . . . . . . . . . . . . . . . 8.8 DB2 Tivoli Storage Manager configuration values . . . . . . . . . 8.9 Backing up DB2 using Tivoli Storage Manager . . . . . . . . . . . . 8.9.1 Full offline backup . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 8.9.2 Full online backup . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 8.9.3 Tablespace backup . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 149 . 149 . 150 . 151 . 156 . 161 . 163 . 166 . 166 . 169 . 170 . 171 . 175 . 178
Chapter 9. Day to day management: DB2 backups on Windows 2000183 9.1 The db2adutl utility . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 183 9.2 Information about backups using TSM commands . . . . . . . . . . . . . . 185 9.3 Verification of DB2 backups . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 188 9.3.1 Verify backup using db2ckbkp . . . . . . . . . . . . . . . . . . . . . . . . . 188 9.3.2 Verification using DB2 list history . . . . . . . . . . . . . . . . . . . . . . . 189 9.3.3 Verification using db2adutl . . . . . . . . . . . . . . . . . . . . . . . . . . . . 190 9.4 Deletion of backups and logfiles . . . . . . . . . . . . . . . . . . . . . . . . . . . . 193 9.4.1 Deletion of backups . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 193 9.4.2 Deletion of logfiles . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 193 9.4.3 Auto deletion of backups and logfiles . . . . . . . . . . . . . . . . . . . . 194
9.5 Automation of DB2 backup . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 195 9.5.1 Automate DB2 backup using Windows . . . . . . . . . . . . . . . . . . . 195 9.5.2 Automate DB2 backup using DB2 . . . . . . . . . . . . . . . . . . . . . . . 196 9.5.3 Automate DB2 backup using Tivoli Storage Manager . . . . . . . . 196 9.5.4 Automate DB2 backup using a Windows service starting a script . . 199 9.6 Maintaining the history file . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 208 Part 4. Recovering DB2 UDB databases using TSM . . . . . . . . . . . . . . . . . . . . . . . . . . 211 Chapter 10. Recovering DB2 UDB databases . . . . . . . . . . . . . . . . . 10.1 Version recovery . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 10.1.1 Version recovery example . . . . . . . . . . . . . . . . . . . . . . . . . 10.1.2 Version recovery using the command line. . . . . . . . . . . . . . 10.1.3 Version recovery using the Control Center . . . . . . . . . . . . . 10.2 Database roll-forward recovery. . . . . . . . . . . . . . . . . . . . . . . . . . 10.2.1 Database roll-forward recovery example . . . . . . . . . . . . . . . 10.2.2 Database roll-forward recovery using the command line . . . 10.2.3 Database roll-forward recovery using the Control Center . . 10.3 Tablespace roll-forward recovery . . . . . . . . . . . . . . . . . . . . . . . . 10.3.1 Tablespace roll-forward recovery example . . . . . . . . . . . . . 10.3.2 Tablespace roll-forward recovery using the command line . 10.3.3 Tablespace roll-forward recovery using the Control Center . 10.4 Point in time recovery . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 10.4.1 Point in time recovery concepts and lab experience . . . . . . 10.4.2 Point in time recovery considerations . . . . . . . . . . . . . . . . . 10.4.3 Point in time recovery example . . . . . . . . . . . . . . . . . . . . . . 10.4.4 Point in time recovery using the command line . . . . . . . . . . 10.4.5 Point in time recovery using the Control Center . . . . . . . . . 10.5 Restoring a DB2 database to a new DB2 instance . . . . . . . . . . . 10.5.1 Restore using db2adutl . . . . . . . . . . . . . . . . . . . . . . . . . . . . 10.5.2 Restore using same Tivoli Storage Manager client setup . . 10.5.3 Restore using DB2 parameter. . . . . . . . . . . . . . . . . . . . . . . 10.6 Tablespace redirected restore . . . . . . . . . . . . . . . . . . . . . . . . . . 10.6.1 Tablespace redirected restore example . . . . . . . . . . . . . . . 10.6.2 Tablespace redirected restore using the command line . . . 10.6.3 Tablespace redirected restore using the Control Center . . . 10.7 Recovering the history file . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 10.8 Additional notes on recovery . . . . . . . . . . . . . . . . . . . . . . . . . . . 10.8.1 Roll-forward status . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 10.8.2 Restarting restore and roll-forward . . . . . . . . . . . . . . . . . . . 10.8.3 Using more than one backup image for a recovery . . . . . . . 10.8.4 Restore without rolling forward . . . . . . . . . . . . . . . . . . . . . . . . 213 . . 213 . . 214 . . 214 . . 215 . . 218 . . 218 . . 218 . . 220 . . 224 . . 224 . . 225 . . 227 . . 235 . . 235 . . 236 . . 237 . . 238 . . 240 . . 246 . . 246 . . 246 . . 247 . . 254 . . 254 . . 255 . . 257 . . 265 . . 266 . . 266 . . 266 . . 267 . . 268
Appendix A. Quick start/checklist for configuration . . . . . . . . . . . . . . 271 A.1 Windows quick start . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 271 A.2 AIX quick start. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 272 A.3 Sun Solaris quick start . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 273 Appendix B. Troubleshooting . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 277 B.1 Gotchas. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 277 B.1.1 RC 406 options file not found . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 277 B.1.2 Running a Tivoli Storage Manager CONFIG trace . . . . . . . . . . . . . 278 B.1.3 RC 137 authentication failure, incorrect password . . . . . . . . . . . . . 279 B.1.4 DB2 User exit on Windows NT cannot find .h (header) files. . . . . . 280 B.2 Checklist for the Tivoli Storage Manager server . . . . . . . . . . . . . . . . . . . 280 B.3 Isolating the problem. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 280 B.4 List of logfiles . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 281 B.4.1 User exit return codes. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 283 Appendix C. Performance . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 285 C.1 General performance considerations . . . . . . . . . . . . . . . . . . . . . . . . . . . 285 C.2 DB2 backup command performance options . . . . . . . . . . . . . . . . . . . . . 286 C.3 DB2 restore command performance options . . . . . . . . . . . . . . . . . . . . . 288 Appendix D. Split mirror and split copy functions with DB2 . . . . . . . 289 D.1 Using split mirror features in conjunction with DB2 . . . . . . . . . . . . . . . . 291 D.1.1 DB2 clone database . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 292 D.1.2 DB2 standby database . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 293 D.1.3 DB2 mirror database . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 294 D.2 Using AIX splitcopy feature for DB2 backup . . . . . . . . . . . . . . . . . . . . . . 296 Appendix E. New backup features (DB2 V7.1 Fixpak3 Beta) . . . . . . 301 E.1 Incremental backup. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 301 E.2 On demand log archive. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 305 Appendix F. DB2 backup using TSM LAN-free setup . . . . . . . . . . . . . . 307 F.1 Configuration for LAN-free . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 307 F.1.1 Define new managementclass for LAN-free backups . . . . . . . . . . . 308 F.1.2 Download and install Tivoli Storage Manager Storage Agent. . . . . 309 F.1.3 Modify dsmsta.opt . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 310 F.1.4 Check adsmscsi . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 310 F.1.5 Define drive mappings . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 312 F.1.6 Define server for storage agent on Tivoli Storage Manager server 313 F.1.7 Run dsmsta setstorageserver on storage agent . . . . . . . . . . . . . . . 314 F.1.8 Install storage agent as a service . . . . . . . . . . . . . . . . . . . . . . . . . . 314 F.1.9 Specify enablelanfree in client options file (dsm.opt) . . . . . . . . . . . 315 F.2 Running a backup and verifying that LAN-free is working . . . . . . . . . . . 315
F.3 Problems . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 316 F.3.1 Problems with the userexit . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 316 F.3.2 Problems with the db2adutl.exe . . . . . . . . . . . . . . . . . . . . . . . . . . . 319 Appendix G. Related publications. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 323 G.1 IBM Redbooks . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 323 G.2 IBM Redbooks collections . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 323 G.3 Other resources . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 323 G.4 Referenced Web sites . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 324 How to get IBM Redbooks . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 325 IBM Redbooks fax order form . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 326 Index . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 327 IBM Redbooks review . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 331
10
Figures
1. 2. 3. 4. 5. 6. 7. 8. 9. 10. 11. 12. 13. 14. 15. 16. 17. 18. 19. 20. 21. 22. 23. 24. 25. 26. 27. 28. 29. 30. 31. 32. 33. 34. 35. 36. 37. 38. 39. 40. User interaction with tables . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 8 Using index in a table. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 9 Tables, tablespaces, and data storage . . . . . . . . . . . . . . . . . . . . . . . . . . . 10 Log files . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 12 Database partitioning . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 15 DB2 object hierarchy in an instance . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 16 Nodegroups . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 17 Native support or Tivoli Data Protection interfacing with the TSM API . . . 34 Archive object life cycle . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 44 Backup object life cycle . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 45 Sample include-exclude list file . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 52 Define domain, policy and management class . . . . . . . . . . . . . . . . . . . . . 57 Define tape pools . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 57 Define disk pools and assign some volumes . . . . . . . . . . . . . . . . . . . . . . . 57 Define copygroups . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 58 Validate and activate policy . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 58 Define Tivoli Storage Manager node . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 58 Example of dsm.sys file . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 66 Use DB2 Tivoli Storage Manager database configuration parameter . . . . 71 Tivoli Storage Manager baclient include-exclude file example . . . . . . . . . 72 Control Center . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 75 Attach to the administration server . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 76 Drop down menu for database. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 77 Backup database with Tivoli Storage Manager . . . . . . . . . . . . . . . . . . . . . 77 Backup successful dialog box . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 78 Control Center . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 79 Attach to the administration server . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 80 Drop down menu for database. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 81 Backup database with Tivoli Storage Manager . . . . . . . . . . . . . . . . . . . . . 82 Backup using the online option . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 82 Backup successful dialog box . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 83 Control Center . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 84 Attach to the administration server . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 85 Drop down menu for a tablespace . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 86 Backup tablespace using Tivoli Storage Manager. . . . . . . . . . . . . . . . . . . 87 Backup tablespace using the online option . . . . . . . . . . . . . . . . . . . . . . . . 87 Backup successful dialog box . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 88 Tivoli Storage Manager Backup-Archive include-exclude file example . . 100 Control Center . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 103 Attach to the administration server . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 104
11
41. 42. 43. 44. 45. 46. 47. 48. 49. 50. 51. 52. 53. 54. 55. 56. 57. 58. 59. 60. 61. 62. 63. 64. 65. 66. 67. 68. 69. 70. 71. 72. 73. 74. 75. 76. 77. 78. 79. 80. 81. 82. 83.
Drop down menu for database. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 105 Backup database with Tivoli Storage Manager . . . . . . . . . . . . . . . . . . . . 106 Backup successful dialog box . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 106 Control Center . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 108 Attach to the administration server . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 109 Drop down menu for database. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 110 Backup database with Tivoli Storage Manager . . . . . . . . . . . . . . . . . . . . 110 Backup using the online option . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 111 Backup successful dialog box . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 111 Control Center . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 113 Attach to the administration server . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 114 Drop down menu for a tablespace . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 115 Backup tablespace using Tivoli Storage Manager. . . . . . . . . . . . . . . . . . 116 Backup tablespace using the online option . . . . . . . . . . . . . . . . . . . . . . . 116 Backup successful dialog box . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 117 Syntax of db2adutl . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 119 Output of Tivoli Storage Manager Select command . . . . . . . . . . . . . . . . 122 Example db2ckbkp. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 125 DB2 list history . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 125 Example db2adutl query . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 126 Example db2adutl extract . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 127 Example db2adutl verify. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 128 Sample backup and verification script . . . . . . . . . . . . . . . . . . . . . . . . . . . 129 Example db2adutl delete logfiles . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 132 Example script of deletion of obsolete backups and logfiles . . . . . . . . . . 133 Sample backup shell script . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 135 Select backup database in DB2 Control Center . . . . . . . . . . . . . . . . . . . 136 DB2 backup window . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 137 DB2 schedule window . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 137 DB2 journal . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 138 Script center. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 139 New command script . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 140 Scheduling a script. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 141 Example dsm.sys file for Tivoli Storage Manager client scheduler . . . . . 142 Tivoli Storage Manager client version and release . . . . . . . . . . . . . . . . . 150 Levels of Tivoli Storage Manager client code . . . . . . . . . . . . . . . . . . . . . 151 Files available for latest level . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 151 Location to Save Files window. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 152 Language selection . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 152 InstallShield Wizard . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 153 Installation directory selection . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 153 Complete or custom. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 154 Selecting the API SDK and administrative client files . . . . . . . . . . . . . . . 154
12
84. Installation confirmation window . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 155 85. Successful installation confirmation . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 155 86. Right-click My Computer icon . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 156 87. System Properties: General tab. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 156 88. System Properties: Advanced tab . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 157 89. Environment variables . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 158 90. Setting DSMI_CONFIG system variable . . . . . . . . . . . . . . . . . . . . . . . . . 159 91. Setting the DSMI_DIR system variable . . . . . . . . . . . . . . . . . . . . . . . . . . 160 92. Setting the DSMI_LOG system variable . . . . . . . . . . . . . . . . . . . . . . . . . 161 93. Verifying the system variables . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 161 94. Creating the client options file . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 162 95. Editing the client options file . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 163 96. Location of DB2 UDB executable dsmapipw.exe . . . . . . . . . . . . . . . . . . 163 97. Issuing set to confirm system variables . . . . . . . . . . . . . . . . . . . . . . . . . . 164 98. dsmapipw.exe . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 165 99. Warning messages that confirm configuration is correct . . . . . . . . . . . . . 165 100.Control Center offline backup . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 173 101.Select Tivoli Storage Manager option in Control Center GUI . . . . . . . . . 174 102.DB2 start backup window . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 174 103.End of DB2 offline backup message using the DB2 GUI . . . . . . . . . . . . 175 104.DB2 select database for online backup. . . . . . . . . . . . . . . . . . . . . . . . . . 176 105.Select Tivoli Storage Manager option in backup GUI . . . . . . . . . . . . . . . 177 106.Select Online option in Options menu . . . . . . . . . . . . . . . . . . . . . . . . . . . 177 107.DB2 start backup window . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 178 108.End of DB2 online backup message using the DB2 GUI . . . . . . . . . . . . 178 109.Select Tablespace Backup Menu . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 180 110.Select Tivoli Storage Manager option in backup GUI . . . . . . . . . . . . . . . 180 111.Select Offline or Online option in options menu . . . . . . . . . . . . . . . . . . . 181 112.DB2 start backup window . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 181 113.End of tablespace backup message using the DB2 GUI . . . . . . . . . . . . 182 114.Syntax of db2adutl. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 184 115.Output of Tivoli Storage Manager Select command . . . . . . . . . . . . . . . . 187 116.Example db2ckbkp with two backup images in the set . . . . . . . . . . . . . . 189 117.DB2 list history . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 190 118.Example db2adutl query . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 191 119.Example db2adutl extract . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 191 120.Example db2adutl verify . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 192 121.Example db2adutl delete logfiles. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 194 122.Entering the backup script in the registry . . . . . . . . . . . . . . . . . . . . . . . . 202 123.Set startup type to manual . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 203 124.Set Log On properties . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 204 125.Automated backup process flow . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 207 126.Container error in db2diag.log. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 214
13
127.List history command result. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 215 128.Version recovery using the Control Center . . . . . . . . . . . . . . . . . . . . . . . 216 129.Backup image selection page . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 217 130.Version recovery successful dialog box . . . . . . . . . . . . . . . . . . . . . . . . . 217 131.List history command result. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 219 132.Database roll-forward using the Control Center . . . . . . . . . . . . . . . . . . . 221 133.Backup image selection page . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 222 134.Roll-forward page . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 223 135.Roll-forward recovery successful dialog box . . . . . . . . . . . . . . . . . . . . . . 224 136.List tablespaces. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 225 137.List history command result. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 226 138.Restore tablespace using the Control Center . . . . . . . . . . . . . . . . . . . . . 228 139.Warning dialog box . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 229 140.Manually entering the backup image. . . . . . . . . . . . . . . . . . . . . . . . . . . . 229 141.Database drop down menu . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 230 142.Backup image selection page . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 231 143.Table Spaces page . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 232 144.Roll forward page . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 233 145.Options page . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 234 146.Tablespace roll-forward recovery successful . . . . . . . . . . . . . . . . . . . . . 234 147.Point in time recovery . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 235 148.Log files being reused after a point in time recovery . . . . . . . . . . . . . . . . 236 149.List tablespaces show detail result . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 238 150.List history command result. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 239 151.Tablespace in backup-pending state. . . . . . . . . . . . . . . . . . . . . . . . . . . . 240 152.Tablespace point in time recovery. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 241 153.Backup image selection page . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 242 154.Table Spaces page . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 243 155.Roll-forward page . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 244 156.Options page . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 245 157.Point in time recovery successful . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 245 158.List tablespace command . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 255 159.List history command result. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 256 160.Tablespace redirected restore. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 258 161.Backup image selection page . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 259 162.Table Spaces page . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 260 163.Container page . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 261 164.Change container dialog . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 262 165.Roll-forward page . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 263 166.Options page . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 264 167.Tablespace redirected restore successful. . . . . . . . . . . . . . . . . . . . . . . . 264 168.Split mirror concept . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 289 169.Implementation of split mirror . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 290
14
170.AIX LVM mirroring with three physical copies . . . . . . . . . . . . . . . . . . . . . 297 171.Splitcopy read-only filesystem . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 298 172.Incremental backup . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 302 173.Restore incremental backups . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 304 174.Showing hidden devices in Device Manager. . . . . . . . . . . . . . . . . . . . . . 311 175.Opening Non-Plug and Play Drivers entry . . . . . . . . . . . . . . . . . . . . . . . 311 176.AdsmScsi properties . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 312
15
16
Tables
1. Rollforward status . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 266
17
18
Preface
This IBM Redbook discusses techniques and gives guidelines for backing up DB2 UDB using Tivoli Storage Management products. It is intended for database administrators (DBAs) and system/storage administrators, and anyone who needs to protect their critical DB2 databases. We focus on the use of the Tivoli Storage Manager API client and provide installation, setup, customization and day-to-day management examples. Tivoli Storage Manager 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 All testing was carried out on DB2 V7.1 and with Tivoli Storage Manager V4.1.2. We used these platforms: AIX, Sun Solaris and Windows 2000. The design of the project includes recovery scenarios, as well as, different backup methods that provide practical assistance for DBAs.
19
Manila University (Philippines). His areas of expertise include transaction processing systems, analysis and design, and programming. Martin Bruegger is an Advisory IT Specialist in Switzerland, where he is working in the outsourcing department. He has more than 10 years of experience as a database administrator in a production environment. He has worked with IBM for 11 years. His areas of expertise include installation and support of Oracle databases on UNIX and S/390 servers. Wolfgang Postl is an IT Specialist with IBM in Austria, where he installs and supports RS/6000 and SP systems. He has six years of experience with DB2 and RS/6000 products. Wolfgang holds a degree in Mathematics from the University of Graz (Austria). His areas of expertise include system manageent, storage servers and relational databases. James Thompson is a Tivoli Storage Manager Level 2 Technical Support Engineer with IBM in Tucson, Arizona. He has seven years of IT experience across multiple platforms and applications. He graduated Cum Laude with a degree in Computer Science from Utah State University. He is currently a Technical Support Team Lead for Tivoli Storage Manager, Tivoli Data Protection and API products. His areas of expertise include Tivoli Storage Manager, Windows, Novell, AIX, DB2, Oracle, and Storage Area Networks. Thanks to the following people for their invaluable contributions to this project: Pat Randall International Technical Support Organization, San Jose Center Charlotte Brooks International Technical Support Organization, San Jose Center Corinne Baragoin International Technical Support Organization, San Jose Center Kathy Pang Tivoli Systems, San Jose David Godwin, Dale Mcinnis, DB2 IBM, Toronto Stjepan Cvitkovic IBM Global Services, Germany
20
Comments welcome
Your comments are important to us! We want our Redbooks to be as helpful as possible. Please send us your comments about this or other Redbooks in one of the following ways: Fax the evaluation form found in IBM Redbooks review on page 331 to the fax number shown on the form. Use the online evaluation form found at ibm.com/redbooks Send your comments in an Internet note to [email protected]
21
22
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. The Tivoli Storage Management solution set also includes the following client programs: Tivoli Data Protection (TDP) for applications (application clients) This program allows users to perform online backups of data that is used by particular applications such as database programs. After the database initiates a backup or restore, the application client uses the API to interface to Tivoli Storage Manager. The Tivoli Storage Manager server then applies its storage management functions to the data. The application client can perform its functions while users are working, with minimal disruption. Tivoli Data Protection clients are available for Oracle, Informix, SAP R/3, Lotus Notes R4, Lotus Domino R5, MS Exchange and MS SQL Server. Tivoli Space Manager (hierarchical storage management client) This program provides space management services for clients on some platforms. Tivoli Space Manager users can free client storage by migrating less frequently used files to server storage. These migrated files are also called space-managed files. Users can recall space-managed files automatically simply by accessing them as they would normally. You can learn more about Tivoli Storage Manager in Tivoli Storage Management Concepts, SG24-4877. Tivoli Disaster Recovery Manager Tivoli Disaster Recovery Manager automatically generates a disaster recovery plan containing the information, scripts, and procedures needed to automate restoration to help ensure quick recovery of your data after a disaster. It automatically manages and tracks the media on which your data is stored, whether on-site, in-transit, or off-site in a vault, so your data can be easily located if disaster strikes. 4
provides its own backup utility which allows backup at the tablespace level as well as a full database. The backup utility can be setup to use Tivoli Storage Manager as the backup media, as you will see later. Therefore, the two client types work together to provide full data protection for your DB2 environment. The API client and the Tivoli Storage Manager Backup-Archive client can run simultaneously on the same DB2 server, however, they are totally separate clients as far as the Tivoli Storage Manager server is concerned.
2.1.1 Database
A database presents data as a collection of tables. A table consists of a defined number of columns and any number of rows. A database can include a data dictionary or a set of system tables that describe the logical and physical structure of the data, a configuration file containing the parameter values allocated for the database, and a recovery log with ongoing transactions and archivable transactions. Some RDBMSs use control files as an extension of the data dictionary.
2.1.2 Tables
A table consists of data logically arranged in columns and rows. Figure 1 on page 8 shows that tables are assigned to tablespaces and that users interact with tables. Table data is accessed through Structured Query Language, a standardized language for defining and manipulating data in a relational database. The data in the table is logically related, and relationships can be defined between tables.
Table A
Table B
Table C
Tablespace 1
Tablespace 2
2.1.2.1 Data dictionary It is common for RDBMS to maintain a data dictionary in a set of system tables. They describe the logical and physical structure of the data. They are like any other tables but are owned by the database administrator or by the database. They are created either when the database is created or when the database administrator runs a set of scripts supplied by the RDBMS. These tables contain information about the definitions of database objects such as user tables, and indexes, as well as security information and details relating to recovery.
2.1.3 Indexes
An index is a set of keys, each pointing to rows in a table. For example, Table A in Figure 2 has an index based on the employee numbers in the table. This key value provides a pointer to the rows in the table: employee number 19 points to employee KMP. An index allows more efficient access to rows in a table by creating a direct path to the data through pointers. It is possible for the data storage of an index to grow larger than the table to which it refers.
2.1.4 Tablespaces
Tables and indexes are assigned to tablespaces as shown in Figure 3. This figure also shows that one or more data file can be allocated to a tablespace, whereas, different tablespaces cannot share the same data files. Some RDBMSs allow the several tablespaces to be defined on the same logical volume. Indexes can be assigned to a different tablespace to the one where their tables reside to improve access speed. Normally, the data dictionary tables reside in their own tablespace.
Table A
Table B
Index B
System Tables
Tablespace 1
Tablespace 2
System Tablespace
raw devices
raw devices
Tablespaces are logical concepts used with RDBMSs. They provide a convenient way of separating the user's view of data from some of the practical considerations associated with storing that data on disk. For example, a database administrator can make more disk space available to several tables by adding disk space to the appropriate table space, therefore ensuring that tables do not run out of space and that disk space is used efficiently. Furthermore, the tablespace concept means that neither users nor application programs need to be aware of the fact that the database administrator has made more disk space available. Data storage in tablespaces can be implemented using either data files or directories on files systems or raw devices. (For information on file systems and raw devices, please see your operating system documentation.) Tablespaces provide the link between logical views and data storage. Points to note are: The data for a table or index may be contained in only one data file. Alternatively, the data for a table or index may be spread over several data files. Each of the data files may contain data for one or more tables in the tablespace. Each data file or directory may reside in a separate file system.
10
The significance of these alternatives is that the only way to back up or recover individual tables is by using the facilities that the RDBMS provides. Normally, you would back up or restore tablespaces instead of the individual data files of the tablespaces. This ensures that all data storage for a tablespace is backed up consistently with the same timestamp. You would use tablespace backup instead of full database backup depending on the volatility or importance of data. You have the option of backing up tablespaces which have more update activity more often that tablespaces which have less activity. The tablespace where the data dictionary tables reside is the most important tablespace. You must ensure that this tablespace is backed up successfully and consistently with the other databases. Corruptions in the data dictionary can cause the database to be unusable.
11
records changes to DB
Some RDBMSs support the use of log files to perform forward recovery. Forward recovery takes advantage of the fact that log files hold details of all changes that have been made to the database, and therefore you do not necessarily need to undo changes, but instead can reapply changes. With forward recovery, the recovery process can: Restore a database to the state it was in at the time the last backup was taken Use the log files to reapply the changes that had been made since the last backup was taken Back out (undo) any partially completed changes A standard RDBMS concept related to log files is the checkpoint process. All RDBMSs use buffers in memory to hold changes to the database and log files. The purpose of buffers is to improve the operational performance of the RDBMS. However, the use of buffers means that most changes to databases and log files do not get written to disk until some time after the RDBMS has indicated to the user application that the update has been made successfully. Checkpoints ensure that all database and log file changes held in the RDBMS' buffers are flushed out to disk. This shortens the time it takes to recover a database after a system crash, because the number of redundant log records processed during the recovery is reduced. All RDBMSs support checkpoints and issue them automatically at intervals. We recommend that these files are mirrored or duplexed.
12
13
Common concepts like tables and indexes have already been covered in 2.1, Fundamentals of Relational Database Management Systems on page 7. Now, we introduce concepts that are new or specific to DB2 UDB.
14
Partitioned Database
configuration files configuration files
data
logs
data
logs
Database Partition
Database Partition
Node 1
Node 2
configuration files
configuration files
data
logs
data
logs
Database Partition
Database Partition
Node 3
Figure 5. Database partitioning
Node 4
The partitioned database can be configured to be flexible so that objects can be created on one or on many nodes depending on their use and on their size. So a small table can be stored on a tablespace that only exists in one node, while a large table can be stored on a tablespace which spans several nodes. Data in a table can, therefore, be distributed on several nodes. Data distribution is done using a hashing algorithm. When there is a data retrieval or update request on tables which span several nodes, the request is decomposed automatically into subrequests, and executed in parallel among the applicable database partitions. A database partition fits together with the MPP hardware architecture that is called a shared-nothing architecture, because each has its own data, configuration files, and transaction logs. When using media storage managers like Tivoli Storage Manager, you should install and configure the media manager on all machines with database partitions. Backup must also be done on each database partition. Recovering to a point in time must be carefully planned with database partitioning.
15
2.2.2 Instance
An instance (database manager) is an environment for managing data and system resources assigned to it. A machine or system can have more than one instance. Each instance will have its own database manager configuration parameters and security. An instance can have one or more databases. Figure 6 shows the hierarchy of DB2 objects in an instance.
Instance Databases Nodegroups Tablespaces
Tables
Indexes
Long Data
16
You should perform individual backup for each database partition even if the database partitions reside on the same machine, because each database partition is a shared-nothing architecture. You must also have a policy to backup the db2nodes.cfg file.
2.2.4 Nodegroups
A nodegroup is a set of one or more database partitions. It is only relevant for DB2 UDB EEE. Tablespaces are created in nodegroups, and tables and indexes are created in tablespaces. The data of a table or index can be distributed across several database partitions if it is defined in a tablespace, and the tablespace is defined in a nodegroup containing more than one database partition. A database partition can be a member of more than one nodegroup as shown in Figure 7.
Nodegroup 2 Nodegroup 1
database partition
database partition
database partition
database partition
database partition
Nodegroup 3
Figure 7. Nodegroups
2.2.5 Tablespaces
Tablespaces are created in nodegroups. A tablespace can span one or more physical storage device called containers. A container can be a directory
17
name, a file name or a device name (raw device). Backup can be done on a tablespace level if roll-forward recovery is enabled. (See 2.2.6, Recovery logs on page 18 for a discussion on roll-forward recovery). There are two types of tablespaces: System Managed Space and Database Managed Space. 2.2.5.1 System Managed Space (SMS) A SMS tablespace will have directories as containers. The operating system manages the space for the data. Files are created in the directories when the tablespace is created. The size of these files are increased when required. You should not make direct changes to these files, move, or remove them. When tables are created in an SMS tablespace, their indexes and long fields or large objects (LOBs) will be created in the same tablespace. 2.2.5.2 Database Managed Space (DMS) A DMS tablespace provides better performance in certain situations. A DMS tablespace will have files and raw devices as containers. The database manager controls the storage space. The space for the files or raw device are pre-allocated, and they cannot increase in size. To increase space for a tablespace, containers can be added. Tables created in DMS tablespaces can have their indexes and long fields or large objects (LOBs) in separate tablespaces. Better performance can be achieved, for example, when indexes are created on tablespaces with faster devices. A good design will have a tablespace to contain tables only, indexes only or LOBs only data. A DMS tablespace can be defined as: A regular tablespace to store tables and indexes A long tablespace to store long fields or LOBs When using tablespace backup for DMS tablespaces containing tables, consider backing up their corresponding index and LOB tablespaces at the same time.
recovering from the last available backup. Log files are not applied for version recovery. Roll-forward recovery can be enabled by setting logretain or userexit to on. When roll-forward recovery is enabled, log files are kept and not reused, so they can be applied when performing roll-forward recovery. You can do online database backup where users can remain connected to the database while the backup is ongoing. You can also do tablespace backup either offline or online. There are two type of log files: Active logs which contain current transaction data needed to do rollback or crash recovery Archive logs which contain committed data Since DB2 does not provide multiplexing of log files, you must mirror the directory or the file system where the active logs are located.
19
20
None of these on their own can guarantee the availability of your data but in combination they can reduce the impact of a failure. Before you can design a backup strategy you need to define the requirements that the strategy must satisfy. Factors that you will need to consider when defining the requirements for your backup strategy include: Types of events (The categories of incidents that may occur) Speed of recovery (How quickly you need to be able to recover) Backup windows (The periods of time at which backups can be performed)
21
Recovery points (To which points in time you need to be able to recover) Units of recovery (Which other tables and files need to be recovered to the same point in time) Let us look at each of these factors in more detail.
Let us look at each category in more detail. 3.1.1.1 User error There is considerable opportunity for a user to make an error that causes data to be lost. For example, a user may inadvertently delete or update rows in a table or accidentally drop an entire table, or a programmer could make a logic error that results in data loss or corruption. RDBMSs provide facilities that reduce the risk or impact of user errors. For example, you can use RDBMS security to restrict the data that individual users can access or update. However, it is not possible to eliminate the risk entirely, and you need to consider how to handle such situations. One approach is to say that it is the user's responsibility to recover from such errors. This approach may not be acceptable to users or their management, however. Another approach is to restore the entire database to the point in time at which the last backup was taken. This may not be satisfactory for other users who will lose the updates that they have made to the database since the last backup. A third approach is to restore the table space that contains the damaged table. This approach is likely to be more acceptable than the other two, because: It removes the responsibility for data recovery from the users. It may impact fewer users. The number of users impacted will depend partly on the number of tables included in the affected table space.
22
You may, however, need to be able to restore individual tables, in which case you need to have backed up the tables individually. 3.1.1.2 Statement failure SQL statements that are syntactically correct may fail, because, for example, the database is full. RDBMSs will usually detect such problems, roll back the effects of the failing statement, and report the problem to the user. Once the fundamental cause of the problem has been resolved, the user can retry the statement and continue to work. There is normally no need to take any special action to recover from SQL statement failures. 3.1.1.3 Transaction failure Transactions may fail for a variety of reasons: Programming errors Network failures Failures of the operating system or RDBMS Power failures
The actions required to recover from these situations vary according to the particular circumstances. However, the RDBMS will ensure that the integrity of the data it manages is preserved. You do not need to restore data to recover from transaction failures. 3.1.1.4 Media failure RDBMSs normally use magnetic disk as the medium on which they store the data that they manage. If a disk volume is physically damaged or destroyed, at a minimum, you need to restore the data files that have been lost to the state they were in when they were last backed up. 3.1.1.5 Disaster Many organizations have developed plans for recovery from disasters such as floods, fires, accidents, earthquakes, and terrorist attacks. You need to ensure that your strategy for backing up and recovering data fits in with any such plans. For example, you may need to arrange for backups to be made to a removable medium and stored off-site. The subject of disaster recovery is too broad for us to address in this book and is not discussed in any more detail. Almost all RDBMSs provide the facilities necessary to bring databases up to date by applying log files. They also provide the facilities necessary to undo changes made by partially completed transactions. This means that designers of database backup and recovery solutions do not need to concern themselves with recovering database data after statement failures or
23
transaction failures. For each type of event that may occur, designers of a database backup and recovery solution must: Ensure that operational procedures specify who needs to do what to recover from loss or corruption of data used by the RDBMS. Ensure that the data files that the RDBMS recovery routines use are available when needed. Ensure that data that the RDBMS does not manage can be recovered to a state that is consistent with the database.
24
25
even when the database is down. For example, the password file provides authentication for database administration especially when starting up a database from a remote site. You must ensure that these files are also backed up using operating system or third party tools like Tivoli Storage Manager.
26
continue working even though a media failure has occurred. Mirroring can be implemented in either software or hardware. However, mirroring does not remove the need to back up databases. For example, disk mirroring will not allow you to restore a table that has been lost or damaged as a result of user error. 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.
27
Some RDBMSs allow you to quiesce activity on portions of the database (for example, a particular table space) 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 table space.
Many RDBMSs allow you to perform full database backup when the database is either online or offline. However, the technique for full database backup when the database is online can be quite different from offline.
28
To perform offline backup you can use the operating system utilities, RDBMS utilities, or Tivoli Storage Manager to back up the data files that constitute the database. To perform online backup you need to use an RDBMS utility to create data files containing a copy of the database. You can then use Tivoli Storage Manager to back up these data files together with the parameter files that you use to start up the RDBMS. 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. However, it may not be practical to take databases offline for the period of time that is necessary to perform full backups at the frequency you need. You may be have to adopt a more flexible approach.
29
30
In our context LAN-free can be used in the following way. The clients can send their backup data files directly to the tape library (LAN-free) and only send the metadata information relating to the files to the storage application.
31
32
33
Figure 8. Native support or Tivoli Data Protection interfacing with the TSM API
There are three basic steps that must take place before you can use the Tivoli Storage Manager server. These steps will be covered in greater detail in subsequent chapters. A brief look into why these steps are necessary is included here. 1. Register a node with the Tivoli Storage Manager server. 2. Install the Tivoli Storage Manager client (Backup-Archive client, TDP and/or API client). 3. Configure the Tivoli Storage Manager client.
34
The baclient is not required to do Tivoli Data Protection or DB2 backups. It is needed to setup Tivoli Storage Manager scheduling and to backup files and directories that the DB2 backup utilities do not. Since DB2 provides native support for Tivoli Storage Manager, a TDP product is not necessary. The only element required to do DB2 backups using Tivoli Storage Manager is to install and configure the Tivoli Storage Manager API.
35
After taking the backup we ran the SQL query select * from backups where node_name=JAMAICA_DB2. The entry in the quotes is case sensitive and must be upper case. The output of this command tells us that the backup object
36
was sent by a client program (DB2) that authenticated with the Tivoli Storage Manager server as node JAMAICA_DB2. The client program did not specify which management class to use with this object, so the Tivoli Storage Manager server bound the default management class for the node to this backup object. DB2 uses the database name as the FILESPACE_NAME when sending the object to the Tivoli Storage Manager server. The HL_NAME or high level qualifier corresponds to the DB2 structure nodegroup. Information on nodegroups and how DB2 is structured can be found in 2.2, DB2 UDB concepts on page 13. Our environment consists of single-partition DB2 configurations, so only a single nodegroup exists. For the LL_NAME or low level qualifier, DB2 uses the type of backup concatenated with the timestamp for the backup.
tsm: BRAZIL>select * from backups where node_name='JAMAICA_DB2' ANR2963W This SQL query may produce a very large result table, or may require a significant amount of time to compute. Do you wish to proceed? (Yes (Y)/No (N)) y NODE_NAME: JAMAICA_DB2 FILESPACE_NAME: /SAMPLE STATE: ACTIVE_VERSION TYPE: FILE HL_NAME: \NODE0000\ LL_NAME: FULL_BACKUP.20010322134658.1 OBJECT_ID: 46908 BACKUP_DATE: 2001-03-22 13:48:42.000000 DEACTIVATE_DATE: OWNER: CLASS_NAME: DEFAULT
4.3.2.2 Viewing the description of an archive object Information about each archive object is externalized in a Tivoli Storage Manager internal database table named archives. You can use an SQL select statement to view the entries in this table. We will restrict the output of the select command by nodename. Before running this command, we configured the DB2 sample database to invoke a user exit that archives logs to Tivoli Storage Manager. After performing this configuration we ran the SQL query select * from archives where node_name=JAMAICA_DB2. The entry in the quotes is case sensitive and must be upper case. The output of this command tells us that the archive object was sent by a client program (DB2) that authenticated with the Tivoli Storage Manager server as node JAMAICA_DB2. The client program did not specify which management class to use with this object, so the Tivoli Storage Manager server bound the default management class for the node to this archive object. DB2 uses the database name as the FILESPACE_NAME when sending the object to the Tivoli Storage Manager server. The HL_NAME or high level qualifier
37
corresponds to the DB2 structure nodegroup. Information on nodegroups and how DB2 is structured can be found in 2.2, DB2 UDB concepts on page 13. Our environment consists of single-partition DB2 configurations, so only a single nodegroup exists. For the LL_NAME or low level qualifier, DB2 uses the filename for the log file.
tsm: BRAZIL>select * from archives where node_name='JAMAICA_DB2' ANR2963W This SQL query may produce a very large result table, or may require a significant amount of time to compute. Do you wish to proceed? (Yes (Y)/No (N)) y NODE_NAME: FILESPACE_NAME: TYPE: HL_NAME: LL_NAME: OBJECT_ID: ARCHIVE_DATE: OWNER: DESCRIPTION: CLASS_NAME: JAMAICA_DB2 \SAMPLE FILE \NODE0000\ S0000164.LOG 48188 2001-03-23 07:10:44.000000 Log file for DB2 database SAMPLE DEFAULT
4.3.2.3 Differences between backup and archive objects Based on the output of the SQL commands for backup and archive objects, you can see that there are some similarities and some differences. The backups table contains two fields that the archives table does not: STATE and DEACTIVATE_DATE. These two fields are used in implementing versioning which is specific to backup objects. The STATE field can be either ACTIVE_VERSION or INACTIVE_VERSION. When the backup object is inactivated, the STATE changes to INACTIVE_VERSION and the timestamp when this occurred is placed in the DEACTIVATE_DATE field. The archives table contains one field that the backups table does not: DESCRIPTION. The DESCRIPTION field is used to logically group archive objects together. For example, the Tivoli Storage Manager Backup-Archive client GUI uses this field during the retrieve operation to group archive objects that were backed up with similar descriptions. 4.3.2.4 Owner field in backups and archives tables Both the backups and archives tables have an OWNER field for each data object. This is used for client data sent from a UNIX operating system. For files and directories, the OWNER corresponds to the UNIX security owner for the file or directory. For API data this field normally comes from the UNIX user that is used to perform the backup. Only the owner of the data object or a root user can access data objects on a Tivoli Storage Manager server or
38
authorize that access to other nodes. The Windows operating system that does not use this field, so in our examples in the prior sections, the OWNER field is blank. DB2 backups and restores source the OWNER value from the user performing the backup or restore when PASSWORDACCESS is set to GENERATE. When PASSWORDACCESS is set to PROMPT, the OWNER is sourced from the DB2 database configuration parameter, TSM_OWNER. This plays an important role when doing redirected restores.
Each domain contains one and only one ACTIVE policyset. The active policyset has one default management class. The active policyset represents what policyset is currently in use. The default management class represents which management class will be used if a Tivoli Storage Manager client does not use a specific one, or if the Tivoli Storage Manager client specifies a management class that does not exist in the active policyset for the domain that the node belongs to. The active policyset for a domain and the default management class can be viewed with the command query policy <domain> active. Replace <domain> with the appropriate domain. The output of that
39
command for our API_DOMAIN shows that the default management class for nodes in the domain API_DOMAIN is API_MGMTCLASS.
tsm: BRAZIL>q policyset api_domain active Policy Domain Name --------API_DOMAIN Policy Set Name --------ACTIVE Default Mgmt Class Name --------API_MGMTCLASS Description
The active policyset for a domain can contain more than one management class. Only one can be the default management class. All management classes for the active policyset can be viewed with the command query mgmtclass <domain> active. Replace domain with the appropriate domain name. The output of that command from our API_DOMAIN shows that there are two management classes in the active policyset for the domain API_DOMAIN. These classes are API_LONGER and API_MGMTCLASS with API_MGMTCLASS being the default management class.
Policy Domain Name --------API_DOMAIN API_DOMAIN Policy Set Name --------ACTIVE ACTIVE Mgmt Class Name --------API_LONGER API_MGMTCLASS Default Mgmt Class ? --------No Yes Description -----------------------MG for all DB-Backups MG for all DB-Backups
Each management class can contain one archive copygroup and one backup copygroup. The copygroup is the final structure in the Tivoli Storage Manager policy management scheme and contains the most important information. The copygroup is where you specify where the initial destination storage pool of the data object should be. You also specify how the life cycle of the data object is to be managed. The life cycle concept will be covered in the next section. The life cycle is the term used in this book to describe how long a data object (backup or archive) resides on Tivoli Storage Manager storage before being purged. The retention settings for a backup copygroup can be viewed with the command query copygroup <domain> active <mgmtclass>. Replace <domain> and <mgmtclass> with the appropriate values for your configuration. The output of that command for our default management class API_MGMTCLASS
40
in the domain API_DOMAIN shows the retention settings for the backup copygroup.
tsm: BRAZIL>q copygroup api_domain active api_mgmtclass Policy Domain Name --------API_DOMAIN Policy Mgmt Set Name Class Name --------- --------ACTIVE API_MGMTCLASS Copy Versions Versions Retain Retain Group Data Data Extra Only Name Exists Deleted Versions Version --------- -------- -------- -------- ------STANDARD 1 0 0 0
To see the initial destination storage pool for this copygroup, you have to use the format=detailed option. Each of the query commands can be used with the additional parameter format=detailed to obtain additional information. The same command used previously to view the backup copygroup plus the format=detailed option shows that the initial destination (COPY DESTINATION) is the API_DISK_B storage pool.
tsm: BRAZIL>q copygroup api_domain active api_mgmtclass format=detailed Policy Domain Name: Policy Set Name: Mgmt Class Name: Copy Group Name: Copy Group Type: Versions Data Exists: Versions Data Deleted: Retain Extra Versions: Retain Only Version: Copy Mode: Copy Serialization: Copy Frequency: Copy Destination: Last Update by (administrator): Last Update Date/Time: Managing profile: API_DOMAIN ACTIVE API_MGMTCLASS STANDARD Backup 1 0 0 0 Modified Shared Dynamic 0 API_DISK_B ADMIN 03/21/2001 14:23:48
To see the retention settings for an archive copygroup, you add the option type=archive to the query copygroup command query copygroup <domain> active <mgmtclass> type=archive. Replace <domain> and <mgmtclass> with the appropriate values for your configuration. The output of that command for our default management class API_MGMTCLASS in the domain API_DOMAIN shows the retention settings for the archive copygroup.
41
tsm: BRAZIL>q copygroup api_domain active api_mgmtclass type=archive Policy Domain Name --------API_DOMAIN Policy Set Name --------ACTIVE Mgmt Class Name --------API_MGMTCLASS Copy Group Name --------STANDARD Retain Version -------365
To see the initial destination storage pool for this copygroup, you have to use the format=detailed option again. The same command used previously to view the archive copygroup plus the format=detailed option shows that the initial destination (COPY DESTINATION) is the API_DISK_A storage pool.
tsm: BRAZIL>q copygroup api_domain active api_mgmtclass type=archive format=detailed Policy Domain Name: Policy Set Name: Mgmt Class Name: Copy Group Name: Copy Group Type: Retain Version: Copy Serialization: Copy Frequency: Copy Mode: Copy Destination: Last Update by (administrator): Last Update Date/Time: Managing profile: API_DOMAIN ACTIVE API_MGMTCLASS STANDARD Archive 365 Shared Static CMD Absolute API_DISK_A ADMIN 03/08/2001 17:30:39
To summarize the information presented in this section with regards to data objects: Every archive data object sent to the Tivoli Storage Manager server is associated with an archive copygroup that determines the initial destination storage pool and how long the archive data object should reside on Tivoli Storage Manager storage. Every backup data object sent by the Tivoli Storage Manager server is associated with a backup copygroup that determines the initial destination storage pool and how long the backup data object should reside on Tivoli Storage Manager storage. For the archive or backup data object, the copygroup comes from the management class to which the object is bound. The management class that is used to bind comes from the active policyset for the domain of the node that sent the data object. The management class used will either be
42
the default management class for the active policyset or one specified by the Tivoli Storage Manager client. Once the object is sent to the Tivoli Storage Manager server you can verify which management class was used by performing a SQL query of the archives or backups Tivoli Storage Manager internal database table.
43
When an archive object moves into the expired state, it is no longer accessible by the Tivoli Storage Manager client. Additionally, there is no way for the archive object to change back to a current state once it has become expired. 4.3.4.2 Life cycle of backup data objects A backup object exists in three states, active, inactive, and expired before being purged from the Tivoli Storage Manager server. Figure 10 shows the four steps involved in the life cycle of a backup data object. 1. A copy of the client data is sent to the Tivoli Storage Manager server as a backup object. When a backup object is sent to the Tivoli Storage Manager server, it becomes the active version. 2. It remains in an active state until the Tivoli Storage Manager client program deletes the backup object manually, or a newer version of the backup object is sent. At this point the backup object changes state from active to inactive. 3. The backup object remains inactive until it exceeds its retention settings. A backup object can exceed retention settings by either time or number of versions. At this point the backup object changes state from inactive to expired. 4. The backup object remains in the expired state until expiration processing runs on the Tivoli Storage Manager server. This process is invoked by a Tivoli Storage Manager administrator with the expire inventory command. When expiration processing encounters a backup object in the expired state, it purges that object from the Tivoli Storage Manager database and
44
releases the storage space where the backup object resided to be reclaimed later.
A backup object that is the active version or in the active state will never be purged from Tivoli Storage Manager storage (never expires). It must first be inactivated by the Tivoli Storage Manager client program. The Tivoli Storage Manager client program can do this by manually deleting the backup object or sending a new version of the backup object. When a backup object becomes inactive or moves into the inactive state, it is still accessible by the Tivoli Storage Manager client. A main difference between active and inactive is that an active object becomes inactive due to a client operation. An inactive object becomes expired automatically by the Tivoli Storage Manager server as soon as it exceeds its retention criteria. Changing from inactive to expired does not require a client operation. A backup object cannot change back to the active state once it has become inactive, nor to the inactive state once it has been expired. When a backup object moves into the expired state, it is no longer accessible to the Tivoli Storage Manager client. If the retention for the backup object is set to retain zero inactive objects (verexist=1, verdel=0) or to retain inactive copies for zero days (retextra=0,retonly=0), the active backup object will change to the expired state as soon as the active backup is inactivated. What a unique backup object is to Tivoli Storage Manager Both backup and archive objects can be manually deactivated by the client program that initially backed them up. A key difference between backup and archive objects is that a backup object changes states when a newer version of the backup object is sent to the Tivoli Storage Manager server. This brings
45
up the question: how does the Tivoli Storage Manager determine what a unique version is? A backup object is considered unique based on NODE_NAME, FILESPACE_NAME, HL_NAME, LL_NAME. These fields and how to view them were discussed in 4.3.2.1, Viewing the description of a backup object on page 36. When a backup data object is sent to the Tivoli Storage Manager server, it has the same NODE_NAME, FILESPACE_NAME, HL_NAME, LL_NAME as an existing backup data object. The new data object becomes the ACTIVE_VERSION, and the older version changes state and becomes an INACTIVE_VERSION. Many API products use a unique value for the LL_NAME based on a timestamp or a random non-recurring value. Because of this unique value for the LL_NAME the backup object will only change states from active to inactive when the API product manually inactivates (deletes) the backup object. An active object is not subject to retention settings until it is inactivated. You must run the appropriate command from the API product to inactivate these backup objects or else they will remain forever on the Tivoli Storage Manager server.
4.4 Tivoli Storage Manager server considerations for UDB DB2 backups
Whenever you use the Tivoli Storage Manager server to backup and restore data objects, it is of the utmost importance to consider which management class the data objects will be bound to. This is true of both API and Backup-Archive clients. Failure to do so will result in storing the data objects in one of three situations: too long, too short, and just right. It is highly unlikely that you will manage the objects just right if you do not take the time to define your storage requirements, configure the Tivoli Storage Manager server appropriately, and configure the Tivoli Storage Manager client to use the correct management classes. If you store the data objects too long, then you waste space and storage resources on the Tivoli Storage Manager server. If you store the data objects for too short a time, then you dont have the required files when you need them. Each of the TDP products and any product that uses the Tivoli Storage Manager API should have a section in the documentation that describes exactly what retention settings the product uses and how to bind the data objects to the appropriate management class. If the documentation does not contain this information, you should call support for the product and request this information. The Tivoli Storage Manager server cannot and does not know how long a client program needs to keep the data objects. This must be done by the client.
46
Because the policy requirements for DB2 backups are different from the desired settings for regular Tivoli Storage Manager backup clients, a different management class must be defined within Tivoli Storage Manager for
47
managing these DB2 backups. There are two ways to implement this different management class setup: Define a new management class within an existing policy domain. Define a separate policy domain where the default management class contains the required settings. 4.5.1.1 Define a new management class in an existing domain If you choose to define a new management class within an existing policy domain (which is not the default management class for that domain), then you must add an include statement in the client options file (dsm.opt for Windows; dsm.sys for UNIX) that is used by the DB2 node. This include statement binds the DB2 backup objects to that management class that you have defined for managing these backups. The include statement would be:
include * ManagementClassName
With DB2 you can also specify the management class by setting the TSM_MGMTCLASS option within the DB2 database. The DB2 command would be:
db2 update cfg for sample using TSM_MGMTCLASS ManagementClassName
4.5.1.2 Define a separate policy domain The recommended way is to define a separate policy domain where the default management class has the required settings. Then just register the node that will be used for DB2 backups to this new domain. If the node is already defined, the Update Node command can be used to move the node to this new domain. This method allows the default management class to be utilized for the DB2 backups and there is no concern over an include statement not being recognized during the backup process.
48
DB2 database will send its full and tablespace backups through the Tivoli Storage Manager client API directly to the backup copy group of the default management class to which the node is assigned to. DB2 assigns unique names to every database backups. The settings that pertain to multiple versions do not apply. The following retention settings should be used for the management class that will be bound to the DB2 backups: VEREXISTS=1 Keeps only one version of the backup file as the name of the backup is unique. (There will not be a newer version of the backup image with the same name). VERDELETED=0 If the backup file has been deleted (via db2adutl), then Tivoli Storage Manager should not keep an inactive version of this file. RETEXTRA=0 (the same value as RETONLY) RETEXTRA parameter will never be used as you will never have more than one version of the backup file. To prevent confusion set this parameter to the same value as RETONLY. RETONLY=0 When a backup image file becomes inactive it will be purged from the Tivoli Storage Manager server at the next expiration. 4.5.2.2 Special consideration The values of VERDELETED and RETONLY can be changed so that DB2 database and tablespace backups become inactive for a period of time before becoming expired. To do this, change VERDELETED=1 and RETONLY=number of days to keep inactive. You can then use the db2adutl command with the show inactive option to access the inactivated backup objects. Doing this is not recommended for a number of reasons. Archive logs do not have the same ability to be kept, once deleted. Online backups without the associated logs are worthless. Space is wasted on the Tivoli Storage Manager server during normal operation. 4.5.2.3 Archive copy group considerations Archive copy groups are designed to hold archive objects for a dedicated time and then to automatically delete the object.
49
DB2 database will send its logfiles through the Tivoli Storage Manager client API directly to the archive copy group of the default management class to which the node is assigned. The logfiles are numbered from S0000000.LOG to S9999999.LOG. In normal operation it is unlikely to need to access such a vast number of logfiles. But, be aware when doing a point in time restore of a DB2 database, some logfiles may be reused and therefore stored twice. You should set the retention for the archive copy group to nolimit. RETVER: NOLIMIT This will hold logfiles forever unless they are deleted by db2adutl. Like the deletion of the backup images, the deletion of the logfiles should be the responsibility of the DB2 administrator.
50
tsm: BRAZIL>select * from backups where node_name='BRAZIL_DB2' ANR2963W This SQL query may produce a very large result table, or may require a significant amount of time to compute. Do you wish to proceed? (Yes/No) y NODE_NAME: FILESPACE_NAME: STATE: TYPE: HL_NAME: LL_NAME: OBJECT_ID: BACKUP_DATE: DEACTIVATE_DATE: OWNER: CLASS_NAME: NODE_NAME: FILESPACE_NAME: STATE: TYPE: HL_NAME: LL_NAME: BRAZIL_DB2 /SAMPLE ACTIVE_VERSION FILE /NODE0000/ FULL_BACKUP.20010308190920.1 25958 2001-03-08 19:09:20.000000 db2inst1 DEFAULT BRAZIL_DB2 /SAMPLE ACTIVE_VERSION FILE /NODE0000/ FULL_BACKUP.20010308200920.1
To get information about the stored logfiles, enter following command at the Tivoli Storage Manager prompt.
tsm: BRAZIL>select * from archives where node_name='BRAZIL_DB2' ANR2963W This SQL query may produce a very large result table, or may require a significant amount of time to compute. Do you wish to proceed? (Yes/No) y NODE_NAME: FILESPACE_NAME: TYPE: HL_NAME: LL_NAME: OBJECT_ID: ARCHIVE_DATE: OWNER: DESCRIPTION: CLASS_NAME: NODE_NAME: FILESPACE_NAME: TYPE: HL_NAME: LL_NAME: BRAZIL_DB2 /SAMPLE FILE /NODE0000/ S0000009.LOG 29812 2001-03-12 09:13:56.000000 db2inst1 Log file for DB2 database SAMPLE DEFAULT BRAZIL_DB2 /SAMPLE FILE /NODE0000/ S0000010.LOG
The name of the file consists of three parts: the filespace name, the high level name and the low level name. To decide which file should go into which
51
management class, any combination can be specified in the include-exclude option. For Windows based systems, the INCLUDE statement must be specified in the dsm.opt file. For UNIX based systems, the INCLUDE statement must be specified in the dsm.sys file. Additionally, there is an INCLEXCL option for UNIX based systems to define a file that contains all include-exclude statements for a specific server.
SErvername COMMMethod TCPPort TCPServeraddress NODename TCPCLIENTAddress TCPCLIENTPort PASSWORDAccess INCLUDE INCLEXCL Brazil_db2 TCPip 1500 9.1.150.57 Brazil_db2 9.1.150.57 * Name of this stanza
* Port where Server is listening * IP-Adress of TSM Server * Must match node name on TSM Server * IP-Adress of machine running * the TSM Client API 1501 * Each locally client must have a * different TCP Port if running at * the same time Generate * password will be crypted and saved /DB/.../* MYMGMTCLASS /usr/tivoli/tsm/client/api/bin/inclexcl.list
Figure 11 shows a sample include-exclude list file. The include-exclude file will be compared from the bottom to the top every time a file is being backed up to the Tivoli Storage Manager server. The management class of the line, where the filename first fit, will be used to send the file to.
INCLUDE INCLUDE INCLUDE INCLUDE /.../* /SAMPLE/.../* /SAMPLE/NODE0000/*.LOG /SPLITDB/.../*
In our example, all database backups and logfiles of database SPLITDB will go to the management class SPLIT_MGMTCLASS (the backups in the backup copy group and the logfiles into the archive copy group). All files from the SAMPLE database ending with LOG are going to the SAMPLE_LOGMGMT management class. (That means the logfiles will go to the archive copy group of this management class). All other SAMPLE database backups are going to the backup copygroup of the SAMPLE_BACKUP management class.
52
Keep in mind that each management class can have a separate copy destination for the archive and backup copygroup. If there is a need to send database files and logfiles into different storage pools, the above example of the SPLIT_MGMTCLASS will be sufficient if there are separate copy destinations for the archive and backup copygroup. This is only an example to show what is possible. All the other database backups will go to the DEFAULT management class of this Tivoli Storage Manager node. The include-exclude list itself can have any name and it can reside anywhere on the system. Because there can be more clients on the system using include-exclude list files, it is good to use the default directory /usr/tivoli/tsm/client/api/bin to put all the inclexcl.list files in. This file should be owned and controlled by the Tivoli Storage Manager server administrator.
53
54
The MAXNUMMP must not be set to a value greater than the actual number of physical drives defined to the Tivoli Storage Manager server. If DB2 is unable to acquire enough tape mounts, either because this value is set lower than the number of sessions, or because the tape mounts are not available, the backups may fail, or have to wait for one session to finish. For example, MAXNUMMP=2 (to allow the client use a maximum of 2 drives).
USE DEDICATED STORAGE POOLS Dedicated in this context means that the storage pool is reserved for one specific client. No other client sends files to this storage pool. There is no configuration parameter to implement this. It is a matter of how the policy setup had been done. There are different reasons why you may want to
55
use dedicated storage pools. Certain Tivoli Storage Manager server processes operate at the storage pool level, but you may want to have the server processes affect only certain clients. The work around for this is to send these clients to dedicated storage pools, you can then run the Tivoli Storage Manager server processes on these dedicated storage pools independently of your standard storage pools. Among these processes, the use of copy storage pools, collocation, and reclamation may warrant the use of dedicated storage pools. COPY STORAGE POOL To safeguard against defective tapes and for off-site copies, copy storage pools can be used. If you have dedicated storage pools you can be more flexible as to which data should be copied to a copy storage pool and which not. As backups and logfiles are often very critical to a company this data is a good candidate to be copied. It may be useful to define a dedicated storage pool for the backup copy group and the archive copy group and only setup the archive copy group (containing the logfiles) to be copied to a copy storage pool. RECLAMATION Reclamation relates to the management of sequential media by Tivoli Storage Manager, in particular, the release of empty tapes after data objects have expired and the storage space has been freed. The reclamation values are managed by the Tivoli Storage Manager administrator based on the tape usage agreed with database administrators during the planning stages.
In the first step, we create the domain the policy and the management class (Figure 12).
56
tsm: BRAZIL>def domain api_domain DESC='DO for all DB-Backups' ANR1500I Policy domain API_DOMAIN defined. tsm: BRAZIL> tsm: BRAZIL>def policyset api_domain api_policy DESC='PO for all DB Backups' ANR1510I Policy set API_POLICY defined in policy domain API_DOMAIN. tsm: BRAZIL>def mgmtclass api_domain api_policy api_mgmtclass DESC='MC for all DB-Ba ckups' ANR1520I Management class API_MGMTCLASS defined in policy domain API_DOMAIN, set API_POLICY. tsm: BRAZIL> Figure 12. Define domain, policy and management class
Next, the tape and disk storage pools are being created and some pre-formatted disk volumes are assigned to the disk pool (Figure 13).
tsm: BRAZIL>def stgpool api_3580_a 3580class DESC='Archive tape pool' rec=95 maxscr=10 maxsize-10g ANR2200I Storage pool API_3580_A defined (device class 3580CLASS). tsm: BRAZIL>def stgpool api_3580_b 3580class DESC='Backup tape pool' rec=95 maxscr=10 maxsize-10g ANR2200I Storage pool API_3580_B defined (device class 3580CLASS). tsm: BRAZIL> Figure 13. Define tape pools
tsm: BRAZIL>def stg api_disk_a DISK DESC='Archive disk pool' NEXT=api_3580_a hl=70 lo=20 ANR2200I Storage pool API_DISK_A defined (device class DISK). tsm: BRAZIL>def stg api_disk_b DISK DESC='Backup disk pool' NEXT=api_3580_a hl=70 lo=20 ANR2200I Storage pool API_DISK_B defined (device class DISK). tsm: BRAZIL>def ANR2206I Volume class DISK). tsm: BRAZIL>def ANR2206I Volume class DISK). vol api_disk_a /tsm/dskpool/vol1 /tsm/dskpool/vol1 defined in storage pool API_DISK_A (device vol api_disk_b /tsm/dskpool/vol2 /tsm/dskpool/vol2 defined in storage pool API_DISK_B (device
57
After the storage pools are created, the copygroups can be configured and the above storage pools can be assigned as their destination storage pools (Figure 14 and Figure 15).
tsm: BRAZIL>def copygroup api_domain api_policy api_mgmtclass type=archive DEST=api_disk_a retver=nolimit ANR1535I Archive copy group STANDARD defined in policy domain API_DOMAIN, set API_POLICY, management class API_MGMTCLASS. tsm: BRAZIL>def copygroup api_domain api_policy api_mgmtclass type=backup DEST=api_disk_b vere=1 verd=0 rete=0 reto=0 ANR1530I Backup copy group STANDARD defined in policy domain API_DOMAIN, set API_POLICY, management class API_MGMTCLASS. tsm: BRAZIL> Figure 15. Define copygroups
To actually use the above configuration, the policy set needs to be validated and activated (Figure 16).
tsm: BRAZIL>validate policyset api_domain api_policy ANR1515I Policy set API_POLICY validated in domain API_DOMAIN (ready for activation). tsm: BRAZIL>activate policyset api_domain api_policy Do you wish to proceed? (Yes/No) y ANR1514I Policy set API_POLICY activated in policy domain API_DOMAIN. tsm: BRAZIL> Figure 16. Validate and activate policy
Now the configuration is usable and we can define the client nodes to work with this setup (Figure 17).
tsm: BRAZIL>reg n brazil_db2 brazil_db2 do=api_domain archdel=yes backdel=yes ma xnummp=2 ANR2060I Node BRAZIL_DB2 registered in policy domain API_DOMAIN. ANR2099I Administrative userid BRAZIL_DB1 defined for OWNER access to node BRAZIL_DB1. tsm: BRAZIL> Figure 17. Define Tivoli Storage Manager node
58
59
60
Also check the IBM application availability guide for information about the end of service date for the products you use:
http://www-1.ibm.com/servers/aix/products/ibmsw/list
The details for how to download the client code from this site are found in 8.2, Downloading latest Tivoli Storage Manager baclient and API on page 150.
61
After successfully downloading the software use smitty install_latest or installp to install the Tivoli Storage Manager client API. A fileset tivoli.tsm.client.api must be installed. The extension refers to the supported AIX version and whether to run a 32 bit or 64 bit version. In our lab environment, we used the 32 bit version of DB2, but if you want to use the 64-bit version of DB2, the following requirements must be fulfilled: TheIBM ~ pSeries machine must support 64-bit. AIX 4.3.3.0 or higher is required. The Tivoli Storage Manager 64-bit client must be used. DB2 Version must be V7.1 Fixpak1 or higher. The DB2 instance must be created in 64-bit mode using db2icrt -w 64. A DB2 instance can be upgraded to 64-bit later using the db2iupdt -w 64 command. To check if the DB2 instance is already created in 64-bit mode use the following procedure. (The following is an example for an instance which is not created in 64-bit mode.)
$ cd sqllib/adm $ dump -HX64 db2sysc db2sysc: dump: db2sysc: 0654-108 file is not valid in the current object file mode. Use the -X option to specify the desired object mode.
Do not mix 32-bit and 64-bit Tivoli Storage Manager client and DB2 instances. The backup utilities will fail. For further information on 64-bit platforms, see the DB2 Technical Library and look for this publication Using DB2 Universal Database on 64-bit Platforms, which can be found at:
http://www-4.ibm.com/cgi-bin/db2www/data/db2/udb/winos2unix/support/v7pubs.d2w/en_main
Scroll down this Web page to find the publication within the Administration section.
62
# lslpp -L "tivoli.tsm.client.api*" Fileset Level State Description ---------------------------------------------------------------------------tivoli.tsm.client.api.aix43.32bit 4.1.1.0 C TSM Client - Application Programming Interface tivoli.tsm.client.api.aix43.64bit 4.1.1.0 C TSM Client - 64 Bit Application Programming Interface State A -B -C -O -? -Codes: Applied. Broken. Committed. Obsolete. (partially migrated to newer version) Inconsistent State...Run lppchk -v.
Now you should review the README.API in the /usr/tivoli/tsm/client/api/bin directory. Important files in this directory are the dsmtca (trusted client agent file); and libApiDS.a (API library file). Make sure that there is a link from /usr/lib/libApiDS.a to /usr/tivoli/tsm/client/api/bin/libApiDS.a.
(Replace <dbname> and <mgmtclass> with the desired database name and management class.) The DB2 options that can be set for each database that relate to Tivoli Storage Manager are described in greater detail in 5.5, Optional DB2 configurations on page 69.
63
You can also configure different management classes using the client include/exclude list. This is done by specifying an INCLUDE statement for the database object that is being backed up. You can then add the desired management class to the INCLUDE statement. This works the same way as for the Tivoli Storage Manager Backup-Archive client. The only difference is that the include statement object matches the way DB2 sends the backup object rather than specifying a path and filename. This is described in greater detail in 4.5.3, Tivoli Storage Manager client include-exclude option on page 50. The following information is needed before you begin to configure the client; ask your Tivoli Storage Manager administrator to get the relevant details. Tivoli Storage Manager server name and IP-address The nodename by which the API client will be known to the Tivoli Storage Manager server The password of the API node
64
The DB2 backup command reads and uses the Tivoli Storage Manager client API configuration. - DSMI_DIR Identifies the directory path where the agent file, dsmtca, is located. A korn shell example is:
export DSMI_DIR=/usr/tivoli/tsm/client/api/bin
- DSMI_CONFIG Identifies the full directory path and file name of the Tivoli Storage Manager user options file, dsm.opt. This file contains the name of the server to be used. A korn shell example is:
export DSM_CONFIG=/home/db2inst1/tsm/dsm.opt
- DSMI_LOG Identifies the directory path where the error log file, dsierror.log, is to be created. A korn shell example is:
export DSMI_LOG=/home/db2inst1/tsm
2. Log out and log in again as instance owner so that the environment variables take effect. 3. Create the dsm.sys file. The root user of your system must create or modify the Tivoli Storage Manager system options file, dsm.sys, which must be located in the /usr/tivoli/tsm/client/api/bin directory. The sample dsm.sys.smp in the /usr/tivoli/tsm/client/api/bin directory provides the basic information needed for DB2 backup to work.
Note
The passwordaccess parameter must be set to generate. This parameter specifies that Tivoli Storage Manager encrypts and stores the user password locally and generates a new password when the old one expires. Then DB2 is not required to supply a password each time it initializes a session with the Tivoli Storage Manager server. The following is a sample dsm.sys file. We only need to look at the first stanza. The other stanzas belong to other Tivoli Storage Manager API clients so only part of the dsm.sys file is shown.
65
SErvername COMMMethod TCPPort TCPServeraddress NODename TCPCLIENTAddress PASSWORDAccess SErvername COMMMethod TCPPort TCPServeraddress NODename TCPCLIENTAddress
* Name of this stanza * * * * * Port where Server is listening IP-Adress of TSM Server Must match node name on TSM Server IP-Adress of machine running password will be crypted and saved
Brazil_API2 * Next stanza in dsm.sys file TCPip 1500 9.1.150.57 Brazil_TDP 193.1.1.12
4. Create the dsm.opt file. The instance owner user can create or modify dsm.opt. This file must be located in the directory specified by the DSMI_CONFIG environment variable. The dsm.opt file only needs to have one line in it which is a reference to the server stanza in the dsm.sys file. The Servername given here is only a symbolic one and does not need to match the name of the Tivoli Storage Manager server. It is possible to have two or more API clients on the same system (for example, two instances) with different server characteristics. Each client has its own dsm.opt file pointing to a different stanza in the dsm.sys file.
# cat dsm.opt SErvername
Brazil_db2
5. As instance owner, we stop and start the DB2 instance. This allows DB2 to read the Tivoli Storage Manager configuration performed so far. (DB2 only reads the DSMI environment variables at the time when db2start is issued.)
$ db2stop SQL1064N DB2STOP processing was successful. $ db2start SQL1063N DB2START processing was successful. $
66
Each Tivoli Storage Manager client must have a password to access a server. For that reason, the root user of your system must run the executable file, dsmapipw, installed in the $HOME/sqllib/adsm directory of the instance owner, to establish and reset the Tivoli Storage Manager password. Make sure that the correct DSMI environments (that of the instance owner) are set when root user executes the dsmapipw program. When executed, the dsmapipw program prompts you for the: - Old password, which is the current password for the Tivoli Storage Manager node stored in the server. - New password, which is the new password for the node. After that you should check that a new file was created in the /etc/security/adsm directory that contains the encrypted password. The name of this file is the same as the value specified to the servername option in the dsm.opt file. If you receive any errors, you should look at the dsierror.log file which will show any API error messages. For a listing of API error messages, see Appendix D. API Return Codes with Explanation in Tivoli Storage Manager Using the Application Program Interface V4R1, SH26-4123, at:
http://www.tivoli.com/support/public/Prodman/public_manuals/storage_mgr /admanual.html
For further help, see Appendix B, Troubleshooting on page 277. If there are multiple DB2 databases under one DB2 instance all databases make use of the same Tivoli Storage Manager client API setup. That means all the database backups will go to the same (the default) management class to which this Tivoli Storage Manager node belongs. How to configure different management classes for DB2 databases under the same DB2 instance will be covered in 4.5.3, Tivoli Storage Manager client include-exclude option on page 50, and 5.5, Optional DB2 configurations on page 69.
5.4 Setting up the DB2 user exit for Tivoli Storage Manager
By default, DB2 reuses logs in a circular fashion and are not archived. This will only allow you to do off-line backup and version recovery. You can enable archive logging for the database by setting logretain or userexit to on. You can set them both if you want. When one of these is set, the database is enabled for roll-forward recovery, and you can perform an online backup of the database and tablespaces.
67
If your database has to be up 24 x 7, you should enable roll-forward recovery by setting logretain or userexit to on, so that you can do online backups. The following sections will describe how to enable roll-forward recovery by using the supplied user exit for Tivoli Storage Manager.
Note
The implementation of the use exit requires a full offline database backup in order to become effective. Ensure that you allocate sufficient time for doing this backup.
3. As the instance owner, compile the C program. In our lab, we used the Visual Age C Compiler V4.4. Check your compiler for the correct syntax.
$ cc -I/opt/tivoli/tsm/client/api/bin/samples -L/usr/lib -lApiDS -o db2uext2 db2uext2.c
68
4. Copy the db2uext2 file into the $HOME/sqllib/adm directory of the instance owner. We do not recommend that you copy the file to the $HOME/sqllib/bin directory, because this directory is only a link to a directory in the /opt/IBMdb2/V7.1/bin directory. Make sure the instance owner has execute permission for this file.
Note
If there are multiple databases under one DB2 instance only one user exit program can be used for all the databases. As a result all the user exit logs of these databases merge to the same logfile.
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 was made. Please see 5.7.1, Full offline backup on page 73 for how to make a full offline backup.
69
Note
These database configuration parameters are designed to temporarily overwrite the Tivoli Storage Manager client API setup for the purpose of restore. They should not be used for normal backup operations. TSM_MGMTCLASS This parameter specifies the management class the DB2 backups should go to. The management class must be in the same Tivoli Storage Manager policy domain where the Tivoli Storage Manager API node is defined. Note: The logfiles will always go to the default management class of the Tivoli Storage Manager client API node, even if this parameter is specified. There are two ways to prevent this: - One way is to use the objectAttr.mcNameP variable in the user exit program to set the management class, before the dsmSendObj function was called. (Be aware that if you have more DB2 databases under one DB2 instance, they will use the same userexit command!)
#define MGMT_CLASS MY_DB2_CLASS objectAttr.mcNameP=MGMT_CLASS;
- The other way is to use the Tivoli Storage Manager include-exclude list file. This is one out of three places where the destination management class can be set. The list of these places in top-down order of override priority is: 1. TSM_MGMTCLASS (DB2 configuration) 2. Entry in include-exclude list 3. The default management class of the Tivoli Storage Manager clients) TSM_NODENAME TSM_PASSWORD TSM_OWNER
Note
Each of these parameters, if set, will overwrite the related Tivoli Storage Manager configuration parameter. The password access needs to be set to prompt in the dsm.sys file; otherwise, the DB2 backup command will fail.
70
We recommend not to use these parameters. The decision as to which management class and to which node the backups and logfiles will go should be in the responsibility of the Tivoli Storage Manager administrator and it is best to handle by Tivoli Storage Manager. Here is an example how to set these parameters and also how to unset them again.
$ db2 update db cfg for sample using TSM_MGMTCLASS api_mgmttest 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. $ db2 update db cfg for sample using TSM_MGMTCLASS NULL 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. Figure 19. Use DB2 Tivoli Storage Manager database configuration parameter
5.6 Using the Tivoli Storage Manager baclient in conjunction with DB2
In this section we show how Tivoli Storage Manager Backup-Archive (baclient) can be used to back up a DB2 database at a filesystem level and also how to back up other DB2 relevant files. We assume that a Tivoli Storage Manager baclient is already installed and configured. Besides the normal DB2 database backup cycle, some operating system files need to be backed up to be able to restore the entire DB2 environment for the DB2 database. These files normally reside in the home directory of the instance owner. Examples of such files are: .profile, db2profile, userprofile of the instance owner Additional shell scripts or DB2 SQL scripts Tivoli Storage Manager config files (dsm.opt, dsm.sys, include-exclude list, and so on) The user exit program db2uext2 and the modified source code The DB2 datafiles which compose the DB2 database itself are already being backed up by the DB2 backup command using Tivoli Storage Manager. Therefore, these files should be excluded from the list of files that will be backed up by the Tivoli Storage Manager baclient.
71
Note
The EXCLUDE.FS statement will take effect no matter where it is placed in the include-exclude list file. This means that it will overrule every INCLUDE statement that is related to the same filesystem. For example, an EXCLUDE.FS /home will overrule an INCLUDE /home/db2inst1/.../* no matter where it is placed within the include-exclude list file.
72
To restore the archive again the retrieve option must be specified. See following example.
dsmc retrieve /db2db/ -desc='DB2 file archive'
73
Also make sure that the Tivoli Storage Manager server is online and policies are in place. 5.7.1.2 Offline backup using the command line This example shows an offline backup using the DB2 command line interface. 1. Log in as the database administrator or higher authority and make sure that all applications are logged off from the database you want to back up. Use the following DB2 command to verify that all applications are logged off. Assuming you are backing up the SAMPLE database, the command and output can look like this:
$ db2 list applications for db sample Auth Id Application Name -------- -------------DB2INST1 db2bp $ Appl. Application Id Handle ---------- -----------------------------6 *LOCAL.db2inst1.010312180936 DB # of Name Agents -------- ----SAMPLE 1
2. Logoff all applications connected to the database. In the above results, there is one application using the database. Use the force command enumerating the application handles (separated with commas) inside the parenthesis:
$ db2 "force application ( 6 )" DB20000I The FORCE APPLICATION command completed successfully. DB21024I This command is asynchronous and may not be effective immediately. $
Note that you can use the command force application all to log off all applications if there are too many. However, be careful when using this command, because it will also logoff applications connected to other databases within the instance. 3. Verify that there are no more users connected to the database by again issuing the list application command. 4. Backup the database with the tsm option. The use tsm option tells the DBMS to use the Tivoli Storage Manager API to write the output backup file instead of using common devices. A confirmation will appear to indicate that the backup is successful.
74
$ db2 backup db sample use tsm Backup successful. The timestamp for this backup image is : 20010312104622 $
5.7.1.3 Offline backup using the DB2 Control Center For this example we will be using a Windows client to backup a remote database in the AIX platform. 1. Start the DB2 Control Center. For a Windows system, you will find the Control Center under Start->Programs->IBM DB2->Control Center. For command line or UNIX, type db2cc. Figure 21 shows the Control Center with systems that it can manage.
2. Select the system where the database you want to backup resides. Since we are managing from a remote system, we are prompted as shown in Figure 22 with a dialog to enter the userid and password of the database administration server.
75
Note that for most administration tasks, we use the database administration server instead of the database manager. 3. Review the systems until you see the database you want to backup. Right-click the database and select Backup->Database from the drop down menus as shown in Figure 23.
76
4. The backup database dialog will now appear. From the Media Manager drop down list, select Tivoli Storage Manager. Figure 24 shows the dialog box.
77
5. Select Backup Now to backup the database. When the backup completes, a confirmation dialog appears as shown in Figure 25. Close the dialog box.
Check the DB2 Journal for additional information about the success of the backup. The DB2 journal is under the Tools Menu of the DB2 Control Center. We will discuss the Journal in more detail in the Chapter 7, Day to day management: DB2 backups on UNIX on page 119.
78
$ db2 backup db sample online use tsm Backup successful. The timestamp for this backup image is : 20010312132637 $
5.7.2.3 Online backup using the DB2 Control Center For this example we will be using a Windows client to backup a remote database in the AIX platform. 1. Start the DB2 Control Center. For a Windows system, you will find the Control Center under Start->Programs->IBM DB2->Control Center. For command line or UNIX, type db2cc. Figure 26 shows the Control Center with system that it can manage.
2. Click the system where the database you want to back up resides. Since we are managing from a remote system, we are prompted as shown in Figure 27 with a dialog to enter the userid and password of the database administration server.
79
Note that for most administration tasks, we attach to the database administration server instead of the database manager. 3. Click down the system until you see the database you want to back up. Right-click the database and select Backup->Database from the drop down menus as shown in Figure 28.
80
4. The backup database dialog appears. From the Media Manager drop down list, select Tivoli Storage Manager. Figure 29 shows the resulting dialog box.
81
5. Click on the Options page and select the Online radio button as shown in Figure 30.
6. Select Backup Now to back up the database. When the backup completes, a confirmation dialog appears as shown in Figure 31. Close the dialog box.
82
83
$ db2 backup db sample tablespace userspace1 online use tsm Backup successful. The timestamp for this backup image is : 20010312143618 $
5.7.3.3 Tablespace backup using the DB2 Control Center For this example we will be using a Windows client to backup a tablespace from a remote database in the AIX platform. 1. Start the DB2 Control Center. For a Windows system, you will find the Control Center under Start->Programs->IBM DB2->Control Center. For command line or UNIX, type db2cc. Figure 32 shows the Control Center with systems that it can manage.
2. Select the system where the database for which you want to do a tablespace backup resides. Since we are managing from a remote system, we are prompted as shown in Figure 33 with a dialog to enter the userid and password of the database administration server.
84
3. Click down the system until you find the tablespace under the database tree which you want to back up. On the right panel select the tablespace you want to back up, right-click the tablespace and select Backup from the drop down menu as shown in Figure 34.
85
Note that for most administration tasks, we login as the database administration server instead of the database manager. 4. The backup tablespace dialog appears. For the Media Manager drop down list, select Tivoli Storage Manager. Figure 35 shows the dialog box.
86
5. Click on the Options page and select the Online radio button as shown in Figure 36, if you want an online backup.
6. Select Backup Now to back up the database. When the backup completes a confirmation dialog appears as shown in Figure 37. Close the dialog box.
87
88
$ db2 load from data.load of del insert into org copy yes use tsm SQL3109N The utility is beginning to load data from file "/home/db2inst1/tsm/load/data.load". SQL3500W The utility is beginning the "LOAD" phase at time "03-27-2001 14:15:19.565784". SQL3519W Begin Load Consistency Point. Input record count = "0". SQL3520W Load Consistency Point was successful. SQL3110N The utility has completed processing. "900" rows were read from the input file. SQL3519W Begin Load Consistency Point. Input record count = "900". SQL3520W Load Consistency Point was successful. SQL3515W The utility has finished the "LOAD" phase at time "03-27-2001 14:15:20.397451". Number Number Number Number Number Number of of of of of of rows rows rows rows rows rows read skipped loaded rejected deleted committed = = = = = = 900 0 900 0 0 900
This will send a copy of the data loaded to the DB2 database also to the Tivoli Storage Manager server. (The data will go into the backup copy group of the associated management class). This data will be downloaded again when the DB2 rollforward command calls for it.
89
90
At the time of writing, the latest version and patch level of the Tivoli Storage Manager client is 4.1.2.12. This client version should work with Tivoli Storage Manager server Version 3.7 and higher.
Note
You should not use Tivoli Storage Manager client software Version 4.1.2.00, because there is a problem when using the db2adutl utility. You should use either 4.1.1 or 4.1.2.12. In our lab, we used 4.1.2.12. DB2 only requires the Tivoli Storage Manager client API. If you want to install the client Backup-Archive (baclient) and the documentation, please see the README for prerequisites and installation instructions. The Backup-Archive
91
client can be useful when backing up non-database files, and for using the dsmc utility. The following sections will discuss the requirements and procedures for installing and configuring the Tivoli Storage Manager client API Version 4.1.2.
92
Data Protection Data Protection Storage Manager Storage Manager Storage Manager
for Oracle 32-bit for Oracle License Solaris 2.6/7/8 API Solaris 2.6/7/8 Client Solaris 2.6/7/8 Documentation
b. We are only concerned with the API package. Query the version of the package using the pkginfo command, for example:
# pkginfo -l TIVsmCapi
c. If the API package is from a previous version, uninstall the package using the pkgrm command, for example:
# pkgrm TIVsmCapi
2. The /etc/system must have, as a minimum, the following values. Modify them as necessary, then reboot.
set set set set set set set set set lwp_default_stksize = 0x4000 rpcmod:svc_run_stksize = 0x4000 semsys:seminfo_semmap = 50 semsys:seminfo_semmni = 50 semsys:seminfo_semmns = 300 semsys:seminfo_semmnu = 150 semsys:seminfo_semopm = 50 semsys:seminfo_semume = 50 semsys:seminfo_semmsl = 125
3. Install the Tivoli Storage Manager package. If you download the latest client replace the pathname to the path where you downloaded the software.
# pkgadd -d /cdrom/tsmcli/Solaris TIVsmCapi
93
94
DSMI_DIR Identifies the directory path where dsm.sys, dsmtca, and the subdirectory en_US is located. The en_US subdirectory must contain the dsmclientV3.cat file. DSMI_CONFIG Identifies the full directory path and file name of the Tivoli Storage Manager user options file dsm.opt. This file contains the name of the server to be used. DSMI_LOG Identifies the directory path where the error log file, dsierror.log, is to be created. A sample .profile file may look like this:
# # This is the default standard profile provided to a user. They are expected to edit it to meet their own needs.
MAIL=/usr/mail/${LOGNAME:?} # The following three lines have been added by UDB DB2. if [ -f sqllib/db2profile ]; then . sqllib/db2profile fi DSMI_DIR=/opt/tivoli/tsm/client/api/bin DSMI_CONFIG=$HOME/tsm/dsm.opt DSMI_LOG=$HOME/tsm export DSMI_DIR DSMI_CONFIG DSMI_LOG
95
initializes a session with the Tivoli Storage Manager server. A sample dsm.sys file may look like this:
SERVERNAME COMMMETHOD TCPPORT TCPSERVERADDRESS NODENAME PASSWORDACCESS brazil-db2 TCPip 1500 193.1.1.11 sol-db2 generate
2. Create the dsm.opt file The instance owner can create or modify dsm.opt. This file must be located in the directory specified by your DSMI_CONFIG environment variable. The dsm.opt file only need to have one line in it which is a reference to the Server Stanza in the dsm.sys file. The Name given here is only a symbolic one and does not need to match the name of the Tivoli Storage Manager server. It is possible to have two or more API clients on the same system (for example, two instances) with different server characteristics. Each client has its own dsm.opt file pointing to a different stanza in the dsm.sys file. Here is a sample dsm.opt file:
SErvername brazil-db2
3. Set the Tivoli Storage Manager password Each Tivoli Storage Manager client must have a password to access a server. For that reason, the root user of your system must run the executable file, dsmapipw, installed in the $HOME/instance/sqllib/adsm directory, to establish and reset the Tivoli Storage Manager password. If you are using multiple Tivoli Storage Manager servers from this machine, make sure that root has the above environment variables set correctly. When executed, the dsmapipw program prompts you for the: - Old password, which is the current password for the Tivoli Storage Manager node stored in the server. - New password, which is the new password for the node. You may check that there will be a new file created in the /etc/adsm directory that contains the encrypted password. The name of this file is the same as the servername entry in the dsm.opt file.
96
4. Login as the instance owner for the new environment variables Tivoli Storage Manager environment variables in $HOME/profile or $HOME/sqllib/userprofile to take effect. 5. Start and stop DB2.
$ db2stop $ db2start
6.3 Setting up the DB2 user exit for Tivoli Storage Manager
By default, DB2 reuses logs in a circular fashion and are not archived. This will only allow you to do offline backup and version recovery. You can enable archive logging for the database by setting logretain or userexit to On. You can set them both if you want. When one of these is set, the database is enabled for roll-forward recovery, and you can perform an online backup of the database and tablespaces. If your database is required to be up 24 x 7, you should enable roll-forward recovery by setting logretain or userexit to On, so you can do online backups. The following sections will describe enabling roll-forward recovery by using the supplied user exit for Tivoli Storage Manager.
97
#define BUFFER_SIZE #define AUDIT_ACTIVE #define ERROR_ACTIVE #define AUDIT_ERROR_PATH d with a slash */ #define AUDIT_ERROR_ATTR
/* transmit or receive the log */ /* file in 4k portions */ 1 /* enable audit trail logging */ 1 /* enable error trail logging */ "/export/home/db2inst1/tsm/" /* path must en "a" /* append to text file */
4096
3. As the instance owner, compile the C program. In our lab, we used the GNU C Compiler gcc. Check your compiler for the correct syntax.
$ gcc -I/opt/tivoli/tsm/client/api/bin/samples -L/usr/lib -lApiDS -o db2uext2 db2uext2.c
4. Copy the db2uext2 file into the $HOME/sqllib/adm directory of the instance owner. We do not recommend for you to copy the file to the $HOME/sqllib/bin directory, because this directory is only a link to a directory in the /opt/IBMdb2/V7.1/bin directory. Make sure the instance owner has execute permission for this file.
The changes will not take effect until all applications disconnect from the database. If the activate database command was issued, the deactivate database command must be issued. When all applications disconnect from the database, the database will be in backup pending state. 2. When all applications disconnect from the database and the database is in backup pending state, no connections are allowed until a backup is completed. Perform a backup of the database. For more information, see 6.5.1, Full offline backup on page 101 for a detailed discussion on offline backups.
$ db2 backup db sample use tsm
98
After the backup, the database is ready for use and will be able to archive logs to Tivoli Storage Manager.
99
INCLUDE /home/db2inst1/.../* EXCLUDE /home/db2inst1/db2inst1/.../* EXCLUDE.FS /db2db/.../* Figure 38. Tivoli Storage Manager Backup-Archive include-exclude file example
Note
The EXCLUDE.FS statement will take effect no matter where it is placed in the include-exclude list file. This means that it will overrule every INCLUDE statement that is related to the same filesystem. For example, an EXCLUDE.FS /home will overrule an INCLUDE /home/db2inst1/.../*, no matter where it is placed within the include-exclude list file. If there is a need to backup the DB2 datafiles where the DB2 database is built on, the archive option of the Tivoli Storage Manager Backup-Archive client should be used. The archive option will create an archived set of files in the archive copy destination of the related management class at the Tivoli Storage Manager server and it will NOT read the include-exclude list file. It will back up all files specified, no matter if they have changed or not since the last archive. A description should be assigned to each archive set in order to more easily retrieve it. The database needs to be stopped or suspended to have a consistent state during backup. The command shown below will make an archive backup of all files that are under the /db2db/ directory.
# dsmc archive -subdir=yes -desc=DB2 file archive /db2db/
To restore the archive again the retrieve option must be specified. See following example.
100
Also make sure that the Tivoli Storage Manager server is online and policies are in place. 6.5.1.2 Offline backup using the command line This example shows an offline backup using the DB2 command line interface. 1. Log in as the database administrator or higher authority and make sure that all applications are logged off from the database you want to back up. Use the following DB2 command to verify that all applications are logged off. Assuming you are backing up the SAMPLE database, the command and output may look like this:
101
$ db2 list applications for db sample Auth Id Application Name -------- -------------DB2INST1 db2bp $ Appl. Application Id Handle ---------- -----------------------------6 *LOCAL.db2inst1.010312180936 DB # of Name Agents -------- ----SAMPLE 1
2. Logoff all applications connected to the database. In the above results, there is one application using the database. Use the force command enumerating the application handles (separated with commas) inside the parenthesis:
$ db2 "force application ( 6 )" DB20000I The FORCE APPLICATION command completed successfully. DB21024I This command is asynchronous and may not be effective immediately. $
Note that you can use the command force application all to log off all applications if there are too many. However, be careful when using this command, because it will also logoff applications connected to other databases within the instance. 3. Verify that there are no more user connected to the database by issuing again the list application command. 4. Backup the database with the tsm option. The use tsm option tells the DBMS to use the Tivoli Storage Manager API to write the output backup file instead of using common devices. A confirmation will appear to indicate that the backup is successful.
$ db2 backup db sample use tsm Backup successful. The timestamp for this backup image is : 20010312104622 $
6.5.1.3 Offline backup using the DB2 Control Center For this example, we will be using a Windows client to backup a remote database in the Solaris platform. 1. Start the DB2 Control Center. For a Windows system, you will find the Control Center under Start->Programs->IBM DB2->Control Center. For
102
command line or UNIX, type db2cc. Figure 39 shows the Control Center with system that it can manage.
2. Click the system where the database you want to backup resides. Since we are managing from a remote system, we are prompted as shown in Figure 40 with a dialog to enter the userid and password of the database administration server.
103
Note that for most administration tasks, we attach to the database administration server instead of the database manager. 3. Click down the system until you see the database you want to backup. Right-click the database and select Backup->Database from the drop down menus as shown in Figure 41.
104
Note that for most administration tasks, we attach to the database administration server instead of the database manager. 4. The backup database dialog appears. For the Media Manager drop down list, select Tivoli Storage Manager. Figure 42 shows the dialog box.
105
5. Select Backup Now to backup the database. When the backup completes, a confirmation dialog appears as shown in Figure 43. Close the dialog box.
The DB2 Journal will now provide additional information about the success of the backup. The DB2 Journal is in the Tools menu of the DB2 Control Center. We will discuss the Journal in more detail in 7.5.2, Automate DB2 backup using DB2 on page 135.
106
6.5.2.3 Online backup using the DB2 Control Center For this example, we will be using a Windows client to backup a remote database in the Solaris platform. 1. Start the DB2 Control Center. For a Windows system, you will find the Control Center under Start->Programs->IBM DB2->Control Center. For command line or UNIX, type db2cc. Figure 44 shows the Control Center with system that it can manage.
107
2. Click the system where the database you want to backup resides. Since we are managing from a remote system, we are prompted as shown in Figure 45 with a dialog to enter the userid and password of the database administration server.
108
Note that for most administration tasks, we attach to the database administration server instead of the database manager. 3. Click down the system until you see the database you want to backup. Right-click the database and select Backup->Database from the drop down menus as shown in Figure 46.
109
4. The backup database dialog appears. For the Media Manager drop down list, select Tivoli Storage Manager. Figure 47 shows the dialog box.
110
5. Click on the Options page and select the Online radio button as shown in Figure 48.
6. Select Backup Now to backup the database. When the backup completes, a confirmation dialog appears as shown in Figure 49. Close the dialog box.
111
or load on important tables on a tablespace. The user wants the new data backed up. Since you do not want to repeat the database backup, you can do a tablespace backup. The next database backup will be done on your next nightly backup schedule. You can perform a tablespace backup either offline or online. 6.5.3.1 Preparatory step You must enable roll-forward recovery to use online backup. See 6.3, Setting up the DB2 user exit for Tivoli Storage Manager on page 97. 6.5.3.2 Tablespace backup using the command line This example shows an tablespace backup using the DB2 command line interface. 1. Log in as the database administrator or higher authority. 2. Backup the tablespace with the tsm option. The use tsm option tells the DBMS to use the Tivoli Storage Manager API to write the output backup file instead of using common devices. If you want to an online backup, use the online option. Assuming that you are backing up a database SAMPLE tablespace USERSPACE1, the command and results may look like this:
$ db2 backup db sample tablespace userspace1 online use tsm Backup successful. The timestamp for this backup image is : 20010312143618 $
6.5.3.3 Tablespace backup using the DB2 Control Center For this example, we will be using a Windows client to backup a tablespace from a remote database in the Solaris platform. 1. Start the DB2 Control Center. For a Windows system, you will find the Control Center under Start->Programs->IBM DB2->Control Center. For command line or UNIX, type db2cc. Figure 50 shows the Control Center with systems that it can manage.
112
2. Click the system where the database you want to do a tablespace backup resides. Since we are managing from a remote system, we are prompted as shown in Figure 51 with a dialog to enter the userid and password of the database administration server.
113
3. Click down the system until you click the tablespace under the database tree you want to backup. On the right pane select the tablespace you want to backup, right-click the tablespace and select Backup from the drop down menu as shown in Figure 52.
114
Note that for most administration tasks, we attach to the database administration server instead of the database manager. 4. The backup tablespace dialog appears. For the Media Manager drop down list, select Tivoli Storage Manager. Figure 53 shows the dialog box.
115
5. Click on the Options page and select the Online radio button as shown in Figure 54, if you want an online backup.
6. Select Backup Now to backup the database. When the backup completes, a confirmation dialog appears as shown in Figure 55. Close the dialog box.
116
After restoring a full database backup, every transaction after that backup can be rolled forward. The DB2 load utility doesnt log its activity into the DB2 logfiles. The advantage is that the DB2 load utility is able to load the data very quickly into the DB2 database. The disadvantage is that, if not otherwise specified, the database will not be able for rollforward recovery. To allow rollforward recovery when data will be loaded via the DB2 load utility the copy yes option of the load utility must be specified. This will generate a copy of the loaded data that will be saved to a specified location. In our example, we will save this copy to Tivoli Storage Manager server using the use tsm option.
$ db2 load from data.load of del insert into org copy yes use tsm SQL3109N The utility is beginning to load data from file "/home/db2inst1/tsm/load/data.load". SQL3500W The utility is beginning the "LOAD" phase at time "03-27-2001 14:15:19.565784". SQL3519W Begin Load Consistency Point. Input record count = "0". SQL3520W Load Consistency Point was successful. SQL3110N The utility has completed processing. "900" rows were read from the input file. SQL3519W Begin Load Consistency Point. Input record count = "900". SQL3520W Load Consistency Point was successful. SQL3515W The utility has finished the "LOAD" phase at time "03-27-2001 14:15:20.397451". Number Number Number Number Number Number of of of of of of rows rows rows rows rows rows read skipped loaded rejected deleted committed = = = = = = 900 0 900 0 0 900
This will send a copy of the data loaded to the DB2 database and also to the Tivoli Storage Manager server. (The data will go into the backup copy group of the associated management class.) This data will be downloaded again when the DB2 rollforward command will need it.
117
118
[ [ [ TABLESPACE | FULL | LOADCOPY ] [ SHOW INACTIVE ] ] | [ LOGS [ BETWEEN <Sn1> AND <Sn2> ] ] ] |
EXTRACT [ [ [ TABLESPACE | FULL | LOADCOPY ] [ SHOW INACTIVE ] [ TAKEN AT <timestamp> ] ] | [ LOGS [ BETWEEN <Sn1> AND <Sn2> ] ] ] | DELETE [ [ [ TABLESPACE | FULL | LOADCOPY [ KEEP <n> | OLDER [THAN] [ <timestamp> <n> DAYS TAKEN AT <timestamp> ] ] | [ LOGS [ BETWEEN <Sn1> AND <Sn2> VERIFY [ [ TABLESPACE | FULL ] [ SHOW INACTIVE ] [ TAKEN AT <timestamp> ] ] | [ {DATABASE | DB} <database name> ] [ NODE <n> ] [ PASSWORD <password> ] [ NODENAME <nodename> ] [ OWNER <owner> ] [ WITHOUT PROMPTING ] Figure 56. Syntax of db2adutl ] | ] | ]]] }
119
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. 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. Note: The Tivoli Storage Manager server can be configured to retain deleted backup versions. In this case, backup objects remain on the server even if you delete them by using db2adutl. If you do not want to keep these inactive objects, you have to configure your Tivoli Storage Manager server to either of the following: Set the number of backup versions, if client data is deleted (VERDELETED), to 0. Or Set the length of time to retain the last remaining copy of a deleted file (RETONLY) to 0. For further Tivoli Storage Manager server considerations, see 4.5.2, Tivoli Storage Manager management class considerations on page 48. 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. See 7.3.3, Verification using db2adutl on page 126 for further information. 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 120
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.
You will be prompted for the node name and the password. Use any administrator nodename as it should have sufficient privileges for the SELECT command. We used the node name associated with the Tivoli Storage Manager client API node name, as used in the dsm.sys file in 5.3, Configuration and setup of Tivoli Storage Manager client API on page 63.
121
$ id uid=203(db2inst1) gid=102(db2iadm1) groups=1(staff),101(db2asgrp) $ dsmadmc Tivoli Storage Manager Command Line Administrative Interface - Version 4, Release 1, Level 1.0 (C) Copyright IBM Corporation, 1990, 1999, All Rights Reserved. Enter your user id: brazil_db2 Enter your password: Session established with server BRAZIL: AIX-RS/6000 Server Version 4, Release 1, Level 2.0 Server date/time: 03/07/01 16:38:07 Last access: 03/07/01 tsm: BRAZIL> .
16:25:13
Type help to get a list of the possible commands you can use. Every backup or logfile is indexed in the Tivoli Storage Manager server database. To get a list of the backups you have already made, enter the following command:
select * from backups where node_name=<client API node name>
Note: The <client API node name> must be in uppercase. See Figure 57 for the results of the command.
tsm: BRAZIL>select * from backups where node_name='BRAZIL_DB2' ANR2963W This SQL query may produce a very large result table, or may require a significant amount of time to compute. Do you wish to proceed? (Yes/No)y NODE_NAME: FILESPACE_NAME: STATE: TYPE: HL_NAME: LL_NAME: OBJECT_ID: BACKUP_DATE: DEACTIVATE_DATE: OWNER: CLASS_NAME: BRAZIL_DB2 /SAMPLE ACTIVE_VERSION FILE /NODE0000/ FULL_BACKUP.20010301184338.1 19470 2001-03-01 18:43:39.000000 db2inst1 DEFAULT
NODE_NAME: BRAZIL_DB2 FILESPACE_NAME: /SAMPLE STATE: ACTIVE_VERSION Figure 57. Output of Tivoli Storage Manager Select command
122
To get more specific output, the query can be extended by combining more search queries together, as in the next example.
tsm: BRAZIL>select * from backups where node_name='BRAZIL_DB2' and FILESPACE_NAM E='/SPLITDB' Session established with server BRAZIL: AIX-RS/6000 Server Version 4, Release 1, Level 2.0 Server date/time: 03/07/01 17:50:18 Last access: 03/07/01 17:29:59 ANR2963W This SQL query may produce a very large result table, or may require a significant amount of time to compute. Do you wish to proceed? (Yes/No) y NODE_NAME: FILESPACE_NAME: STATE: TYPE: HL_NAME: LL_NAME: OBJECT_ID: BACKUP_DATE: DEACTIVATE_DATE: OWNER: CLASS_NAME: tsm: BRAZIL> BRAZIL_DB2 /SPLITDB ACTIVE_VERSION FILE /NODE0000/ FULL_BACKUP.20010302101250.1 19498 2001-03-02 10:12:50.000000 db2inst1 DEFAULT
There is also a command line interface to the Tivoli Storage Manager server combining the logon process and the Tivoli Storage Manager command in a single step. This can be useful if you are creating shell scripts that need information from the Tivoli Storage Manager server directly, such as:
dsmadmc -id=brazil-db2 -password=brazil_db2 select * from backups
When using the user exit, the logfiles will be backed up into the archive copy group. To get information about archived items, the query must be changed to select items from the archives table. See the following example.
123
tsm: BRAZIL>select * from archives where node_name='BRAZIL_DB2' ANR2963W This SQL query may produce a very large result table, or may require a significant amount of time to compute. Do you wish to proceed? (Yes/No) y NODE_NAME: FILESPACE_NAME: TYPE: HL_NAME: LL_NAME: OBJECT_ID: ARCHIVE_DATE: OWNER: DESCRIPTION: CLASS_NAME: NODE_NAME: FILESPACE_NAME: TYPE: HL_NAME: LL_NAME: BRAZIL_DB2 /SAMPLE FILE /NODE0000/ S0000000.LOG 19487 2001-03-01 19:52:47.000000 db2inst1 Log file for DB2 database SAMPLE DEFAULT BRAZIL_DB2 /SAMPLE FILE /NODE0000/ S0000000.LOG
124
$ db2ckbkp SAMPLE.0.db2inst1.NODE0000.CATN0000.20010308132920.001 [1] Buffers processed: #### Image Verification Complete - successful. $ Figure 58. Example db2ckbkp
The relevant information is contained within the first line of each stanza. These lines show the: 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 V7, SC09-2951.
125
An alternative test would be to only download one file from the Tivoli Storage Manager server and see if the whole file is readable. The db2adutl extract option must be used.
126
$ db2adutl extract full taken at 20010314084325 db sample Query for database SAMPLE Retrieving full database backup information. Please wait. full database backup image: ./SAMPLE.0.db2inst1.NODE0000.CATN0000.20010314084325.001 , Node: 0 Do you wish to extract ALL of these images (Y/N)? y Writing to file: ./SAMPLE.0.db2inst1.NODE0000.CATN0000.20010314084325.001 $ Figure 61. Example db2adutl extract
The best way to verify the backup is 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 going to be restorable. The whole image will be read from the Tivoli Storage Manager server into a local memory buffer (not the whole image at once but piece by piece). There is nothing written to local disk, but the actual data transfer over the local area network (LAN) should be considered. Issuing db2adutl verify will cause the utility to read through the image in the same way that restore does. It will verify that all of the required objects (media header, DB configuration, DB history, list of tablespace, tablespace definitions, and so on) exist in the object. The tool performs numerous checks but it will not, and cannot, actually check the integrity of any of the userdata that exists in the backup image.
127
$ db2adutl verify full taken at 20010314084325 db sample Query for database SAMPLE Retrieving full database backup information. Please wait. full database backup image: ./SAMPLE.0.db2inst1.NODE0000.CATN0000.20010314084325.001 , Node: 0 Do you wish to verify this image (Y/N)? y Verifying file: ./SAMPLE.0.db2inst1.NODE0000.CATN0000.20010314084325.001 ================== BUFFER 0 ================== ================== BUFFER 1 ================== ================== BUFFER 2 ================== ================== BUFFER 3 ================== 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. Figure 62. Example db2adutl verify
Note: The Warning message shown in Figure 62 is misleading and can be ignored. The last line is the important one and it indicates that the verification was successful.
128
#!/bin/ksh LOG=/home/db2inst1/tsm/db2backup.log DB=SAMPLE # # First backup the database # db2 backup db $DB use tsm >> $LOG 2>&1 # # Verify # RC=$? if [ $RC then echo exit fi if return code from backup is 0 != 0 ] "Backup was not successful" | mail db2inst1@brazil 1
# # 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 Figure 63. Sample backup and verification script
129
The db2uext2 command is responsible for sending or downloading the DB2 logfiles to Tivoli Storage Manager. If this command encounters an error a new entry is created in the USEREXIT.ERR command. One approach is to check the USEREXIT.ERR file periodically to see whether it contains a new entry. However, a more direct way is to modify the userexit command itself to send the information not only to the USEREXIT.ERR file, but also to an automated operation product. The ErrorLog function within the db2uext2 C source-code is responsible for writing the required error information to the USEREXIT.ERR file. We can add some additional program code to this routine to send the data to another location or to run an operating system program. Try to add only simple additional code in order to keep the source code maintainable. In the following example, we use the C system routine. The C system routine is designed to execute an operating system command on a command line. In our example, we use this routine to send a mail to the root user. (Only a short part of the db2uext2.c file is shown.) We do not cover any error handling in this example.
/* ----------------------------------------------------------- */ /* Close the error log file */ /* ----------------------------------------------------------- */ fclose( errorLogFp ) ; /* Newly added line for automtic error notification */ system ( "echo 'userexit error' | mail -s userexit root");
If the user exit writes an error message to the USEREXIT.ERR file, the root user will also get notification like the following:
Message 1: From db2inst1 Fri Mar 30 16:48:29 2001 Date: Fri, 30 Mar 2001 16:48:29 -0600 From: db2inst1 To: root Subject: userexit userexit error
130
131
Only those logfiles should be deleted that will not be needed by any of the existing database backups for rollforward. To delete old backed up logfiles the delete qualifier of the db2adutl utility must be used. The deletion of logfiles is itself a little bit complicated, because there is no timestamp associated with backed up logfiles. The range of the logfiles must be specified. See Figure 64 for an example (no tablespace or loadcopy backups are shown!).
Retrieving full database backup information. full database backup image: 1, Time: 20010315135917 Oldest log: S0000041.LOG, Node: 0, Sessions used: 1 full database backup image: 2, Time: 20010315134808 Oldest log: S0000038.LOG, Node: 0, Sessions used: 1 Retrieving log archive information. Log file: S0000035.LOG, Node: 0, Log file: S0000036.LOG, Node: 0, Log file: S0000037.LOG, Node: 0, Log file: S0000038.LOG, Node: 0, Log file: S0000039.LOG, Node: 0, Log file: S0000040.LOG, Node: 0, Log file: S0000041.LOG, Node: 0, Log file: S0000042.LOG, Node: 0, Taken Taken Taken Taken Taken Taken Taken Taken at: at: at: at: at: at: at: at: 2001-03-15-13.37.54 2001-03-15-13.44.27 2001-03-15-13.47.10 2001-03-15-13.47.53 2001-03-15-13.48.38 2001-03-15-13.55.29 2001-03-15-14.00.03 2001-03-15-14.00.48
$ db2adutl delete logs between S0000035.LOG and S0000037.LOG db sample Query for database SAMPLE Retrieving log archive information. Log file: S0000035.LOG, Node: 0, Taken at: 2001-03-15-13.37.54 Do you want to delete this log image (Y/N)? y Are you sure (Y/N)? y Log file: S0000036.LOG, Node: 0, Taken at: 2001-03-15-13.44.27 Do you want to delete this log image (Y/N)? y Are you sure (Y/N)? y Log file: S0000037.LOG, Node: 0, Taken at: 2001-03-15-13.47.10 Do you want to delete this log image (Y/N)? y Are you sure (Y/N)? y Figure 64. Example db2adutl delete logfiles
The between range is a little bit misleading. As shown in the example, the logfiles 35 and 37 are also being deleted.
132
let OLDEST_LOG=$(db2adutl query full db $DB | tail -2 | awk '{print $3}' | cut -c2-8 ) let OLDEST_LOG=$OLDEST_LOG-1 OLD_LOG=$(printf "%-7.7d" $OLDEST_LOG) OLD_LOG="S$OLD_LOG.LOG" # Now delete obsolete logs # db2adutl delete logs between S0000000.LOG and $OLD_LOG db $DB without prompting Figure 65. Example script of deletion of obsolete backups and logfiles
This script does not contain any error handling, notification or recovery in case of problems and must be adapted and well tested in every specific environment.
133
Generally such a script needs to be reviewed whenever the output of the db2adutl utility changes, for example, after applying a fixpak. Also keep in mind that after the restore of a backup, the logfile numbering may change.
30 1 * * * /etc/stop_db
Each crontab file entry consists of a line with six fields, separated by spaces and tabs. The fields contain, respectively: 1. The minute (0 through 59) 2. The hour (0 through 23 3. The day of the month (1 through 31) 4. The month of the year (1 through 12)
134
5. The day of the week (0 through 6 for Sunday through Saturday) 6. The shell command Cron starts a limited bsh (Bourne shell) for each command user. This is important when starting a single command from crontab, make sure that the command is able to run in bsh. If the command started from the crontab is a shell script every shell can be used inside the shell script, like the following example.
#!/bin/ksh # Backup the database db2 backup db sample use tsm Figure 66. Sample backup shell script
To imbed the shell script into cron use the crontab -e command. This will open the default editor or the editor specified by the EDITOR environment variable.
# export EDITOR=/usr/bin/vi # crontab -e
Now edit a line similar to the following. Remember to use full pathnames for the executables and logfiles. If stdout and stderr is not redirected the owner, named the same as the crontab file, will receive mail every time the command produces output to stdout or stderr.
30 1 * * * /home/db2inst1/tsm/db2backup.ksh >/tmp/stdout.out 2>/tmp/err.out
135
To launch the DB2 Control Center enter db2cc on UNIX systems. On Windows systems, the DB2 Control Center can be found under Start->Programs->IBM DB2. 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 on the database name and select Backup and Database as shown in Figure 67.
Choose whether you want to do an online or offline, full or tablespace backup. Do not forget to set the media type to Tivoli Storage Manager. After you make your selection press the Schedule button as shown in Figure 68.
136
This will open the DB2 schedule window as shown in Figure 69.
137
This window is very useful. Click on 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. It is not possible to select the type of backup (offline or online, full or tablespace) from this window. This can only be done by starting again from the backup window as shown in Figure 68. 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 70.
The system name must be selected first. By pressing 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.
138
Sometimes, you need to customize the DB2 commands or run a series of commands as a script or batch files. You can use the Script Center to create a script. This is located under the Tools menu of the Control Center. Figure 71 shows the Script Center, and the scripts available under a system named BRAZIL.
You can create a new script from the Scripts->New menu. Figure 72 shows a backup script using the parallelism option.
139
To schedule the script, highlight the entry in the Script Center, and right-click to display the drop down menu as shown in Figure 73. You can then select Schedule to schedule the script.
140
141
To make use of the Tivoli Storage Manager Scheduler, root access and a Tivoli Storage Manager user with administrative privileges is needed. The necessary steps are: Register and setup a Tivoli Storage Manager baclient for this node. Define a shell script to be executed. Define the Tivoli Storage Manager schedule to execute shell script. Start the Tivoli Storage Manager schedule daemon on the client.
7.5.3.1 Setup Tivoli Storage Manager baclient The Tivoli Storage Manager baclient must be setup in order to use the Tivoli Storage Manager client scheduler. If there is already a Tivoli Storage Manager baclient defined, this one can be used. We assume that the Tivoli Storage Manager baclient software is already installed. As root user, create a stanza in the /usr/tivoli/tsm/client/ba/bin/dsm.sys file for the baclient. This stanza is similar to that one already defined in the /usr/tivoli/tsm/client/api/bin/dsm.sys file for the Tivoli Storage Manager API client.
Note
Every Tivoli Storage Manager client that runs a scheduler in prompted mode must connect over a dedicated port to the server. If there is more than one Tivoli Storage Manager client scheduler running on the same machine, the TCP port must be different.
SErvername Brazil_db2 COMMmethod TCPip TCPPort 1500 TCPServeraddress 9.1.150.57 TCPCLIENTPort 1501 * Each locally client must have a * different TCP Port if running a * prompted scheduler at the same time NODename Brazil_db2 PasswordAccess Generate SCHEDMode Prompted SCHEDLOGName /home/db2inst1/tsm/dsmsched.log ERRORLOGName /home/db2inst1/tsm/dsmerror.log Figure 74. Example dsm.sys file for Tivoli Storage Manager client scheduler
7.5.3.2 Define a script to be executed The instance owner can create a script to automate the backup. We do not cover any error handling or recovery in this script. The sample script below needs to be adapted to fit into your environment.
142
7.5.3.3 Configure the TSM schedule to perform the backup script This step requires Tivoli Storage Manager administrator privileges. Logon to the sever via an administrative client session with a user that has Tivoli Storage Manager server administrator privileges:
dsmamdc
The following information is necessary to define the schedule: Name of the shell script Name of the domain to which the node belongs Time when schedule should run
tsm: BRAZIL>def sched api_domain db2sched act=command objects='su - db2inst1 -c /home/db2inst1/db2backup.ksh' starttime=09:35 ANR2500I Schedule DB2SCHED defined in policy domain API_DOMAIN. tsm: BRAZIL>q sched Domain * Schedule Name Action Start Date/Time Duration Period Day ------------ - ---------------- ------ -------------------- -------- ------ --API_DOMAIN DB2SCHED CMD 03/08/01 09:35:00 5M 1 D Any tsm: BRAZIL>
Now the Tivoli Storage Manager client node needs to be associated to the previously defined schedule. Use the define association command as shown here:
tsm: BRAZIL>def assoc api_domain db2sched brazil_db2 ANR2510I Node BRAZIL_DB2 associated with schedule DB2SCHED in policy domain API_DOMAIN. tsm: BRAZIL>
7.5.3.4 Start the client scheduler The client scheduler is part of the baclient and only the root user is allowed to start it. It is started with the dsmc sched command. Because we may use a specific stanza from our dsm.sys file, we need to specify which one to use with the -se option:
dsmc sched -se=brazil_db2
143
This command runs in the foreground. The output will look like the following.
# dsmc sched -se=brazil_db2 Tivoli Storage Manager Command Line Backup Client Interface - Version 4, Release 1, Level 1.0 (C) Copyright IBM Corporation, 1990, 2000, All Rights Reserved. Querying server for next scheduled event. Node Name: BRAZIL_DB2 Session established with server BRAZIL: AIX-RS/6000 Server Version 4, Release 1, Level 2.0 Server date/time: 03/08/01 09:12:13 Last access: 03/08/01
09:11:38
Next operation scheduled: -----------------------------------------------------------Schedule Name: DB2SCHED Action: Command Objects: su - db2inst1 -c /home/db2inst1/tsm/db2backup.ksh Options: Server Window Start: 09:25:00 on 03/09/01 -----------------------------------------------------------Waiting to be contacted by the server.
The same information will also be logged into the dsmsched.error logfile that we specified in the dsm.sys file in Figure 74 on page 142. The Tivoli Storage Manager client scheduler now waits until a schedule to which this Tivoli Storage Manager client is associated reaches its start time. At this specified time, the Tivoli Storage Manager server will prompt the client to execute the specified action. In this case, it will be the command as described by the tsm option objects. To start the Tivoli Storage Manager client scheduler automatically every time the system is rebooted, a line must be inserted in /etc/inittab. Use the inittab action once as dsmc sched runs in foreground, otherwise, this line will block the start of the next lines in /etc/inittab.
imqss:2:once:/usr/IMNSearch/bin/imq_start >/dev/console 2>&1 db:2:once:/etc/rc.db2 > /dev/console 2>&1 # Autostart DB2 Services i4ls:2:wait:/etc/i4ls.rc > /dev/null 2>&1 # Start i4ls orapw:2:wait:/etc/loadext -l /etc/pw-syscall dsmc:once:/usr/bin/dsmc sched -se=brazil_db2
For AIX, the Tivoli Storage Manager client scheduler can be defined as an owned resource for the system resource controller (SRC). This can be done using the mkssys command. After the resource has first been defined, it can be started, controlled and stopped with the startsrc, lssrc and stopsrc
144
commands. Other UNIX systems may have their own resource management where the Tivoli Storage Manager client scheduler can be included.
# mkssys -s dsmc.brazil_db2 -p /usr/tivoli/tsm/client/ba/bin/dsmc -u 0 -asched \ -se=brazil_db2 -i/dev/null -o/dev/null -e/dev/null -O -S -f 9 -n 15 -G tsm 0513-071 The dsmc.brazil_db2 Subsystem has been added. # startsrc -s dsmc.brazil_db2 0513-059 The dsmc.brazil_db2 Subsystem has been started. Subsystem PID is 24698 # lssrc -g tsm Subsystem Group PID Status dsmc.brazil_db2 tsm 24698 active # stopsrc -s dsmc.barzil_db2 0513-044 The dsmc.brazil_db2 Subsystem was requested to stop # lssrc -s dsmc.brazil_db2 Subsystem Group PID Status dsmc.brazil_db2 tsm inoperative #
Information about scheduled events will show up in the dsmsched.log as defined in dsm.sys file in Figure 74.
Note that you can specify the initial prefix for the timestamp. The minimum specification is yyyy.
145
146
147
148
149
tsm: BRAZIL>register node jamaica_db2 jamaica_db2 domain=api_domain backdelete=yes maxnummp=2 ANR2060I Node JAMAICA_DB2 registered in policy domain API_DOMAIN. ANR2099I Administrative userid JAMAICA_DB2 defined for OWNER access to node JAMAICA_DB2.
From this site you can select which Tivoli Storage Manager client version and release. The latest is Version 4 Release 1. In Figure 75 this is represented by the folder v4r1.
After selecting the version and release, you are presented with a list of operating systems to choose from. Select the Windows directory, then select the i386 directory, and now select which level of code to download. Figure 76 shows the levels of the Version 4 Release 1 Tivoli Storage Manager clients that were available in March of 2001. The folder LATEST always links to the latest level of client code available. Currently the latest level is v412, so the v412 folder or the LATEST folder will take you to the same place.
150
Figure 77 shows the files available for the latest level of the Tivoli Storage Manager client. At the time of writing, the file ending readme.ftp (IP22151_12_readme.ftp) contains instructions on how to download and install the client code. The file ending read1stc.txt (IP22151_12_read1stc.txt) is the readme for this level of code. The readme contains useful information that should be read before download and installation. Among other things the readme contains: system requirements, warnings, APARS fixed in the PTF, limitations, and so on. We downloaded the file IP22151_12.exe and saved it to the local hard drive of the machine that the DB2 server is running on. The full level information of this package is Version 4 Release 1 Level 2.12.
8.3 Installation
After downloading the Tivoli Storage Manager client file, double-click the package to start the installation process. You will be presented with a window requesting a temporary location to extract the contents of the package (Figure 78).
151
The next window will prompt you for which language you want to use (Figure 79).
After selecting the desired language, you will be presented with a welcome window to InstallShield, informing you that this will install the Tivoli Storage Manager Client (Figure 80).
152
Select the desired installation directory. We selected the default location of c:\Program Files\Tivoli\TSM\ (Figure 81).
Select either Complete or Custom (Figure 82). Complete includes the Tivoli Storage Manager Backup-Archive client, Tivoli Storage Manager API Runtime files, and documentation. Complete does not include the Tivoli Storage Manager API Software Developer Kit nor the Tivoli Storage Manager Server
153
Administrative Client. If you select Custom, you can select only those elements you require. We needed the Tivoli Storage Manager API Run-time files, so we chose the Custom option.
We also selected the administrative client for troubleshooting purposes and the API SDK files which are required when using the DB2 user exit program (Figure 83).
Figure 83. Selecting the API SDK and administrative client files
154
After selecting a complete or custom installation you are presented with a window like Figure 84, where you can confirm your choice.
After the files have been installed you are presented with a window informing you of successful completion of the installation (Figure 85).
155
From the System Properties window, select the Advanced tab (Figure 87).
156
From the System Properties->Advanced tab, select Environment Variables (Figure 88).
Select New from the System variables window to enter the first environment variable (Figure 89). Do NOT enter these environment variables as User variables. DB2 UDB runs as a Windows service, so it reads environment variables from the system and not from a user. If you set the environment variables as User variables they will not have any effect on the DB2 runtime engine.
157
The order in which you define these variables is not important. We chose to define DSMI_CONFIG first (Figure 90). This variable points to the location of the api client options file. We gave it the default value of c:\program files\tivoli\tsm\api\dsm.opt. If you have installed into a different directory you will need to set the path accordingly.
158
The second system environment variable that we defined was DSMI_DIR (Figure 91). This value needs to be set to the installation directory of the Tivoli Storage Manager API. Based on our installation, we set this value to c:\program files\tivoli\tsm\api.
159
The third and last variable that needs to be set is DSMI_LOG (Figure 92). This value specifies the directory where the dsierror.log is to be located. As the name suggests this log will be the repository for any error messages generated by the API client. You cannot change the name of the log file that is created. If you do specify a logname at the end of the path, Tivoli Storage Manager will consider your logname as part of the directory path, and if the directory path does not exist, Tivoli Storage Manager will not generate the dsierror.log.
160
Once the environment variables have been set, we verified that they were set correctly by viewing them in the System variables window (Figure 93).
161
We then edited the dsm.opt client options file using Notepad (Figure 95). We specified values for COMMMETHOD, TCPSERVERADDRESS, TCPPORT, NODENAME, and PASSWORDACCESS. Our Tivoli Storage Manager server is on an RS/6000 AIX machine with a TCP/IP address of 193.1.1.11 and is listening for client connections on port 1500. Therefore, we chose TCPIP as our communication method, 193.1.1.11 as our tcp server address, and 1500 as our tcp port. We used the node that we registered at the beginning in 8.1, Registering a node on the TSM server for DB2 backups on page 149. For the nodename, we had a choice to set PASSWORDACCESS to prompt or to generate. For ease of management, we chose GENERATE as this allows Tivoli Storage Manager to generate a password automatically.
162
At this point we rebooted the system so that all the changes would take effect.
163
We confirmed that the environment variables were set by issuing the set command and then looking for the DSMI variables (Figure 97).
We then ran the dsmapipw.exe executable to generate the encrypted password (Figure 98). The password is encrypted in the Windows registry. Note: If PASSWORDACCESS is set to PROMPT and NOT generate, this command will succeed, but the password will NOT be generated. The dsmapipw.exe will ask for the current password, a new password, and then confirmation of the new password.
164
We can now run db2adutl.exe query to confirm that the configuration of system environment variables, client options file, and encrypted password is correct (Figure 99). The executable db2adutl.exe uses the DSMI_CONFIG to locate the correct options file to use to communicate with the Tivoli Storage Manager server. It uses the DSMI_DIR to locate the directory containing the API files. It uses the DSMI_LOG as the directory to write error messages in the dsierror.log. And it uses the encrypted registry password to authenticate with the Tivoli Storage Manager server. If successful, the db2adutl.exe command will output warning messages that there are no filespace and no DB2 backup images on the Tivoli Storage Manager server. This is accurate since we have not yet performed any backups.
If the setup is not correct, the db2adutl.exe will fail and provide an error message. It will also log information in the dsierror.log. Check Appendix B, Troubleshooting on page 277 for help in determining what is wrong.
165
8.7 Setting up the DB2 user exit for Tivoli Storage Manager
The user exit is an executable file that DB2 calls for archive and retrieval of log files. It enables DB2 to interact with storage devices that are not directly connected by the operating system. The user exit automates the removal of archive logs from local disk to remote storage (Tivoli Storage Manager, for example). Note: The implementation of the user exit requires a full offline database backup to become effective. Ensure that you allow enough time to do this backup. The user exit requires that the API SDK files is installed. This is required for both compiling the user exit and running it. To install the API SDK files, you must choose Custom installation when installing the client. See 8.3, Installation on page 151. To use the user exit, you must perform the following steps: Modify the DB2 provided user exit for your environment Compile the user exit c program Place the resulting executable file in the ...\SQLLIB\bin directory Change the database parameter to utilize the user exit
C:\Program Files\SQLLIB\samples\c>
166
Instructions for compiling the user exit are contained within the db2uext2.cadsm file. You can open this file with a text editor. To compile the user exit, the Tivoli Storage Manager API is required. You should use the same version of the Tivoli Storage Manager API for compiling the user exit that is used for running the user exit. In other words, since the 4.1.2.12 API is installed on the DB2 server, we installed the 4.1.2.12 API on the machine where the compiler is installed. We copied the user exit file into the directory C:\Program Files\Microsoft Visual Studio\VC98\Bin, and renamed it to db2uext2.c.
C:\Program Files\Microsoft Visual Studio\VC98\Bin>dir db2uext2.cadsm Volume in drive C is WinNT Volume Serial Number is E466-7802 Directory of C:\Program Files\Microsoft Visual Studio\VC98\Bin 05/11/00 12:35a 1 File(s) 94,955 db2uext2.cadsm 94,955 bytes 4,058,756,096 bytes free
C:\Program Files\Microsoft Visual Studio\VC98\Bin>rename db2uext2.cadsm db2uext.c C:\Program Files\Microsoft Visual Studio\VC98\Bin>
There are some user configurable variables that can be changed in the user exit using a text editor. Here is a sample extract of this:
/*== AUDIT_ERROR_PATH: Path where Audit and Error logs will reside ==*/ /*== Notes: 1. the path must exist ( the user exit will ==*/ /*== not create the path ) ==*/ /*== 2. the path must end with a back slash ==*/ /*== 3. the default is "c:\mylogs\" ==*/ /*== ==*/ /*== AUDIT_ERROR_ATTR: Standard C file open attributes for the Audit and ==*/ /*== Error logs ==*/ /*== Notes: 1. the default is "a" (text append) ==*/ /*== ==*/ #define BUFFER_SIZE #define #define #define #define 4096 /* /* /* /* /* /* transmit or receive the log file in 4k portions enable audit trail logging enable error trail logging path must end with a slash append to text file */ */ */ */ */ */
We changed the location of the audit and error logs to be the same directory that the dsierror.log is written to, for ease of problem determination. This was
167
done by changing the default value of the AUDIT_ERROR_PATH from c:\\mylogs\\ to c:\\progra~1\\tivoli\\tsm\\api\\. After this change the value looked like this:
#define AUDIT_ERROR_PATH "c:\\progra~1\\tivoli\\tsm\\api\\" /* path must end with a slash */
8.7.1.1 Compiling the DB2 user exit Because we were using Microsoft Visual C++, we set the environment variables needed to run the command line compiler by executing the VCVARS32.BAT batch program located in the ...\VC98\bin directory.
C:\Program Files\Microsoft Visual Studio\VC98\Bin>dir vc*.bat Volume in drive C is WinNT Volume Serial Number is E466-7802 Directory of C:\Program Files\Microsoft Visual Studio\VC98\Bin 03/22/01 11:48a 1 File(s) 989 VCVARS32.BAT 989 bytes 4,058,756,096 bytes free
C:\Program Files\Microsoft Visual Studio\VC98\Bin>vcvars32 Setting environment for using Microsoft Visual C++ tools. C:\Program Files\Microsoft Visual Studio\VC98\Bin>
Note: The instructions that come with the user exit are for the older V3.1 ADSM API. They show a different path and also say to use adsmv3.lib instead of tsmapi.lib. If you install the Tivoli Storage Manager API using the default path, the correct syntax to compile the user exit is as follows:
cl db2uext2.c -Ic:\progra~1\ti voli\tsm\api\include -linkc:\progra~1\tivoli\tsm\api\lib\tsmapi.lib
This was our output from the command prompt when we compiled and linked the user exit program:
168
C:\Program Files\Microsoft Visual Studio\VC98\Bin>cl db2uext2.c -Ic:\progra~1\ti voli\tsm\api\include -linkc:\progra~1\tivoli\tsm\api\lib\tsmapi.lib Microsoft (R) 32-bit C/C++ Optimizing Compiler Version 12.00.8168 for 80x86 Copyright (C) Microsoft Corp 1984-1998. All rights reserved. db2uext2.c Microsoft (R) Incremental Linker Version 6.00.8168 Copyright (C) Microsoft Corp 1992-1998. All rights reserved. /out:db2uext2.exe c:\progra~1\tivoli\tsm\api\lib\tsmapi.lib db2uext2.obj C:\Program Files\Microsoft Visual Studio\VC98\Bin>
Compiling and linking the user exit generated the db2uext2.exe executable. We copied it into the ...\sqllib\bin directory. If there are multiple databases under one DB2 instance only one user exit program can be used for all the databases. As a result, all the user exit logs of these databases are written to the same logfile. 8.7.1.2 Enable the database for rollforward recovery Finally, the DB2 environment must be customized to make use of the user exit program by setting the user exit parameter to ON in the database configuration. This will bring the database into rollforward mode so that full logfiles, which no longer contain active transactions, will automatically be moved off the system to Tivoli Storage Manager.
db2 update db cfg for sample using userexit on
db2 => update db cfg for sample 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.
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.
169
TSM_MGMTCLASS The TSM_MGMTCLASS parameter specifies to which management class database backups are bound. This value, if specified, takes precedence over both the default management class and an include statement. This parameter is different to the other three parameters in two important ways. This parameter only applies during backup operations (it is not used during restores) and it applies whether or not password access is set to prompt or generate. Note: This value has no affect on the user exit program. The other three values are only used when PASSWORDACCESS PROMPT is used. When PASSWORDACCESS is set to PROMPT, these values are required and override the values from the client options file. If these values are set when PASSWORDACCESS is set to GENERATE, the DB2 backup or restore will fail: TSM_NODENAME Specifies the nodename used to authenticate with the Tivoli Storage Manager server. See 4.2.1, Registering a node with the Tivoli Storage Manager server on page 34. TSM_PASSWORD Specifies the password used to authenticate with the Tivoli Storage Manager server. TSM_OWNER Specifies the owner of the backup object. This value is used to provide additional security for UNIX systems. This value does not apply to DB2 running on a Windows operating system. For most purposes you should use passwordaccess generate for ease of management. The only time passwordaccess prompt is required is when performing a redirected restore on a UNIX system. These values are set either from the DB2 command line processor using the command update db cfg for database using TSM_<parameter> <value> or from the Control Center. See 5.5, Optional DB2 configurations on page 69 for details and warnings regarding the use of these parameters.
170
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. Our instance is named DB2, so the corresponding Windows service is DB2 - DB2.
C:\PROGRA~1\SQLLIB\BIN>net start These Windows 2000 services are started: Alerter Application Management COM+ Event System Computer Browser DB2 - DB2 DB2 - DB2CTLSV DB2 - DB2DAS00 DB2 JDBC Applet Server
The Tivoli Storage Manager server must be running, and the Tivoli Storage Manager API installed and configured. 8.9.1.2 Offline backup using the command line This example shows an offline backup using the DB2 command line interface.
171
Log in to Windows with a user that has rights to run the DB2 Command Line Processor and make sure that all applications are logged off from the database you want to backup. Use the following DB2 command to verify that all applications are logged off:
db2 list applications for database sample
In our example, a user is connected to our SAMPLE database. Use the following DB2 force command to force the user off:
db2 force application ( 61 )
If there are too many connections to the database, use the following command to force all applications off the instance. Warning: if you have multiple databases, this command will force off all applications from all databases within the same instance:
db2 force application all
The use tsm option tells DB2 to use the Tivoli Storage Manager API to write the output backup file instead of using common devices. Wait until a message like the following appears.
$ db2 backup db sample use tsm Backup successful. The timestamp for this backup image is : 20010307102944 $
The backup operation has created an image file of your database, SAMPLE, and put it in Tivoli Storage Manager server storage.
172
8.9.1.3 Offline backup using the DB2 Control Center This example shows an offline backup using the DB2 Control Center: 1. Start the DB2 Control Center. On a Windows system, you will find the Control Center under Start->Programs->IBM DB2. 2. Click down the tree until you reach the database folder. 3. Select the database you want to back up and right-click on the database name and select Backup->Database as shown in Figure 100.
The Backup Database window appears (Figure 101). Select Media Type: Tivoli Storage Manager. Dont worry about the sessions and the options menu now. It will be described when you are doing online backups; see 8.9.2.3, Online backup using the DB2 Control Center on page 176.
173
Figure 101. Select Tivoli Storage Manager option in Control Center GUI
Now 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.
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 103).
174
Figure 103. End of DB2 offline backup message using the DB2 GUI
The DB2 Journal will provide additional information about the success of the backup. The DB2 Journal is in the Tools menu of the DB2 Control Center. For more detailed information about the DB2 Journal, see 7.5.2, Automate DB2 backup using DB2 on page 135.
The use tsm option tells the DBMS to use the Tivoli Storage Manager API to write the output backup file to Tivoli Storage Manager instead of to local storage (disk or tape). Wait until a message like the following appears:
db2 => backup db sample online use tsm Backup successful. The timestamp for this backup image is : 20010328075649 db2 =>
175
The backup operation created an image file of your database, SAMPLE, and put it in Tivoli Storage Manager server storage. 8.9.2.3 Online backup using the DB2 Control Center This example shows an online backup using the DB2 Control Center; Start the backup operation from the GUI: 1. Start the DB2 Control Center. On a Windows system, you will find the Control Center under Start->Programs->IBM DB2. For UNIX systems, type db2cc. 2. Click down the tree until you reach the database folder. 3. Select the database you want to back up and right-click on the database name and select Backup->Database as shown in Figure 103.
The Backup Database window appears (Figure 105). Select Media Type: Tivoli Storage Manager.
176
Click the Options tab and select Online as shown in Figure 106.
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.
177
The Close button must be pressed to actually start the backup. If the window stays open the backup will not start. After the backup is finished another window appears (Figure 108).
Figure 108. End of DB2 online backup message using the DB2 GUI
The DB2 Journal will provide additional information about the success of the backup. The DB2 Journal is in the Tools menu of the DB2 Control Center. The DB2 Journal is discussed in more detail in 7.5.2, Automate DB2 backup using DB2 on page 135.
178
8.9.3.1 Tablespace backup using the command line Start the backup operation from the DB2 command line:
backup db sample tablespace ( userspace1 ) online use tsm
The use tsm option tells DB2 to use the Tivoli Storage Manager API to write the output backup file instead of using common devices. Wait until a message like the following appears:
db2 => backup db sample tablespace ( userspace1 ) online use tsm Backup successful. The timestamp for this backup image is : 20010328084316 db2 =>
The backup operation created an image file of your tablespace and put it in Tivoli Storage Manager server storage. 8.9.3.2 Tablespace backup using the DB2 Control Center This example shows an online backup using the DB2 Control Center: 1. Start the DB2 Control Center. On a Windows system, you will find the Control Center under Start->Programs->IBM DB2. For UNIX systems, type db2cc. 2. Click down the tree until you reach the database folder. 3. Select the folder of your database you want to back up and right-click on the tablespace in the left frame as shown in Figure 109.
179
The Backup Database window appears (Figure 110). Select Media Type: Tivoli Storage Manager.
180
Click the Options tab and select the Online radio button as shown in Figure 111.
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.
You need to press 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 113).
181
Figure 113. End of tablespace backup message using the DB2 GUI
The DB2 Journal will provide additional information about the success of the backup. The DB2 Journal is in the Tools menu of the DB2 Control Center. We discuss the DB2 Journal in more detail in 7.5.2, Automate DB2 backup using DB2 on page 135.
182
183
Usage: db2adutl.exe { QUERY [ [ [ TABLESPACE | FULL | LOADCOPY ] [ SHOW INACTIVE ] ] | [ LOGS [ BETWEEN <Sn1> AND <Sn2> ] ] ] |
EXTRACT [ [ [ TABLESPACE | FULL | LOADCOPY ] [ SHOW INACTIVE ] [ TAKEN AT <timestamp> ] ] | [ LOGS [ BETWEEN <Sn1> AND <Sn2> ] ] ] | DELETE [ [ [ TABLESPACE | FULL | LOADCOPY [ KEEP <n> | OLDER [THAN] [ <timestamp> <n> DAYS TAKEN AT <timestamp> ] ] | [ LOGS [ BETWEEN <Sn1> AND <Sn2> VERIFY [ [ TABLESPACE | FULL ] [ SHOW INACTIVE ] [ TAKEN AT <timestamp> ] ] | [ {DATABASE | DB} <database name> ] [ NODE <n> ] [ PASSWORD <password> ] [ NODENAME <nodename> ] [ OWNER <owner> ] [ WITHOUT PROMPTING ] Figure 114. Syntax of db2adutl ] | ] | ]]] }
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.
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.
Note: The Tivoli Storage Manager server can be configured to retain deleted backup versions. In this case, backup objects remain on the server even if you delete them by using db2adutl.exe. If you do not want to keep these inactive objects, you have to configure your Tivoli Storage Manager server to either of the following:
184
Set the number of backup versions, if client data is deleted (VERDELETED), to 0. Or Set the length of time to retain the last remaining copy of a deleted file (RETONLY) to 0. For further Tivoli Storage Manager server considerations, see 4.5.2.1, Backup copy group considerations on page 48. 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 THAN 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. If you automated the deletion of backups using this qualifier be aware that 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 also shows 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 reduces the search to a particular database. The WITHOUT PROMPTING qualifier disables the prompt. Be very careful when using this option, because if you issue the wrong commands it may delete more than you expected to delete.
185
Storage Manager information in a more readable view, but for problem determination it can be useful to view the data directly. We will only give a few examples of what can be done using the SQL queries. These queries can become as complex as needed. To login to the server open an administrative client session. From a machine with the administrative client installed enter the following command:
dsmadmc
You will be prompted for the node name and the password. Any administrator node has privileges to issue the SELECT command.
C:\Program Files\Tivoli\TSM\baclient>dsmadmc Tivoli Storage Manager Command Line Administrative Interface - Version 4, Release 1, Level 2.12 (C) Copyright IBM Corporation, 1990, 1999, All Rights Reserved. Enter your user id: jamaica_db2 Enter your password: *********** Session established with server BRAZIL: AIX-RS/6000 Server Version 4, Release 1, Level 2.0 Server date/time: 03/28/2001 11:09:58 Last access: 03/28/2001 11:09:24 tsm: BRAZIL>
Type help to get a first help on what possible commands you can use. Every backup or logfile is indexed in the Tivoli Storage Manager server database. To get a list of the backups which already exist for the API client, enter the following command:
select * from backups where node_name=<client API node name>
Note: The <client API node name> must be in uppercase. See Figure 115 for the results of the command.
186
tsm: BRAZIL>select * from backups where node_name='JAMAICA_DB2' ANR2963W This SQL query may produce a very large result table, or may require a significant amount of time to compute. Do you wish to proceed? (Yes (Y)/No (N)) y NODE_NAME: FILESPACE_NAME: STATE: TYPE: HL_NAME: LL_NAME: OBJECT_ID: BACKUP_DATE: DEACTIVATE_DATE: OWNER: CLASS_NAME: JAMAICA_DB2 /SAMPLE ACTIVE_VERSION FILE \NODE0000\ FULL_BACKUP.20010322170159.1 47185 2001-03-22 17:03:41.000000 DEFAULT
To get more detailed output the query can be extended by combining more search queries together as in the next example:
tsm: BRAZIL>select * from backups where node_name='JAMAICA_DB2' and filespace_name='/SAMPLE'
There is also a command line interface to the Tivoli Storage Manager server combining the logon process and the Tivoli Storage Manager command in a single step. This can be useful if you are creating shell scripts that need information from the Tivoli Storage Manager server directly:
dsmadmc -id=jamaica_db2 -password=jamaica_db2 select * from backups
When using the DB2 user exit, the logfiles will be backed up into the archive copy group (see 8.7, Setting up the DB2 user exit for Tivoli Storage Manager on page 166). To get information about the archived items, the query must be changed to select items from the archives table. See the following example.
187
tsm: BRAZIL>select * from archives where node_name='BRAZIL_DB2' ANR2963W This SQL query may produce a very large result table, or may require a significant amount of time to compute. Do you wish to proceed? (Yes/No) y NODE_NAME: FILESPACE_NAME: TYPE: HL_NAME: LL_NAME: OBJECT_ID: ARCHIVE_DATE: OWNER: DESCRIPTION: CLASS_NAME: NODE_NAME: FILESPACE_NAME: TYPE: HL_NAME: LL_NAME: BRAZIL_DB2 /SAMPLE FILE /NODE0000/ S0000000.LOG 19487 2001-03-01 19:52:47.000000 db2inst1 Log file for DB2 database SAMPLE DEFAULT BRAZIL_DB2 /SAMPLE FILE /NODE0000/ S0000000.LOG
188
Retrieving full database backup information. Please wait. full database backup image: .\SAMPLE.0\DB2\NODE0000\CATN0000\20010328\113323.001 , Node: 0 .\SAMPLE.0\DB2\NODE0000\CATN0000\20010328\113323.002, Node: 0 Do you wish to extract ALL of these images (Y/N)? y Writing to file: .\SAMPLE.0\DB2\NODE0000\CATN0000\20010328\113323.001 Writing to file: .\SAMPLE.0\DB2\NODE0000\CATN0000\20010328\113323.002
In Figure 116, we ran the db2ckbkp.exe against the two backup images that were part of the backup set. The reason there are two images is because this particular backup was taken using two sessions.
C:\Program Files\SQLLIB\bin>db2ckbkp .\SAMPLE.0\DB2\NODE0000\CATN0000\20010328\1 13323.001 .\SAMPLE.0\DB2\NODE0000\CATN0000\20010328\113323.002 [1] Buffers processed: ############################################ [2] Buffers processed: ############################################ Image Verification Complete - successful. C:\Program Files\SQLLIB\bin> Figure 116. Example db2ckbkp with two backup images in the set
189
db2 => list history backup all for sample List History File for sample Number of matching file entries = 1 Op Obj Timestamp+Sequence Type Dev Earliest Log Current Log Backup ID -- --- ------------------ ---- --- ------------ ------------ -------------B D 20010328113323002 F A S0000000.LOG S0000000.LOG ----------------------------------------------------------------------------------------------------------------------------------------------------Comment: DB2 BACKUP SAMPLE OFFLINE Start Time: 20010328113323 End Time: 20010328113913 --------------------------------------------------------------------------00001 Location: bin\db2adsm.dll db2 => Figure 117. DB2 list history
The interesting information is contained within the first line of each stanza. These lines show the Operation (Op:B=backup); the Object (Obj:D=Database); the Type (Type:F=Offline,N=Online); and the Device (Dev:A=TSM). For an in-depth description of the list history command, see the DB2 UDB Command Reference V7, SC09-2951.
190
C:\Program Files\SQLLIB\bin>db2adutl query Query for database SAMPLE Retrieving full database backup information. full database backup image: 1, Time: 20010328113323 Oldest log: S0000000.LOG, Node: 0, Sessions used: 2 Retrieving tablespace backup information. No tablespace backup images found for SAMPLE Retrieving load copy information. No load copy images found for SAMPLE Retrieving log archive information. Log file: S0000000.LOG, Node: 0, Taken at: 2001-03-28-13.29.31 Figure 118. Example db2adutl query
A possible test would be to download a backup from the Tivoli Storage Manager server and see if the whole file is readable, for which the db2adutl extract option must be used. However, this is not a practical method for most databases!
C:\Program Files\SQLLIB\bin>db2adutl extract Query for database SAMPLE Retrieving full database backup information. Please wait. full database backup image: .\SAMPLE.0\DB2\NODE0000\CATN0000\20010328\113323.001 , Node: 0 .\SAMPLE.0\DB2\NODE0000\CATN0000\20010328\113323.002, Node: 0 Do you wish to extract ALL of these images (Y/N)? y Writing to file: .\SAMPLE.0\DB2\NODE0000\CATN0000\20010328\113323.001 Writing to file: .\SAMPLE.0\DB2\NODE0000\CATN0000\20010328\113323.002 Figure 119. Example db2adutl extract
The best way to verify the backup is 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 going to be restorable. The whole image will be read from the Tivoli Storage Manager server into local memory buffer (not the whole image at once, but piece by piece). There
191
is nothing written to local disk, but the implications of the data transfer over the LAN should be calculated. 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. The tool performs numerous checks, but it will not and cannot actually check the integrity of the userdata that exists in the backup image.
C:\Program Files\SQLLIB\bin>db2adutl verify full taken at 20010328113323 db sample Query for database SAMPLE Retrieving full database backup information. Please wait. full database backup image: .\SAMPLE.0\DB2\NODE0000\CATN0000\20010328\113323.001 , Node: 0 .\SAMPLE.0\DB2\NODE0000\CATN0000\20010328\113323.002, Node: 0 Do you wish to verify this image (Y/N)? y Verifying file: .\SAMPLE.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. .\SAMPLE.0\DB2\NODE0000\CATN0000\20010328\113323.002 ================== BUFFER 0 ================== ***BUFFERS 1-42 deleted to save space in this redbook.*** ================== 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. Figure 120. Example db2adutl verify
The warning message shown in Figure 120 is misleading and can be ignored. The last line is the important one and it indicates that the verification was successful.
192
193
The only logfiles that should be deleted are those that will not be needed by any of the existing database backups for rollforward. To delete old backed up logfiles the delete qualifier of the db2adutl utility must be used. The deletion of logfiles is, itself, a little bit complicated, because there is no timestamp associated with backed up logfiles. The range of the logfiles must be specified (Figure 121).
C:\Program Files\SQLLIB\bin>db2adutl query Query for database SAMPLE Retrieving full database backup information. full database backup image: 1, Time: 20010328143808 Oldest log: S0000012.LOG, Node: 0, Sessions used: 2 Retrieving tablespace backup information. No tablespace backup images found for SAMPLE Retrieving load copy information. No load copy images found for SAMPLE Retrieving log archive information. Log file: S0000010.LOG, Node: 0, Taken at: 2001-03-28-14.37.18 Log file: S0000011.LOG, Node: 0, Taken at: 2001-03-28-14.37.19 Log file: S0000011.LOG, Node: 0, Taken at: 2001-03-28-14.39.23 Log file: S0000012.LOG, Node: 0, Taken at: 2001-03-28-14.39.39 Log file: S0000013.LOG, Node: 0, Taken at: 2001-03-28-14.39.48 Log file: S0000014.LOG, Node: 0, Taken at: 2001-03-28-14.40.43 C:\Program Files\SQLLIB\bin>db2adutl delete logs between S0000010.LOG and S0000011.LOG without prompting Query for database SAMPLE Retrieving log archive information. Log file: S0000010.LOG, Node: 0, Taken at: 2001-03-28-14.37.18 Log file: S0000011.LOG, Node: 0, Taken at: 2001-03-28-14.37.19 Log file: S0000011.LOG, Node: 0, Taken at: 2001-03-28-14.39.23 C:\Program Files\SQLLIB\bin> Figure 121. Example db2adutl delete logfiles
You may see duplication of log names, this is normal behavior and can happen when database backups are taken.
194
We wanted to schedule this command to run every morning at 8:00am. To do this, we specified the following AT command.
C:\scripts>at 08:00 /every:M,T,W,Th,F,S,Su c:\scripts\db2online.cmd Added a new job with job ID = 1
If you type AT without specifying any parameters, you see the current scheduled jobs.
195
C:\scripts>at Status ID Day Time Command Line ------------------------------------------------------------------------------1 Each M T W Th F S Su 8:00 AM c:\scripts\db2online.cmd C:\scripts>
2. DEFINE ASSOCIATION Now we associate this schedule with the node that will execute the command. Our Windows DB2 backups use JAMAICA_DB2 as the nodename, so that is what we used for this command.
196
tsm: BRAZIL>define association api_domain db2_online_backup jamaica_db2 ANR2510I Node JAMAICA_DB2 associated with schedule DB2_ONLINE_BACKUP in policy domain API_DOMAIN.
9.5.3.2 Tivoli Storage Manager client steps for scheduling Once the schedule has been defined on the Tivoli Storage Manager server, and the schedule has been associated with the nodename, the only thing left to do is setup a scheduler service. We want to use a different scheduler service for the DB2 backups to make it easier to check whether the DB2 commands have been executed. In our Windows environment we chose scheduling mode client polling rather than server prompted, because if you have more than one scheduler service on a machine and you are using prompted scheduling mode, you must specify the TCPCLIENTPORT option in one of the scheduler services to be different from the default. Otherwise, both services will try to listen on the same port. See Tivoli Storage Manager for Windows Administrators Guide, GC35-0410. The Tivoli Storage Manager Backup-Archive client provides a wizard to assist with installing a scheduler service. We chose to use the command line utility dsmcutil.exe located in the ...\baclient directory. To keep this service separate from the backup client scheduler service, you must specify options for NAME, NODE, PASSWORD, OPTFILE, SCHEDLOG, and ERROR.LOG. If you do not use different values for SCHEDLOG and ERROR.LOG, both scheduler services will write to the same log files.
C:\Program Files\Tivoli\TSM\baclient>dsmcutil install /name:"TSM Scheduler DB2" /node:"jamaica_db2" /password:"jamaica_db2" /optfile:"c:\progra~1\tivoli\tsm\api\dsm.opt" /schedlog:"c:\progra~1\tivoli\tsm\api\dsmsched.log" /errorlog:"c:\progra~1\tivoli\tsm\api\dsmerror.log"
After running that command a number of messages are sent to the console. This will let you know if there are any errors. The most important ones to see are the following:
The service was successfully installed. Starting the 'TSM Scheduler DB2' service ..... The service was successfully started.
If you have problems you can easily remove the scheduler service by specifying:
197
To check which scheduler services are installed, use the dsmcutil list command.
C:\Program Files\Tivoli\TSM\baclient>dsmcutil list Installed TSM Client Services: 1. TSM BAClient Scheduler 2. TSM Scheduler DB2
To verify the settings and configuration of our scheduler we used the dsmcutil
query /name:Name of Scheduler Service command.
C:\Program Files\Tivoli\TSM\baclient>dsmcutil query /name:"TSM Scheduler DB2" Service Name : TSM Scheduler DB2 Logon Account : LocalSystem Start Type : Demand Current Status : Started TSM Client Service Registry Settings: Client Service Type Client Directory Options file Event Logging TSM Client Node Comm Protocol Server Server Port Schedule Log Error Log MSCS Enabled Node Cluster name = = = = = = = = = = = = Client Scheduler Service "C:\Program Files\Tivoli\TSM\baclient\dsmcsvc.exe" c:\progra~1\tivoli\tsm\api\dsm.opt YES JAMAICA_DB2 (value not currently set) (value not currently set) (value not currently set) c:\progra~1\tivoli\tsm\api\dsmsched.log c:\progra~1\tivoli\tsm\api\dsmerror.log (value not currently set) (value not currently set)
Upon successful installation of the scheduler service, the scheduler service will automatically start and connect to the Tivoli Storage Manager server to retrieve any associated schedules. The dsmsched.log for the scheduler service will show whether a schedule was retrieved from the Tivoli Storage Manager server. Our dsmsched.log shows that the c:\scripts\db2online.cmd will be executed in seven minutes.
198
C:\Program Files\Tivoli\TSM\api>type dsmsched.log 03/30/2001 11:33:28 Querying server for next scheduled event. 03/30/2001 11:33:28 Node Name: JAMAICA_DB2 03/30/2001 11:33:28 Session established with server BRAZIL: AIX-RS/6000 03/30/2001 11:33:28 Server Version 4, Release 1, Level 2.0 03/30/2001 11:33:28 Server date/time: 03/30/2001 11:35:02 Last access: 03/30/ 2001 11:00:04 03/30/2001 03/30/2001 03/30/2001 03/30/2001 03/30/2001 03/30/2001 03/30/2001 03/30/2001 03/30/2001 03/30/2001 11:33:28 11:33:28 11:33:28 11:33:28 11:33:28 11:33:28 11:33:28 11:33:28 11:33:28 11:33:28 --- SCHEDULEREC QUERY BEGIN --- SCHEDULEREC QUERY END Next operation scheduled: -----------------------------------------------------------Schedule Name: DB2ONLINE Action: Command Objects: c:\scripts\db2online.cmd Options: Server Window Start: 11:39:19 on 03/30/2001 ------------------------------------------------------------
Seven minutes later we checked the dsmsched.log again and saw that it had executed the command.
03/30/2001 11:40:28 Executing scheduled command now. 03/30/2001 11:40:28 Node Name: JAMAICA_DB2 03/30/2001 11:40:28 Session established with server BRAZIL: AIX-RS/6000 03/30/2001 11:40:28 Server Version 4, Release 1, Level 2.0 03/30/2001 11:40:28 Server date/time: 03/30/2001 11:42:02 Last access: 03/30/ 2001 11:35:02 03/30/2001 11:40:28 Executing Operating System command or script: c:\scripts\db2online.cmd 03/30/2001 11:40:28 Finished command. Return code is: 0 03/30/2001 11:40:28 Scheduled event 'DB2ONLINE' completed successfully. 03/30/2001 11:40:28 Sending results for scheduled event 'DB2ONLINE'. 03/30/2001 11:40:28 Results sent to server for scheduled event 'DB2ONLINE'.
199
1. Create a script that the Tivoli Storage Manager server will start through the Tivoli Storage Manager Scheduler. 2. Configure the Tivoli Storage Manager Scheduler. 3. Create a backup script. 4. Install a service that will start the backup script with a defined user. 5. Test the configuration. 9.5.4.1 Creating a script to be started through the Tivoli Storage Manager Scheduler Inform the Tivoli Storage Manager server administrators that you will be using a script for starting the backup. Create a script as shown called db2_backup.cmd and store it in the following directory C:\Program Files\Tivoli\TSM\baclient\DB2\. This script simply stops and starts the DB2_Backup Service. See 9.5.4.4, Installing a service to start the backup script with a defined user on page 201.
net stop "DB2_Backup" net start "DB2_Backup" sleep 60
9.5.4.2 Configuring the Tivoli Storage Manager Backup-Archive Scheduler We will use the Tivoli Storage Manager client service configuration utility, dsmcutil. To install the Tivoli Storage Manager Scheduler, issue the following command:
dsmcutil install scheduler /name:"TSM Scheduler Service SERVERNAME_DB2" /clientdir:"C:\Program Files\Tivoli\TSM\baclient" /optfile:"C:\Program Files\Tivoli\TSM\baclient\DB2\dsm.opt" /node:SERVERNAME_DB2 /password:xxxxxx /validate:yes /autostart:yes /startnow:no
This installs the service on the client SERVERNAME. If the client is connected to the Tivoli Storage Manager server, you will see the entry in the scheduler log, dsmsched.log as follows, indicating it is ready to start the script. You will also see that the Tivoli Storage Manager server is configured to start the script.
200
Next operation scheduled: -----------------------------------------------------------Schedule Name: CS_CM_DAS_0200_DA Action: Command Objects: "C:\Program Files\Tivoli\TSM\baclient\DB2\db2 Options: Server Window Start: 02:00:00 on 03/24/2006 -----------------------------------------------------------Command will be executed in 11 hours and 57 minutes.
9.5.4.3 Creating the backup script We created a simple backup script called db2_backup_script.cmd. Modify this script to specify the database you want to backup.
set DB2INSTANCE=DB2 C: cd \Program Files\IBM\SQLLIB\bin\ db2cmd.exe /c DB2.EXE -v -zC:\DB2_backup_log\dsmdb2dts.log backup db entw_dts online use tsm db2cmd.exe /c DB2.EXE -v -zC:\DB2_backup_log\dsmdb2sfc.log backup db entw_sfc online use tsm
Specify the -c option when using this script. Otherwise, the db2cmd.exe never closes, and you will have processes running in the background that you cannot stop. The -v option means "Echo current command" so that you can see in the output which command was started. The -z option saves all output to an output file. If the DB2 installation is located on another drive, then modify the script. 9.5.4.4 Installing a service to start the backup script with a defined user For security reasons we recommend that you do not include user IDs and passwords in scripts. However, you have to specify the authentication to start the backup or use DB2 commands. To get around this, install a service called DB2_Backup, using the Windows resource kit tools instsrv.exe and srvany.exe, as follows: 1. Install the service using the Windows resource kit tools as follows.
instsrv DB2_Backup "C:\Program Files\Windows Resource Kits\Tools\srvany.exe"
201
2. To add the parameters, edit the registry using regedit. In the entry HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Services\ DB2_Backup\, create a new key called Parameters and in this key, create a new string value called Application. The value you should add is C:\Program Files\Tivoli\TSM\baclient\DB2\db2_backup_script.cmd. This is shown in Figure 122.
202
3. Modify the service itself in the Windows services applet. Right-click the newly installed service, DB2_Backup, and select Properties. Set the Startup type to Manual as Figure 123 shows.
203
4. Set the Log On properties. This is shown in Figure 124 where we specified the user name DASSCO with a password.
204
9.5.4.5 Testing the configuration Next, perform a test backup to check if everything worked. Start the service DB2_Backup, and check if the Tivoli Storage Manager backup was successful. Use the db2 list history backup or db2adutl query command. For example, using the command db2 list history backup all for entw_sfc should display output similar to the following:
Op Obj Timestamp+Sequence Type Dev Earliest Log Current Log Backup ID -- --- ------------------ ---- --- ------------ ------------ -------------B D 20060317021830001 N A S0038481.LOG S0038481.LOG ---------------------------------------------------------------------------Contains 4 tablespace(s): 00001 SYSCATSPACE 00002 USERSPACE1 00003 SYSTOOLSPACE 00004 TSASNQC ---------------------------------------------------------------------------Comment: DB2 BACKUP ENTW_SFC ONLINE Start Time: 20060317021830 End Time: 20060317030947 Status: E ---------------------------------------------------------------------------EID: 19097 Location: bin\db2tsm.dll.
The interesting information is contained within the first line of each stanza. These lines show the following: Operation (Op:B=backup), the Object (Obj:D=Database), the Type (Type:F=Offline,N=Online), and the Device (Dev:A=TSM). For more details about the list history command, see DB2 UDB Command Reference V7, SC09-2951. Using the db2adutl query shows output similar to the following:
Query for database ENTW_SFC Retrieving FULL DATABASE BACKUP information. 1 Time: 20060324020547 Oldest log: S0038492.LOG 2 Time: 20060323020745 Oldest log: S0038490.LOG 3 Time: 20060322020043 Oldest log: S0038489.LOG 4 Time: 20060321020841 Oldest log: S0038487.LOG 5 Time: 20060320020238 Oldest log: S0038485.LOG 6 Time: 20060319020336 Oldest log: S0038483.LOG 7 Time: 20060318020634 Oldest log: S0038482.LOG 8 Time: 20060317021830 Oldest log: S0038481.LOG 9 Time: 20060316164250 Oldest log: S0038475.LOG 10 Time: 20060316020830 Oldest log: S0038474.LOG
DB Partition Number: 0 DB Partition Number: 0 DB Partition Number: 0 DB Partition Number: 0 DB Partition Number: 0 DB Partition Number: 0 DB Partition Number: 0 DB Partition Number: 0 DB Partition Number: 0 DB Partition Number:0
Sessions: Sessions: Sessions: Sessions: Sessions: Sessions: Sessions: Sessions: Sessions: Sessions:
1 1 1 1 1 1 1 1 1 1
205
The query option of the db2adutl utility can be used to show general information about which database backups, log files, and load copies reside on the Tivoli Storage Manager server. It also shows which log file was used for the backup. This is very important for a restore. 9.5.4.6 How does it work? The Tivoli Storage Manager server can communicate with the started Tivoli Storage Manager Scheduler on the server you want to backup. Following is the process that occurs. When the Tivoli Storage Manager server initiates a backup, it starts the db2_backup.cmd that is located in the following directory: C:\Program Files\Tivoli\TSM\baclient\DB2 on every server where we configured the Tivoli Storage Manager DB2 backup. The db2_backup.cmd stops and starts the DB2_Backup Service. The DB2_Backup Service starts the db2_backup_script.cmd, which itself runs the DB2 backup command. The DB2 backup creates logs in C:\DB2_backup_log\ called dsmdb2<database>.log. This process is shown in Figure 125.
206
207
208
Note that you can specify the initial prefix for the timestamp. The minimum specification is yyyy where yyyy is the year.
209
210
211
212
213
214
An excerpt from the results of the command is shown in Figure 127. 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.
2. Use the restore command, specifying the timestamp of the image you want to restore, and then reply y to continue:
$ db2 restore db bart use tsm taken at 20010316165106 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.
215
1. Right-click the database, and then from the drop down menu select Restore->Database as shown in Figure 128.
2. When the database image selection page appears as shown in Figure 129, select the database image you want to use for the restore, then select OK.
216
3. A dialog box will appear as shown in Figure 130, to confirm if the restore is successful. Select Close.
217
Dynamic SQL Query management Directory object name Discovery support for this database Default query optimization class Degree of parallelism Continue upon arithmetic exceptions Default refresh age Number of frequent values retained Number of quantiles retained Backup pending Database is consistent Rollforward pending Restore pending
(DYN_QUERY_MGMT) = DISABLE (DIR_OBJ_NAME) = (DISCOVER_DB) = ENABLE (DFT_QUERYOPT) (DFT_DEGREE) (DFT_SQLMATHWARN) (DFT_REFRESH_AGE) (NUM_FREQVALUES) (NUM_QUANTILES) = = = = = = 5 1 NO 0 10 20
= NO = NO = TABLESPACE = NO
218
An excerpt from the results of the command is shown in Figure 131. 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 in the Start Time field.
2. Use the restore command, specifying the timestamp of the image you want to restore, then reply y to continue:
$ db2 restore db bart use tsm taken at 20010316165106 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.
219
220
2. When the backup image selection page appears as shown in Figure 133, select the database image you want to use for the restore.
221
3. Click the Roll-forward tab as shown in Figure 134, check the Roll-forward (re-apply logs) option, uncheck the Leave in roll-forward pending state option, then select OK.
222
4. A dialog box appears as shown in Figure 135 to confirm if the roll-forward is successful. Select Close.
223
224
An excerpt from the results of the command is shown in Figure 137. 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 in the Start Time field.
225
2. Use the restore command, specifying the timestamp of the image you want to restore, and then reply y to continue:
$ db2 "restore db bart tablespace (DATA01) online use tsm taken at 20010316165106 DB20000I The RESTORE DATABASE command completed successfully. $
226
db2 "rollforward db bart to end of logs and stop tablespace (data01) 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 = bart = 1 = = = = = 0 not pending S0000004.LOG 2001-03-14-22.09.08.000000
227
However, if you have not taken a previous tablespace backup, a warning dialog box appears informing you that there is no backup image for the database as shown in Figure 139. You can ignore the message, and continue.
228
You will be presented with the next dialog as shown in Figure 140. The difficulty here is that you must manually specify the backup image timestamp.
229
Using the database drop down menu is easier, and it presents you with options to use either a database backup image or a tablespace image. It also lets you restore more than one tablespace at a time. For this example, we will be using the database drop down menu, as discussed in the following steps: 1. Right-click the database, and then from the drop down menu select Restore->Database as shown in Figure 141.
2. When the backup image selection page appears as shown in Figure 142, select a backup image in the list. This can be a backup image or a tablespace image.
230
3. If you select a database backup image, on the Table Spaces tab, you can select which tablespaces you can restore. For this example, we use a backup image, and select tablespace DATA01, as shown in Figure 143.
231
4. On the Roll-forward tab as shown in Figure 144, check the Roll-forward (re-apply logs) option, and uncheck the Leave in roll-forward pending state option.
232
5. Go to the Options tab as shown in Figure 145, and select Online for an online restore. Select OK.
233
6. A dialog box appears as shown in Figure 146 to confirm if the roll-forward is successful. Select Close.
234
Backup 1
SLOG0000011
Backup 2
SLOG0000012
SLOG0000013
SLOG0000014
SLOG0000015
After the point in time recovery, new transactions will reuse the logs that were not applied as shown in Figure 148.
235
Backup 1
SLOG0000011
Backup 2
SLOG0000012
SLOG0000013
SLOG0000014
SLOG0000015
SLOG0000014
SLOG0000015
Figure 148. Log files being reused after a point in time recovery
When Tivoli Storage Manager archive the reused logs, there will be at least two versions of the same log file. During roll-forward, Tivoli Storage Manager will always retrieve the latest version of the archive logs. From our experience in the lab, when we try to recover BACKUP 1 or BACKUP 2 again and rollforward to end of logs, the roll-forward produces an error somewhere between SLOG0000013 and the reused SLOG0000014. So we have to roll-forward to the same or prior point in time as we have specified in the previous point in time recovery. We then took an online backup after each point in time recovery. However, when performing recovery using the new backups taken after the roll-forward, there was one occasion where the roll-forward failed. We therefore recommend a full offline backup after each database point in time recovery.
As pointed out in our experience in 10.4.1, Point in time recovery concepts and lab experience on page 235, we recommend that you do a full offline backup after a database point in time recovery.
236
10.4.2.2 Tablespace point in time recovery considerations For tablespace point in time recovery, here are some considerations: You cannot do point in time recovery on the tablespace containing the system catalogs. If a table spans more than one tablespace, for example, data and indexes are in separate tablespaces, you must roll-forward those tablespaces to the same point in time. If tables in a tablespace being rolled forward to a point in time have referential integrity constraints in tables in other tablespaces. The tables having relationships will be in check-pending state. You must resolve the inconsistencies caused by the point in time recovery by using the SET CONSTRAINTS command. If tables in tablespaces being rolled forward to a point in time execute triggers that insert, update, or delete rows from tables in other tablespaces, rows from tables from tablespaces not being rolled forward may become inconsistent with the tables in tablespaces being rolled forward. You must correct the inconsistencies after the point in time recovery, or you can include the related tablespaces in the point in time recovery. Because all data must correlate with data in the system catalogs, there may be a minimum point in time to recover for a tablespace. For example, when a table is created, the system catalogs are updated to reflect this. You cannot do point in time recovery prior to the table creation, because the system catalogs have information for this table and is not removed by the tablespace point in time recovery process. This also applies to dropping tables. You cannot recover a dropped table unless you specify the DROP TABLE RECOVERY option turned on for the tablespace where the table resides. To determine the minimum point in time for a tablespace to be recovered, use the LIST TABLESPACES SHOW DETAIL command. After the tablespace is rolled-forward to a point in time, it will be in backup-pending state. You must backup the tablespace.
237
Figure 149 shows an excerpt of the results. Note that the timestamp is in Coordinated Universal Time (CUT) format. In this example, CUT is six hours ahead of the local time.
2. Use the list history command to select a backup image that you want to use for the restore. For database BART, our command will be:
$ db2 list history backup all for bart
An excerpt from the results of the command is shown in Figure 150. 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 in the Start Time field.
238
3. Use the restore command, specifying the timestamp of the image you want to restore:
$ db2 "restore db bart tablespace (data01, index01, long01) online use tsm \ > taken at 20010323084231" DB20000I The RESTORE DATABASE command completed successfully.
4. Use the rollforward command to apply the logs. Specify the point in time in CUT format, and it must be past the minimum recovery time as shown in Figure 149 on page 238.
$ db2 "rollforward db bart to 2001-03-23-15.00.00.000000 \ > tablespace (data01, index01, long01) 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 = bart = 1 = = = = = 0 TBS working S0000029.LOG 2001-03-23-15.11.15.000000
5. Notice we did not do a rollforward stop on the previous command. We can do them separately as:
239
$ db2 "rollforward db bart stop tablespace (data01, index01, long01) online" SQL1278W Roll-forward operation has completed successfully. Active or indoubt transactions required rollback on node(s) "0". $
The tablespaces will now be in backup state pending as shown in Figure 151, using the LIST TABLESPACES SHOW DETAIL command.
240
2. When the backup image selection page appears as shown in Figure 153, select a backup image in the list. This can be a backup image or a tablespace image.
241
3. If you select a database backup image, on the Table Spaces tab, you can select which tablespaces you can restore. For this example, we used a backup image taken for tablespace DATA01, INDEX01, and LONG01 as shown in Figure 154.
242
4. On the Roll-forward tab as shown in Figure 155, 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.
243
5. Go to the Options tab as shown in Figure 156, and select Online for an online restore. Select OK.
244
6. A dialog box appears as shown in Figure 157 to confirm if the roll-forward is successful. Select Close.
245
7. Finally, do a backup of the database or the tablespaces in backup pending mode. See 10.4.4, Point in time recovery using the command line on page 238 for backing up tablespaces with one command.
246
sections for how to setup the Tivoli Storage Manager client API on AIX, SUN or Windows: 5.3.1, API client setup on page 64 6.2, Configuration and setup of Tivoli Storage Manager client API on page 94 8.4, Configuring the API on page 156 After the restore is completed, we recommend that you do not continue to use the temporary Tivoli Storage Manager client setup on the target machine. Otherwise, database backup objects from the original machine and the target would be mixed in the Tivoli Storage Manager server filespace.
These database configuration parameters are designed to temporarily overwrite the Tivoli Storage Manager client API setup for the purpose of restore. They can but should not be used for normal backup operations. The following steps are required. We assume that the Tivoli Storage Manager API client is already setup. 1. 2. 3. 4. 5. 6. Set password access to prompt Create new target DB2 database Get Tivoli Storage Manager information about old backup Update the DB2 database configuration Restore the database Enable Tivoli Storage Manager client for normal backup operation
247
10.5.3.1 Set password access to prompt To use the DB2 database configuration and not the generated password, the dsm.sys PASSWORDACCESS parameter must be set to prompt. 10.5.3.2 Create new target DB2 database To be able to set the database parameter described later, the target database must be created first. (There is no way to set database parameters if there is no database!) Any operating system 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.
$ db2 create db sample1 DB20000I The CREATE DATABASE command completed successfully. $
10.5.3.3 Get Tivoli Storage Manager information about old backup Following information about the database backup file that reside on the Tivoli Storage Manager server will be needed. Management class (optional) Nodename (required) Password of nodename (required) Owner of the file (optional)
One way to get this information is to ask the Tivoli Storage Manager administrator. Another way is to get the information directly out of the Tivoli Storage Manager server. To login to the server open an administrative client session. On the command line enter following command:
dsmadmc
You will be prompted for the node name and the password. The node name and the password are the ones used in 10.5.3.1, Set password access to prompt on page 248.
248
$ id uid=203(db2inst1) gid=102(db2iadm1) groups=1(staff),101(db2asgrp) $ dsmadmc Tivoli Storage Manager Command Line Administrative Interface - Version 4, Release 1, Level 1.0 (C) Copyright IBM Corporation, 1990, 1999, All Rights Reserved. Enter your user id: brazil_db2 Enter your password: Session established with server BRAZIL: AIX-RS/6000 Server Version 4, Release 1, Level 2.0 Server date/time: 03/07/01 16:38:07 Last access: 03/07/01 tsm: BRAZIL> .
16:25:13
Type help, to get help on what possible commands you can use. Every backup or logfile is indexed in the Tivoli Storage Manager server database. To get a list of the backups you already made, enter following command.
select * from backups where node_name=<source client API node name>
Note: The <source client API node name> must be in uppercase. The following screen shows the results of this command:
tsm: BRAZIL>select * from backups where node_name='BRAZIL_DB2' ANR2963W This SQL query may produce a very large result table, or may require a significant amount of time to compute. Do you wish to proceed? (Yes/No)y NODE_NAME: FILESPACE_NAME: STATE: TYPE: HL_NAME: LL_NAME: OBJECT_ID: BACKUP_DATE: DEACTIVATE_DATE: OWNER: CLASS_NAME: BRAZIL_DB2 /SAMPLE ACTIVE_VERSION FILE /NODE0000/ FULL_BACKUP.20010301184338.1 19470 2001-03-01 18:43:39.000000 db2inst1 DEFAULT
249
The required information for our purposes is the values related to the following attributes: CLASS_NAME, NODE_NAME, OWNER. The password of the Tivoli Storage Manager client node is not readable as stored in the Tivoli Storage Manager server. If the password had been forgotten the Tivoli Storage Manager administrator can assign a new one. 10.5.3.4 Update the DB2 database configuration The following DB2 database parameters will, if set, overwrite the Tivoli Storage Manager client setup on the target machine. TSM_NODENAME This is the Tivoli Storage Manager client node name to which the DB2 backup originally was sent. This parameter is required. Note, the PASSWORDACCESS parameter in the dsm.sys file must be set to prompt; otherwise, the Tivoli Storage Manager API client will not be able to connect to the Tivoli Storage Manager server. TSM_PASSWORD This is the password of the Tivoli Storage Manager client where the DB2 backup originally was sent. This parameter is required. Note, the PASSWORDACCESS parameter in the dsm.sys file must be set to prompt; otherwise, the Tivoli Storage Manager API client will not be able to connect to the Tivoli Storage Manager server. TSM_MGMTCLASS This defines the management class where the backup image should be sent. This value can be left blank for the restore of a database. The restore will find the file (that belongs to a specific Tivoli Storage Manager node) no matter in which management class the file actually resides. TSM_OWNER Each database file was backed up by a specific user. This value can be left blank for the restore. (It seems that DB2 reads the database backup file as root user from the Tivoli Storage Manager server and is therefore able to restore the database file that was originally backed up by another user.) In our example, we created the database sample1 and set only the required database configuration parameters (only Tivoli Storage Manager parameters are shown).
250
$ db2 update db cfg for sample using tsm_nodename brazil_db2 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. $ db2 update db cfg for sample using tsm_password brazil_db2 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. $ db2 get db cfg for sample1 TSM management class TSM node name TSM owner TSM password (TSM_MGMTCLASS) (TSM_NODENAME) (TSM_OWNER) (TSM_PASSWORD) = = brazil_db2 = = *****
10.5.3.5 Restore the database To restore a DB database backup that was originally backed up by another TSM client, you will need to get a listing of the DB2 backups from the other client using db2adutl with the nodename and password details from the original backup client. Again, the passwordaccess in the dsm.sys file must be set to prompt; otherwise, this command will fail with an authentication error.
$ db2adutl query full db sample nodename brazil_db2 password brazil_db2 Query for database SAMPLE Retrieving full database backup information. full database backup image: 1, Time: 20010320112706 Oldest log: S0000116.LOG, Node: 0, Sessions used: 1 full database backup image: 2, Time: 20010320101516 Oldest log: S0000091.LOG, Node: 0, Sessions used: 1 full database backup image: 3, Time: 20010320093553 Oldest log: S0000062.LOG, Node: 0, Sessions used: 1
Select the database to restore, and use a db2 restore command to restore the database. In our example, we restore a database image from database sample to database sample1. Afterwards we rollforward to the end of logs.
251
$ db2 restore db sample use tsm taken at 20010320112706 into sample1 SQL2528W Warning! Restoring to an existing database that is the same as the ba ckup image database, but the alias name "SAMPLE1" of the existing database does not match the alias "SAMPLE" of backup image, and the database name "SAMPLE1" of the existing database does not match the database name "SAMPLE" of the backup i mage. The target database will be overwritten by the backup version. Do you want to continue ? (y/n) y DB20000I The RESTORE DATABASE command completed successfully. $ db2 rollforward db sample1 stop 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 = sample1 = 1 = = = = = 0 not pending 2001-03-20-16.43.40.000000
To also roll-forward the logfiles, backed up by the user exit of the original Tivoli Storage Manager node, the user exit on the target machine needs to be configured. In addition, the db2uext2.c source code needs to be modified to connect to the original Tivoli Storage Manager node; otherwise, it will use the target Tivoli Storage Manager API client setup. Also the destination database name should be named the same as the original database. DB2 will create the name of the logfiles to restore using the name of the target database. If this name differs from the name of the original database, the roll-forward process will not find the logfiles on the Tivoli Storage Manager server. To make the necessary changes in the userexit look for the dsmInit routine in the db2uext2.c script. The third parameter specifies the Tivoli Storage Manager client nodename to connect to and the fifth parameter specifies the Tivoli Storage Manager client password. For further information about the dsmInit Routine, see Tivoli Storage Manager Using the Application Program Interface V4R1, SH26-4123. In the example, both the original and the modified versions of the dsmInit call are shown. The variables ORIG_NODENAME and ORIG_PASSWORD are normal defined string variables that contain the original Tivoli Storage Manager nodename and password, for example, #define ORIG_NODENAME BRAZIL_DB2.
252
adsmRc = dsmInit( &adsmHandle, &adsmApiVer, NULL, NULL, inputParms->adsmPasswd, FILE_SPACE_TYPE, NULL, NULL ) ; This line must be changed to something like the follow: adsmRc = dsmInit( &adsmHandle, &adsmApiVer, ORIG_NODENAME , NULL, ORIG_PASSWORD, FILE_SPACE_TYPE, NULL, NULL ) ;
After the user exit is setup with the above modification, the db2 rollforward command is able to roll-forward the logfiles from the original database. If the stop option on the rollforward is never specified, the roll-forward can be restarted after new logs are available on the Tivoli Storage Manager server from the old database. (With this setup we implemented a kind of shadow database!)
$ db2 rollforward db sample to end of logs 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 = sample = 1 = = = = = 0 DB working S0000203.LOG S0000161.LOG - S0000202.LOG 2001-03-20-21.31.29.000000
DB20000I The ROLLFORWARD command completed successfully. $ $ db2 rollforward db sample to end of logs 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 = sample = 1 = = = = = 0 DB working S0000206.LOG S0000161.LOG - S0000204.LOG 2001-03-20-21.38.45.000000
This roll-forward can be repeated until the stop option of the db2 rollfoward command is specified. This will enable the clients to access the database on the destination node.
253
10.5.3.6 Enable TSM client for normal backup operation This step is required if both the original and the destination database want to back up their database and logfiles using Tivoli Storage Manager, after the restore to the destination machine is finished. If the DB2 database parameters stay the same the backups and the logfiles will probably mix up on the Tivoli Storage Manager server. To enable the Tivoli Storage Manager client for normal backup operation, the DB2 configuration parameters and, if modified, the db2uext2 program needs to be changed back as they were before the restore. For example, to set the TSM_NODENAME parameter back to NULL the following db2 command needs to be executed:
$ db2 update db cfg for sample using tsm_nodename NULL 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.
The changes made to db2uext2.c must be redone. The db2uext2 compiled again and then copied to the adm directory. After that the destination database should be ready for normal backup operations.
254
2. Using the Tablespace ID, list the containers for the tablespace using the list tablespace containers command: 255
$ db2 list tablespace containers for 4 show detail Tablespace Containers for Tablespace 4 Container ID Name Type Total pages Useable pages Accessible = = = = = = 0 /db2dat1/bart/index01.dat File 5120 5104 Yes
3. Use the list history command to select a backup image you want to use for the restore. For database BART, our command will be:
$ db2 list history backup all for bart
An excerpt from the results of the command is shown in Figure 159. 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 in the Start Time field.
4. Use the restore command with the redirect option, specifying the tablespace to be restored and the timestamp of the image you want to use for the restore:
256
$ db2 "restore db bart tablespace (INDEX01) online use tsm \ > taken at 20010323150025 redirect" SQL1277N Restore has detected that one or more table space containers are inaccessible, or has set their state to 'storage must be defined'. DB20000I The RESTORE DATABASE command completed successfully.
5. Use the set tablespace containers to resize the container for tablespace ID 4. The ignore rollforward contaner operations means that the ALTER TABLESPACE operations in the logs will be ignored during the roll-forward.
$ db2 "set tablespace containers for 4 \ > ignore rollforward container operations \ > using (file '/db2dat1/bart/index01.dat' 2560)" DB20000I The SET TABLESPACE CONTAINERS command completed successfully.
257
1. Right-click the database, and then from the drop down menu select Restore->Database as shown in Figure 160.
2. When the backup image page appears as shown in Figure 161, select the database image you want to use for the restore, and then select the Table Spaces tab.
258
3. On the Table Spaces page as shown in Figure 162, click the Use selected tablespaces only radio button, select INDEX01, and then select the Containers tab.
259
4. On the Containers page, when you check the Redirect table space containers, and it display the list of containers for the tablespace as shown in Figure 163, highlight the container on the lower frame, and then select Change.
260
5. A Change Container dialog appears as shown in Figure 164. Change the file size, and then select OK.
261
6. You are now back to the Container page as shown previously in Figure 163. 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 165. Select the Options tab.
262
7. On the Options page as shown in Figure 166, select Online if you want to do recovery online. Select OK when done.
263
8. A dialog box appears as shown in Figure 167 to confirm if the tablespace redirected restore is successful. Select Close.
264
1 1 1 1 1 1
265
Rollforward status Not pending DB pending DB working TBS pending TBS working
Description The database or tablespace does not require the rollforward operation The database is in rollforward-pending state The database is in rollforward-in-progress state One or more tablespaces are in a rollforward-pending state One or more tablespaces are in a rollforward-in-progress state
266
a different backup image. You can use any backup image that you want, and these can be images with timestamps that were taken before or after the backup image that you used on the previous restore operation. For example, you may want to use an earlier backup image for a point in time recovery. However, you must be careful in the roll-forward operation that you do not use archive logs that have been reused, as mentioned in 10.4.1, Point in time recovery concepts and lab experience on page 235; otherwise, with Tivoli Storage Manager your roll-forward will fail. Before repeating the restore operation, cancel the roll-forward. For example:
db2 rollforward db bart cancel tablespace(data01,index01,long01)
The database or tablespaces that were previously restored will be placed in a restore-pending state. You can now use a backup image to restore a database, or you can use one or more backup images to restore tablespaces, so that all tablespaces that were previously in a restore-pending state will be in a rollforward-pending state.
2. Because you have a more recent tablespace backup for DATA01 than the last database backup image, you can restore DATA01 from the latest tablespace backup image:
267
$ db2 "restore db bart tablespace (data01) use tsm \ > taken at 20010404171748" DB20000I The RESTORE DATABASE 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 roll-forward state, as discussed in 10.8.1, Roll-forward status on page 266, with the following:
268
$ db2 rollforward db bart query status 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 = bart = 1 = = = = = 0 not pending 2001-04-03-16.41.19.000000
This does not work all the time. Sometimes, DB2 still puts it in rollforward-pending state. To remove the rollforward-pending state, stop the rollforward:
$ db2 rollforward db bart stop
269
270
3. Register the node DB2TSM on the Tivoli Storage Manager server. It is recommended to create a new POLICY DOMAIN on the Tivoli Storage Manager server for this node. If you do create a new domain, make sure the node is updated with the new domain. The domain needs only one management class with a backup copygroup that has the following retention settings:
VEREXIST=1 VERDELETED=0 RETEXTRA=0 RETONLY=0
4. In Control Panel/System for the environment SYSTEM variables, specify the variable DSMI_CONFIG with the value: x:\progra~1\Tivoli\TSM\api\dsm.opt Note: DSMI_CONFIG is case sensitive. The SYSTEM not the USER variable needs to be set. 5. Reboot the system or restart the DB2 services, so that the DSMI_CONFIG variable will be loaded into the DB2 runtime engine. Otherwise, a backup to Tivoli Storage Manager will fail with error 406 DSM.OPT file not found. 6. Sign-on as db2admin and change to the ...\sqllib\adsm directory. 7. Run the executable 'dsmapipw' and follow the prompts. It will ask for the current password, then for a new password, and confirmation of the new password. It should report if it is successful.
271
8. Run the db2 command 'db2adutl query' to confirm that the password file was correctly set. If the command comes back and says no db2 objects found, then it is working (you haven't done any backups yet). You should be able to check the activity log on the Tivoli Storage Manager server to confirm that the node DB2TSM authenticated. Db2adutl.exe is located in the x:\program files\sqllib\bin directory. 9. You can now perform a backup using the db2 command line or the db2 connect GUI. (For example, backup db DBNAME use tsm.)
4. Create a plain text file dsm.sys in /usr/tivoli/tsm/client/api/bin. It must contain at least the following:
SERVERNAME DB2 COMMMETHOD TCPIP TCPSERVERADDRESS xxx.xxx.xxx.xxx NODENAME DB2TSM PASSWORDACCESS GENERATE
5. Register the node DB2TSM on the Tivoli Storage Manager server. We recommend for you to create a new DOMAIN on the Tivoli Storage Manager server for this node. It needs only one management class with a copygroup that has the following retention settings:
VEREXIST=1 VERDELETED=0 RETEXTRA=0
272
RETONLY=0
6. Sign-on as root and cd to the db2 directory that contains the files db2adutl and dsmapipw. 7. Run the executable 'dsmapipw' and follow the prompts. It will ask for the current Tivoli Storage Manager node password, then for a new password, and confirmation of the new password. It should report if it is successful. 8. Run the command 'db2adutl query' to confirm that the password file was correctly set. If the command comes back and says no db2 objects found, then it is working (you haven't done any backups yet). You should be able to check the activity log on the Tivoli Storage Manager server to confirm that the node DB2TSM authenticated. 9. You can now perform a backup using the command line or the db2 connect GUI. For example, db2 backup db DBNAME use tsm. Additional DB2 information: - In the home/db2instance/sqllib directory run '. db2profile' to update the signed on user with the needed environment variables (DB2INSTANCE=db2inst1, for example). - Start db2 command line processor via /home/db2instance/sqllib/bin/db2. - Get db cfg for DBNAME. - Update db cfg for DBNAME using TSM_PASSWORD NULL. (Similar syntax for another Tivoli Storage Manager parameters. NULL causes the parameter to be reset to nothing.) - Backup db DBNAME to /test (backup to a directory).
273
2. Install Tivoli Storage Manager API. 3. Create a plain text file dsm.opt in /opt/tivoli/tsm/client/api/bin. It only needs one line, the value for SERVERNAME is arbitrary, but must match the dsm.sys file:
SERVERNAME DB2
4. Create a plain text file dsm.sys in /opt/tivoli/tsm/client/api/bin. It must contain at least the following:
SERVERNAME DB2 COMMMETHOD TCPIP TCPSERVERADDRESS xxx.xxx.xxx.xxx NODENAME DB2TSM PASSWORDACCESS GENERATE
5. Register the node DB2TSM on the Tivoli Storage Manager server. We recommend for you to create a new DOMAIN on the Tivoli Storage Manager server for this node. It needs only one management class with a copygroup that has the following retention settings:
VEREXIST=1 VERDELETED=0 RETEXTRA=0 RETONLY=0
6. Sign-on as root and cd to the db2 directory that contains the files db2adutl and dsmapipw. 7. Run the executable 'dsmapipw' and follow the prompts. It will ask for the current Tivoli Storage Manager node password, then for a new password, and confirmation of the new password. It should report if it is successful. 8. Run the command 'db2adutl query' to confirm that the password file was correctly set. If the command comes back and says no db2 objects found, then it is working (you haven't done any backups yet). You should be able to check the activity log on the Tivoli Storage Manager server to confirm that the node DB2TSM authenticated. 9. You can now perform a backup using the command line or the db2 connect GUI. For example, db2 backup db DBNAME use tsm. Additional DB2 information:
274
- In the /export/home/db2instance/sqllib directory run '. db2profile' to update the signed on user with the needed environment variables (DB2INSTANCE=db2inst1, for example). - Start db2 command line processor via /export/home/db2instance/sqllib/bin/db2. - Get db cfg for DBNAME. - Update db cfg for DBNAME using TSM_PASSWORD NULL. (Similar syntax for other Tivoli Storage Manager parameters. NULL causes the parameter to be reset to nothing.) - Backup db DBNAME to /test (backup to a directory).
275
276
Appendix B. Troubleshooting
In this appendix, we will have a look at common errors and how they can be fixed. We give a list of the most useful logfiles and techniques to determine the source of the problem. A useful thing to do when troubleshooting a problem is to start a Tivoli Storage Manager administrative client in console mode. This will allow you to see the activity that is occurring on the Tivoli Storage Manager server. Among other things you will see node sessions start and stop and any Tivoli Storage Manager server error messages. The administrative client console can be started with the dsmadmc -cons command. See the following example where we monitor how the Tivoli Storage Manager client BRAZIL_DB2 connects and disconnects from the Tivoli Storage Manager server:
$ dsmadmc -cons Tivoli Storage Manager Command Line Administrative Interface - Version 4, Release 1, Level 2.0 (C) Copyright IBM Corporation, 1990, 1999, All Rights Reserved. Enter your user id: admin Enter your password: Session established with server BRAZIL: AIX-RS/6000 Server Version 4, Release 1, Level 2.0 Server date/time: 04/02/01 17:02:02 Last access: 04/02/01
17:01:01
ANR0406I Session 9114 started for node BRAZIL_DB2 (DB2/6000) (Tcp/Ip 9.1.150.57(39918)). ANR0403I Session 9114 ended for node BRAZIL_DB2 (DB2/6000).
B.1 Gotchas
One of the most common problems is that the Tivoli Storage Manager API client is not able to connect to the Tivoli Storage Manager server.
277
db2 => backup db sample user db2admin using itsosj use tsm SQL2062N An error occurred while accessing media "C:\PROGRA~1\SQLLIB\bin\db2tadsm.dll". Reason code: "406"
B.1.1.1 Windows Make sure that the environment variable DSMI_CONFIG is specified and that it is specified as a SYSTEM variable and not a USER variable. Verify that the DSMI_CONFIG contains the complete path and filename to the options file, and that the options file has been created at that path with that filename. Perform a db2stop and then a db2start to ensure that the variable is loaded into the DB2 run-time engine. The variable is case sensitive so be sure that it is in upper case. B.1.1.2 UNIX Make sure that the environment variable DSMI_CONFIG is specified in the .profile or db2 profile of the instance owner. Verify that the DSMI_CONFIG contains the complete path and filename to the options file, and that the options file has been created at that path with that filename. Perform a db2stop and then a db2start to ensure that the variable is loaded into the DB2 run-time engine. A simple way to check this is to login as the instance owner and execute the command env | grep DSMI. Then view the contents of the file with the command more $DSMI_CONFIG . The variable is case sensitive so be sure that it is in upper case.
278
commmethod tcpip tcpport 1500 tcpserveraddress 193.1.1.11 nodename jamaica_db2 passwordaccess generate traceflag config tracefile c:\temp\apitrace.out
With the trace lines in the client options file, the next time db2adutl or a DB2 backup using Tivoli Storage Manager is run, a file will be created as specified by the tracefile command. If this file is created, you have already verified something important, that is, the client options file that you modified is the one that the db2adutl or DB2 is using. Open this file with a text editor. This trace will show you information regarding the level of the Tivoli Storage Manager API, tcpserveraddress, commmethod, errorlogname, ds_dir, passwordaccess, and so on. Pay special attention to the errorlogname and the ds_dir. The value for errorlogname will either be dsierror.log or a path and dsierror.log. For UNIX, the DB2 instance owner must have write access to the directory and path of the errorlogname. If this value is just dsierror.log with no path, DB2 will try and create the dsierror.log in the root directory /dsierror.log. Since the DB2 instance owner does not have write access to this directory the dsierror.log will not be created. This is set with the DSMI_LOG environment variable. The ds_dir value corresponds to the DSM_DIR environment variable. For UNIX, this value also determines from which directory the dsm.sys file will be read. Most Tivoli Storage Manager installations have a dsm.sys in the .../tivoli/tsm/ba/bin and the .../tivoli/tsm/api/bin directories. When matching the servername value in the dsm.opt file with the corresponding servername in the dsm.sys, use the ds_dir value to determine which dsm.sys is being used.
Appendix B. Troubleshooting
279
nodename and password with the appropriate values. Use the Tivoli Storage Manager administrative client in console mode to verify which node is trying to access the Tivoli Storage Manager server. To regenerate the password file, run dsmapipw.exe again.
280
creates a corrupt backup object or corrupt archivelog, Tivoli Storage Manager will store and retrieve them in the same corrupt state. Tivoli Storage Manager is not required to do a DB2 backup so you can use DB2 alone to isolate a problem. For example, you can create a DB2 backup on a local filesystem. In fact you can use the db2adutl.exe to extract a backup from Tivoli Storage Manager storage to disk. Then you can restore the backup without using Tivoli Storage Manager. If Tivoli Storage Manager fails when extracting a backup to disk, then it is a Tivoli Storage Manager server or Tivoli Storage Manager API problem. If DB2 fails in restoring the backup from disk, then it is probably a DB2 problem. Another useful way to isolate a problem is to compare a failing machine with a working one. Then you can see what is the same and what is different. Are they using the same API level, DB2 level and fixpack, Tivoli Storage Manager server? Do the nodes belong to the same domain and have the same settings? What do the client options file look like between a failing and a working machine?
Appendix B. Troubleshooting
281
The file resides in the directory specified by the AUDIT_ERROR_PATH in the user exit program. Only the unsuccessful user exit archive or retrieve operations are logged to this file. The most common user exit return code is return code 16 which means a software error. The additional (mostly Tivoli Storage Manager API) return codes supplied within the USEREXIT.ERR file must be analyzed by looking at the related software product error messages reference book. For a listing of user exit return codes, see B.4.1, User exit return codes on page 283. The example below shows an example USEREXIT.ERR entry. Tivoli Storage Manager API return code 186 means that no archive copy group has been defined for the destination management class.
******************************************************************************** Time of Error: Thu Mar 1 19:10:15 2001 Parameter Count: Parameters Passed: Database name: Logfile name: Logfile path: Node number: Operating system: Release: Request: Audit Log File: System Call Parms: Media Type: User Exit RC: 8 SAMPLE S0000000.LOG /home/db2inst1/db2inst1/NODE0000/SQL00001/SQLOGDIR/ NODE0000 AIX SQL07010 ARCHIVE /home/db2inst1/tsm/ARCHIVE.LOG ADSM 16
$HOME/sqllib/db2dump/db2diag.log This file contains all logged information from DB2. To get the most information the default diaglevel (which is 3) can be changed to 4, with following command:
db2 update dbm cfg using diaglevel 4
In general, a DB2 log entry may contain a hexadecimal number representing an DB2 internal return code. For a listing of these numbers, see Interpreting the db2diag.log in DB2 UDB Troubleshooting Guide V7, GC09- 2850. If DB2 receives a return code (>0) from the db2uext2 command a line like the following will appear in the db2diag.log file:
282
User Exit returned error on ARCHIVE log file S0000114.LOG from /home/db2inst1/db 2inst1/NODE0000/SQL00001/SQLOGDIR/ for database SAMPLE, error code 21
The error code numbers are defined in the db2uext2 source code. See B.4.1, User exit return codes on page 283, for a complete listing of user exit return codes. $HOME/sqllib/db2dump/db2alert.log If an error is determined to be an alert, then an entry is made in the db2alert.log file. dsmsched.log By default, Tivoli Storage Manager stores the schedule log information in a file named dsmsched.log. The default name can be overwritten by specifying the SCHEDLOGNAME option in the client option files.
Appendix B. Troubleshooting
283
284
Appendix C. Performance
In this appendix, we give some suggestions about how to accelerate the DB2 backup process when using Tivoli Storage Manager. Most of the information was gathered from DB2 UDB V7.1 Performance Tuning Guide, SG24-6012. First, we show the possible bottlenecks that the backup data has to go through until arriving at the Tivoli Storage Manager server. All these parts may require tuning. Some of these will bring a big improvement to the backup performance, some less so. Then we discuss the DB2 backup and restore commands in more detail.
285
Operating system Tuning the operating system normally will not bring that much of an increase in performance to the backup process. Although, one tuning measure is not to restrict the DB2 process access to memory, CPU or I/O subsystem. Tivoli Storage Manager client Some tuning configurations can be done in the dsm.sys file. The purpose is to tune TCPIP (for example, TCPWindowsize) or to group smaller files together (TXN-parameters). Communication In some cases, the performance of the backup is reduced by the LAN that is used. The best practice is to use a dedicated LAN for backup needs. This will prevent the backup from interference from other users or processes, and vice versa. Tivoli Storage Manager server Similar to the Tivoli Storage Manager client, the Tivoli Storage Manager server can be tuned. However, this tuning will often take effect for all the Tivoli Storage Manager clients and must be planned very carefully. One important tuning issue on the server is to schedule the time when client backups take place, to have enough resources (for example, tape mounts) available for the backup or restore.
286
within a defined amount of time (IDLETIMOUT parameter at Tivoli Storage Manager server). WITH num-buff BUFFERS 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). BUFFER buff-size This value is used as the buffer allocation size in pages (4 KB) when building the backup image. For a buffer size of zero, the value of the database manager configuration parameter BACKBUFSZ will be used as the buffer allocation size. When backing up a database, the data is first copied to an internal buffer. Data is then written from this buffer to the backup media when the buffer is full. Tuning BACKBUFSZ can help improve the performance of the backup utility as well as minimize the impact on the performance of other concurrent database operations. We recommend setting the buffer size to a multiple of the extent size. If multiple table spaces have different extent sizes, the buffer size value should be a multiple of the largest extent size. PARALLELISM n Using this parameter can dramatically reduce the time required to complete the backup (especially if the backup is going to a disk). This parameter defines the number (n) of processes that are started to read data from the database. Each process is assigned to backup a specific table space. When it completes backing up the tablespace, it requests another. Each process will be assigned a tablespace to complete, therefore, to get better performance, let this value be less than the number of tablespaces, since setting up the value higher than the number of tablespaces does not show any significant difference in performance. If backing up to different targets (for example, using multiple sessions to send the data to Tivoli Storage Manager) parallelism should not be greater than the number of targets (sessions)). In the next example, we assume that we have two tape mount points available at the Tivoli Storage Manager server. We can use two sessions and also a parallelism of 2 (no matter how many tablespaces we have):
db2 backup db sample use tsm open 2 sessions with 6 buffers parallelism 2
Appendix C. Performance
287
288
289
Now, we look at how the split mirror feature is implemented on the IBM ESS. On the IBM ESS, the split mirror feature is named FlashCopy. 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. At a specific time the FlashCopy relationship between source and target volumes will be established. This is known as the T0 (time zero) copy. The process of establishing this T0 copy takes only a few seconds. A bitmap will be created to identify the T0 data on the source disk. 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.
Source
Target
T0 Time read
write
read
write
T1
Before an application can update a track on the source that has not yet been copied, the track is copied to the target volume. After some time all the data is copied either by the background copy process or by write operation on either the source or the target volume.
290
Note
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. DB2 provides the suspended I/O feature and db2inidb tools to make use of the split mirror feature.
291
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 (discussed later in D.1.3, DB2 mirror database on page 294) is turned off. Crash recovery is not performed, and the database remains inconsistent. We will now show three scenarios in which DB2 can use the split mirror features of storage servers. It is assumed that the source and target DB2 instance reside on different machines. Furthermore, the setup of the DB2 instance must be the same on the source and on the target machine, for example, userid and groupid of the instance owner. Also, the operating system and DB2 versions should be the same.
Establish split mirror This step is dependent on the vendor. See the appropriate vendor documentation on how to establish the split mirror. The whole database must be copied to use it on the target machine. 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
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.) Start target (clone) database
292
Issue the db2start command at the instance at the target machine. Bring the clone database into a consistent state. (Perform crash recovery.) The following command will rollback every uncommitted transaction:
db2inidb <target-database> as snapshot
The clone database can now be used for an offline backup, or as a test database.
Note
Any DB2 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. For the purpose of a full offline database backup the same Tivoli Storage Manager client configuration can be used on the target machine to send the backup to Tivoli Storage Manager. This will allow you to restore the database image on the source database using Tivoli Storage Manager. It is not possible to do rollforward recovery after the full offline database image is restored. Warning: If the database is to be used as a test database, then the full database backups and the user exit, if configured, must use another Tivoli Storage Manager node. Otherwise, the logfiles from the test and the source database will get mixed up at the Tivoli Storage Manager server, and there is no way to separate them afterwards.
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.
293
The steps required to setup 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.)
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 rollforward command.
db2 rollforward db <target-database> stop
Then the users can switch over to the standby database to continue their work.
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: Suspend I/O on source database The following DB2 command will suspend all write activities from DB2 clients, but they will not be disconnected them from the database.
db2 set write suspend for database
294
This step is dependent on the vendor. See the appropriate documentation for how to establish the split mirror. 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. 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
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 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: Stop the source database (we want to restore this database)
db2stop
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. Start the source database again.
295
db2start
Now a rollforward to end of logs of the database can be started. The logs from the original source database will be used.
296
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.
297
# 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.
For more information about splitcopy, see 5.8 Online JFS Backup in AIX Version 4.3 Differences Guide, SG24-2014. DB2 can use this splitcopy feature to create a database backup image on the splitcopy filesystem that can be used to restore the DB2 database and also rollforward the logs.
298
The following steps are required for backup using AIX splitcopy: Create the mirrored filesystems and, if needed, the mirrored logfiles. The best practice is to use three copies, so that the production database will have at least two copies to provide availability after the splitcopy was established. Create database on one or more (LVM) mirrored filesystems. We do not recommend for you to put the logfiles on this mirrored filesystem. The backup and the restore of the database will be easier. Suspend I/O to database. Suspend access from clients to the database. The clients will not lose their connection, but the write and update transactions will hang.
db2 set write suspend for database
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
Backup database. As instance owner (or root user) use an AIX backup command to backup the datafile of the database. Ensure that all files are being backed up. For example:
cd /dbcopy; tar -cvf /tmp/db2inst1.tar ./db2inst1
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.
299
The following steps are required for restoring a backup that was made using AIX splitcopy: Stop the database.
db2stop
Restore the backup image on the original destination. As instance owner (or root user) restore the backup image. Be sure that no original logs will be overwritten. For example:
cd /dbdata; tar -xvf /tmp/db2inst1.tar
300
301
To enable the use of incremental backups, the DB2 database configuration parameter TRACKMOD must be set to on. To activate this parameter a db2stop and db2start may be necessary.
$ db2 update db cfg for sample 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. $
After that a full database backup is required to initialize the chain of backups. This can be an offline or online backup.
$ db2 backup db sample online use tsm Backup successful. The timestamp for this backup image is : 20010327153632 $
Now we are able to generate incremental or delta backups. Incremental and delta backups can also be sent to a Tivoli Storage Manager server. From a Tivoli Storage Manager point of view they are treated the same as database backups. They will also be sent to the backup copy group
302
of the associated Tivoli Storage Manager management class. There is no further Tivoli Storage Manager setup required. To start an incremental backup the incremental option of the backup command must be specified.
$ db2 backup db sample online incremental use tsm Backup successful. The timestamp for this backup image is : 20010327161558
To start a delta backup the incremental delta option of the backup command must be specified.
$ db2 backup db sample online incremental delta use tsm Backup successful. The timestamp for this backup image is : 20010327162148
If the incremental and delta backups are being sent to Tivoli Storage Manager they can be viewed with the db2adutl command (only relevant section is shown).
Query for database SAMPLE Retrieving FULL DATABASE BACKUP information. 1 Time: 20010327170534 Oldest log: S0000099.LOG Node: 0 Retrieving INCREMENTAL DATABASE BACKUP information. 1 Time: 20010327170812 Oldest log: S0000101.LOG Node: 0 Retrieving DELTA DATABASE BACKUP information. 1 Time: 20010327170859 Oldest log: S0000102.LOG 2 Time: 20010327170836 Oldest log: S0000102.LOG 3 Time: 20010327170736 Oldest log: S0000100.LOG 4 Time: 20010327170711 Oldest log: S0000100.LOG
Sessions: 1
Sessions: 1
0 0 0 0
1 1 1 1
To restore a database the following database backups are required: Last full database backup Last incremental database backup All delta backups since the last incremental backup Any logfile before failure
303
To restore an incremental backup, the incremental option on the DB2 backup command must be used. This option is valid for restoring incremental or incremental delta backups.
$ db2 restore db sample use tsm taken at 20010327170534 DB20000I The RESTORE DATABASE command completed successfully. $ db2 restore db sample incremental use tsm taken at 20010327170812 DB20000I The RESTORE DATABASE command completed successfully. $ db2 restore db sample incremental use tsm taken at 20010327170836 DB20000I The RESTORE DATABASE command completed successfully. $ db2 restore db sample incremental use tsm taken at 20010327170859 DB20000I The RESTORE DATABASE command completed successfully. $ db2 rollforward db sample to end of logs and stop 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 = sample = 1 = = = = = 0 not pending S0000102.LOG - S0000106.LOG 2001-03-27-23.10.15.000000
304
Finding all the backups that are necessary to restore to the end of logs can be time consuming. Fortunately, the database stores the information about which database backups has been made in the past in its history file. So the database knows which database backups are necessary to recover to the end of logs. To make use of the history file during the restore the automatic option on the restore command must be used. We recommend you use the automatic option of the restore command. The necessary backups are acquired automatically by the restore process.
$ db2 restore db sample incremental automatic use tsm SQL2539W Warning! Restoring to an existing database that is the same as the ba ckup image database. The database files will be deleted. Do you want to continue ? (y/n) y DB20000I The RESTORE DATABASE command completed successfully. $ db2 rollforward db sample to end of logs and stop 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 = sample = 1 = = = = = 0 not pending S0000102.LOG - S0000106.LOG 2001-03-27-23.10.15.000000
305
Note
On demand log archiving does not guarantee the log files will be archived immediately; it truncates the log file and issues an archive request, but it is still subject to delays associated with the user exit program.
306
307
We then need to update the backup copy group for this new api_lanfree management class, so the destination is the SAN attached tape storage pool. We decided it was not worth a tape mount to send our archive logs using LAN-free, so we left the destination for the archive copygroup to be disk.
tsm: BRAZIL>update copygroup api_domain api_policy api_lanfree dest=3570san ANR1532I Backup copy group STANDARD updated in policy domain API_DOMAIN, set API_POLICY, management class API_LANFREE.
The only thing left to do is activate the policy set so that this new management class can be used.
tsm: BRAZIL>activate policy api_domain api_policy Do you wish to proceed? (Yes (Y)/No (N)) y ANR1514I Policy set API_POLICY activated in policy domain API_DOMAIN.
Now we can check the backup copygroup for this new managementclass in the active policy. We can see that the retention is correct. Versions exists is set to one, and the rest of the retention settings are zero. One of the most important things is that the copy destination is to the SAN attached tape storage.
308
tsm: BRAZIL>q copygroup api_domain active api_lanfree f=d Policy Domain Name: Policy Set Name: Mgmt Class Name: Copy Group Name: Copy Group Type: Versions Data Exists: Versions Data Deleted: Retain Extra Versions: Retain Only Version: Copy Mode: Copy Serialization: Copy Frequency: Copy Destination: Last Update by (administrator): Last Update Date/Time: Managing profile: API_DOMAIN ACTIVE API_LANFREE STANDARD Backup 1 0 0 0 Modified Shared Dynamic 0 3570SAN ADMIN 03/29/2001 07:05:33
To make sure that our DB2 backups go to this new management class, in the client options file (dsm.opt), we added this include statement.
include * api_lanfree
The package name that was current at the time of writting was IP22268_StorageAgent.exe. Once downloaded to the client machine, we just double-clicked the executable to install it. We accepted all the defaults and it installed into the directory c:\program files\tivoli\tsm\storageagent.
309
Ensure that you are correctly licensed for use of the client software. After installing the software, we rebooted the machine.
In Windows 2000, the check for Adsmscsi is different than in Windows NT. From Device Manager in Windows 2000, you must change the view to display hidden devices.
310
After selecting the view to show hidden devices, an entry Non-Plug and Play Drives will show up, which you can open. When you open this you will see AdsmScsi device.
311
One confusing thing is the tsmscsi.exe file located in the storageagent directory. This is not an updated device driver for use with Tivoli Storage Manager. This is a utility that enables and disables Windows 2000 support with the AdsmScsi device driver. When you use this utility to disable Windows 2000 support, the utility changes the startup mode for AdsmScsi to Demand. When you enable support, it changes the startup mode for AdsmScsi to Boot. When you install the storageagent, AdsmScsi defaults to a startup mode of Boot.
312
C:\Program Files\Tivoli\TSM\storageagent>tsmdlst Computer Name: JAMAICA TSM Device Driver: Running TSM Device Name ID LUN Bus Port TSM Device Type Device Identifier ---------------------------------------------------------------------------------mt0.2.0.3 0 2 0 3 3570 IBM 03570C12 5424 lb0.3.0.3 0 3 0 3 LIBRARY IBM 03570C12 5424 mt0.4.0.3 0 4 0 3 3570 IBM 03570C12 5424
From the Tivoli Storage Manager server administrative client, we run the command QUERY DRIVE to determine how the Tivoli Storage Manager server sees the SAN attached tape library.
tsm: BRAZIL>q drive Library Name -----------3570LIB 3570LIB Drive Name -----------DRIVE1 DRIVE2 Device Type ----------3570 3570 Device ---------------/dev/rmt2 /dev/rmt4 ON LINE ------------------Yes Yes
In a SAN, hosts access the same storage, but they may show up differently. The drive mapping makes the association between how the storage agent sees the tape drives, with how the Tivoli Storage Manager server sees the tape drives. Using the output from the TSMDLST.EXE and QUERY DRIVE, we will now define a drive mapping for these two drives.
tsm: BRAZIL>define drivemapping jamaica_sta 3570lib drive1 device=mt0.2.0.3 ANR8916I Drivemapping for drive DRIVE1 in library 3570LIB on storage agent JAMAICA_STA defined. tsm: BRAZIL>define drivemapping jamaica_sta 3570lib drive2 device=mt0.4.0.3 ANR8916I Drivemapping for drive DRIVE2 in library 3570LIB on storage agent JAMAICA_STA defined.
F.1.6 Define server for storage agent on Tivoli Storage Manager server
Using the storage agent name that was specified during the definition of the drive mappings, we now use the command DEFINE SERVER from the Tivoli Storage Manager administrative command line, to configure server to server communications on the Tivoli Storage Manager side. Setting the servername, serverpassword, serverhladdress, and serverlladdress has already been done. The command QUERY STATUS can be used to check if this is the case.
313
tsm: BRAZIL>define server jamaica_sta serverpassword=stapassword hla=193.1.1.85 lla=1500 comm=tcpip ANR1660I Server JAMAICA_STA defined successfully.
It is very important that you use the same server name in this command as that used to define the drive mappings.
314
If you receive an error message that states that the service could not start, but did not return an error, it is most likely caused by specifying a service name other than the one listed above. In this case, use the REMOVE.EXE located in the ...\storageagent directory to remove the service, reboot your machine, and repeat the instructions above. Once the service is started, you can run a QUERY SESSION from the Tivoli Storage Manager server and see the server to server sessions that are always running.
After executing the command, we connected to the storageagent using a Tivoli Storage Manager administrative client. Change the
315
TCPSERVERADRESS for the administrative client to be the IP address of the machine running the storage agent. We had the Tivoli Storage Manager administrative client installed on the same machine as the storage agent, so we just used localhost as our IP address. The admin name and password is the same as your Tivoli Storage Manager server name and password. The query session shows that the LAN-free backup is working. This is indicated by the named pipe session that is sending data to the storage agent. If LAN-free was not working, either the backup would fail or you would see a session on the Tivoli Storage Manager server that was sending the data.
C:\Program Files\Tivoli\TSM\baclient>dsmadmc -tcps=localhost Tivoli Storage Manager Command Line Administrative Interface - Version 4, Release 1, Level 2.12 (C) Copyright IBM Corporation, 1990, 1999, All Rights Reserved. Enter your user id: admin Enter your password: ***** Session established with server JAMAICA_STA: Windows NT Server Version 4, Release 1, Level 3.0 Server date/time: 03/30/2001 15:48:45 Last access: 03/30/2001 15:37:43 tsm: JAMAICA_STA>q session Sess Comm. Sess Number Method State ------ ------ -----1 Tcp/Ip Start 3 Tcp/Ip Start 7 Tcp/Ip Start 12 Tcp/Ip Start 141 Tcp/Ip Start 167 Named RecvW Pipe 169 Tcp/Ip Run Wait Bytes Bytes Sess Platform Time Sent Recvd Type ------ ------- ------- ----- -------0 S 16.5 K 23.2 K Server0 S 68.0 K 92.0 K Server0 S 128.9 K 150.6 K Server0 S 190.6 K 206.5 K Server0 S 31.1 K 31.9 K Server7S 349 20.0 M Node DB2/NT 0S 18.1 K 472 Admin WinNT Client Name -------------------JAMAICA_STA JAMAICA_STA JAMAICA_STA JAMAICA_STA JAMAICA_STA JAMAICA_DB2 ADMIN
F.3 Problems
After specifying the enablelanfree option in the client options file that the db2 backups used, we encountered problems with the userexit and db2adutl. Each of the programs complained that the option enablelanfree yes was not valid for single threaded applications.
316
03/30/2001 15:57:10 ApiInitEx: Error: ENABLELANFREE option not valid for single threaded applications.
We discovered two methods to work around this problem. Both required modifying the C source code for the user exit and recompiling the user exit to produce a new db2uext2.exe. The end result of both was that the option ENABLELANFREE for the user exit program must be set to no. In 8.7, Setting up the DB2 user exit for Tivoli Storage Manager on page 166, we discussed how to modify the user exit to use a different path for some log files. We can do a similar type of thing to either hardcode the ENABLELANFREE option or to specify that the user exit use a different client options file than what the regular DB2 backups to Tivoli Storage Manager uses. Once the user exit uses a different options file, then it is a simple matter of specifying ENABLELANFREE NO in the user exits options file. Otherwise, it will pick up the ENABLELANFREE YES in the client options file. To facilitate either method, we modified the db2uext2.c to contain two extra string literals: CLIENT_OPTIONS_PATH and ENABLELANFREE_NO.
317
#define BUFFER_SIZE
/* transmit or receive the log */ /* file in 4k portions */ #define AUDIT_ACTIVE 1 /* enable audit trail logging */ #define ERROR_ACTIVE 1 /* enable error trail logging */ #define AUDIT_ERROR_PATH "c:\\progra~1\\tivoli\\tsm\\api\\" /* path must end with a slash #define AUDIT_ERROR_ATTR "a" /* append to text file */ #define CLIENT_OPTIONS_PATH "c:\\progra~1\\tivoli\\tsm\\api\\userexit.opt" /*For lanfree or redirected restores*/ #define ENABLELANFREE_NO "-enablelanfree=no" /* for lanfree */
4096
*/
With these entries in place, we can now choose whether to hardcode ENABLELANFREE NO or use the additional options file method. F.3.1.1 Hardcoding ENABLELANFREE NO To hardcode ENABLELANFREE NO in the user exit program, change the call to dsmInit from the initial settings of:
adsmRc = dsmInit( &adsmHandle, &adsmApiVer, NULL, NULL, inputParms->adsmPasswd, FILE_SPACE_TYPE, NULL, NULL ) ;
And, change it to use the ENABLELANFREE_NO string literal that we added earlier.
adsmRc = dsmInit( &adsmHandle, &adsmApiVer, NULL, NULL, inputParms->adsmPasswd, FILE_SPACE_TYPE, NULL, ENABLELANFREE_NO ) ;
Then recompile the user exit and place the resulting db2uext2.exe in the ...\sqllib\bin path, as described in 8.7, Setting up the DB2 user exit for Tivoli Storage Manager on page 166. F.3.1.2 Using an additional options file To have the user exit read an additional options file, you need to change the call to dsmInit from the initial settings of:
adsmRc = dsmInit( &adsmHandle, &adsmApiVer, NULL, NULL, inputParms->adsmPasswd, FILE_SPACE_TYPE, NULL, NULL ) ;
And, change it to use the CLIENT_OPTIONS_PATH string literal that we defined earlier.
318
adsmRc = dsmInit( &adsmHandle, &adsmApiVer, NULL, NULL, inputParms->adsmPasswd, FILE_SPACE_TYPE, CLIENT_OPTIONS_PATH, NULL ) ;
Then recompile the user exit and place the resulting db2uext2.exe in the ...\sqllib\bin path, as described in 8.7, Setting up the DB2 user exit for Tivoli Storage Manager on page 166. With this method you must also create an additional options file that contains, at a minimum, the option ENABLELANFREE NO in the path and with the file name specified in the CLIENT_OPTIONS_PATH string literal. Otherwise, the user exit will fail with RC 406, options file not found.
319
320
Notices
This information was developed for products and services offered in the U.S.A. IBM may not offer the products, services, or features discussed in this document in other countries. Consult your local IBM representative for information on the products and services currently available in your area. Any reference to an IBM product, program, or service is not intended to state or imply that only that IBM product, program, or service may be used. Any functionally equivalent product, program, or service that does not infringe any IBM intellectual property right may be used instead. However, it is the user's responsibility to evaluate and verify the operation of any non-IBM product, program, or service. IBM may have patents or pending patent applications covering subject matter described in this document. The furnishing of this document does not give you any license to these patents. You can send license inquiries, in writing, to: IBM Director of Licensing, IBM Corporation, North Castle Drive Armonk, NY 10504-1785 U.S.A. The following paragraph does not apply to the United Kingdom or any other country where such provisions are inconsistent with local law: INTERNATIONAL BUSINESS MACHINES CORPORATION PROVIDES THIS PUBLICATION "AS IS" WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESS OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF NON-INFRINGEMENT, MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE. Some states do not allow disclaimer of express or implied warranties in certain transactions, therefore, this statement may not apply to you. This information could include technical inaccuracies or typographical errors. Changes are periodically made to the information herein; these changes will be incorporated in new editions of the publication. IBM may make improvements and/or changes in the product(s) and/or the program(s) described in this publication at any time without notice. Any references in this information to non-IBM Web sites are provided for convenience only and do not in any manner serve as an endorsement of those Web sites. The materials at those Web sites are not part of the materials for this IBM product and use of those Web sites is at your own risk. IBM may use or distribute any of the information you supply in any way it believes appropriate without incurring any obligation to you. Information concerning non-IBM products was obtained from the suppliers of those products, their published announcements or other publicly available sources. IBM has not tested those products and cannot confirm the accuracy of performance, compatibility or any other claims related to non-IBM products. Questions on the capabilities of non-IBM products should be addressed to the suppliers of those products. This information contains examples of data and reports used in daily business operations. To illustrate them as completely as possible, the examples include the names of individuals, companies, brands, and products. All of these names are fictitious and any similarity to the names and addresses used by an actual business enterprise is entirely coincidental. COPYRIGHT LICENSE: This information contains sample application programs in source language, which illustrates programming techniques on various operating platforms. You may copy, modify, and distribute these sample programs in any form without payment to IBM, for the purposes of developing, using, marketing or distributing application programs conforming to the application programming interface for the operating platform for which the sample programs are written. These examples have not been thoroughly tested under all conditions. IBM, therefore, cannot guarantee or imply reliability, serviceability, or function of these programs. You may copy, modify, and distribute these sample programs in any form without payment to IBM for the purposes of developing, using, marketing, or distributing application programs conforming to IBM's application programming interfaces.
321
Trademarks
The following terms are trademarks of the International Business Machines Corporation in the United States, other countries, or both: AIX Domino DB2 Universal Database DB2 Enterprise Storage Server Eserver Eserver FlashCopy Informix IBM Lotus Notes Lotus Notes pSeries Redbooks Redbooks (logo) RS/6000 S/390 Tivoli
The following terms are trademarks of other companies: JDBC, Solaris, Sun, and all Java-based trademarks are trademarks of Sun Microsystems, Inc. in the United States, other countries, or both. Microsoft, Visual C++, Windows NT, Windows, and the Windows logo are trademarks of Microsoft Corporation in the United States, other countries, or both. i386, Intel logo, Intel Inside logo, and Intel Centrino logo are trademarks or registered trademarks of Intel Corporation or its subsidiaries in the United States, other countries, or both. UNIX is a registered trademark of The Open Group in the United States and other countries.
Other company, product, or service names may be trademarks or service marks of others.
322
323
Tivoli Storage Manager for Windows Administrators Guide, GC35-0410 Tivoli Storage Manager for Windows Administrators Reference, GC35-0411 Tivoli Storage Manager for AIX Administrators Guide, GC35-0403 Tivoli Storage Manager Installing the Clients V4R1, SH26-4119 DB2 UDB Administration Guide: Implementation, SC09-2944 DB2 UDB Administration Guide: Planning, SC09-2946 DB2 UDB Command Reference V7, SC09-2951 DB2 UDB Troubleshooting Guide V7, GC09- 2850 Using DB2 Universal Database on 64-bit Platforms, which can be found at:
http://www-4.ibm.com/cgi-bin/db2www/data/db2/udb/winos2unix/support/v7p ubs.d2w/en_main
Scroll down the previously mentioned Web page to find the publication within the Administration section.
Tivoli Storage Manager Product Publications and Documentation http://www.storage.ibm.com/hardsoft/products/ess/supserver IBM ESS Open Systems Support http://www.storage.ibm.com/snetwork/index.html Storage Networking (SAN/NAS/iSCSI) http://www-1.ibm.com/servers/aix/products/ibmsw/list/ IBM application availability guide
324
Fax Orders United States (toll free) Canada Outside North America 1-800-445-9269 1-403-267-4455 Fax phone number is in the How to Order section at this site: http://www.elink.ibmlink.ibm.com/pbl/pbl
This information was current at the time of publication, but is continually subject to change. The latest information may be found at the Redbooks Web site. IBM Intranet for Employees IBM employees may register for information on workshops, residencies, and Redbooks by accessing the IBM Intranet Web site at http://w3.itso.ibm.com/ and clicking the ITSO Mailing List button. Look in the Materials repository for workshops, presentations, papers, and Web pages developed and written by the ITSO technical professionals; click the Additional Materials button. Employees may access MyNews at http://w3.ibm.com/ for redbook, residency, and workshop announcements.
325
First name Company Address City Telephone number Invoice to customer number Credit card number
Last name
Card issued to
Signature
We accept American Express, Diners, Eurocard, Master Card, and Visa. Payment by credit card not available in all countries. Signature mandatory for credit card payment.
326
Index A
active logs 19 AIX splitcopy 296 API 156 configuring 156 Tivoli Storage Manager 4 API client installation 34 setup 63 Application Program Interface (API) 33 archive 71 archive logs 19 archive object 35, 37 ARCHIVE.LOG 281 control files 13 copygroup 40 cron 134
D
data dictionary 8 data objects 35 life cycle 43 database 7 recovery 213 database administrator (DBA) 19 database export 28 database managed space (DMS) 18 database partitions 16 DB2 user exit 67, 97, 166 DB2 instance 246 restoring to new 246 DB2 list history 125 DB2 UDB 7 concepts 13 db2adutl 183 db2adutl.exe query 165 EXTRACT 120 QUERY 120 restore 246 utility 119 verify 127 db2adutl utility 119 db2adutl.exe DATABASE 185 DELETE 184 EXTRACT 184 KEEP 185 OLDER THAN 185 QUERY 184 RETONLY 184 SHOW INACTIVE 185 TAKEN AT 185 VERDELETED 184 VERIFY 185 WITHOUT PROMPTING 185 db2ckbkp 124 db2inidb 291 db2nodes.cfg 16 db2rhist.asc 125 db2uext2 130
B
backup automation 134, 195 deletion 127, 131, 193 offline backup 101 online backup 107 verification 124 backup features DB2 V7.1 Fixpak3 Beta 301 backup object 36 automated deletion 133 deletion of 131 backup strategy 25 backup techniques 26 backup windows 24 Backup-Archive (baclient) 91
C
client options file 161 configuration DSMI_CONFIG 65 DSMI_DIR 65 DSMI_LOG 65 configuration parameters TSM_MGMTCLASS 169 TSM_NODENAME 169 TSM_OWNER 169 TSM_PASSWORD 169 containers 17, 260 Control Center 75, 79, 102, 112
327
delete qualifier KEEP n 131 OLDER THAN 131 TAKEN AT 131 deletion 131, 193 delta 301 disk mirroring 26 DRM 4 dsierror.log 160, 281 dsm.opt 35 dsmapipw.exe 164 dsmsched.log 283
list history 125, 189 load utility 88, 117 log file backup 30 log files 11, 18, 131, 193, 281 deletion of 131 logical volume manager (LVM) 296
Enterprise Storage Server (ESS) 31, 289 environment variable 64, 94, 156, 157 DSMI_CONFIG 158, 278 DSMI_DIR 159 DSMI_LOG 160
N
node name choosing 53 registering 149 nodegroups 17, 38 non-database files 25
F
FlashCopy 290 full database backup 28 full offline backup 171 full online backup 175
offline backup 27, 73, 74, 101, 171 command line 101 DB2 Control Center 102 on demand log archive 305 online backup 27 options file 35, 161
P
partial database backup 29 PASSWORDACCESS 164 performance 285 performance options BUFFER buff-size 286, 288 OPEN n SESSIONS 286, 288 PARALLELISM n 286, 288 WITH num-buff BUFFERS 286, 288 planning considerations 21 point in time recovery 235 policy domain 39 policyset 39, 55, 58 activation 39 active policyset 39
include-exclude 50, 72 incremental backup 29 delta 301 full 301 incremental 301 TRACKMOD 302 incremental delta 303 indexes 8 instance 16
J
journaled filesystem (JFS) 296
Q
quick start 271
328
R
RDBMS 22 recovering 265 recovery 218 point in time 235 roll-forward 218 tablespace 227 recovery history file 19 recovery points 25 redirected restore 254 Redundant Array of Inexpensive Disk (RAID) 21 Relational Database Management System (RDBMS) 7 restore 251 redirected 254 to new instance 246 roll-forward recovery 97, 98, 218 AIX 69 SUN 98 tablespace 224
S
SELECT command 121 list of backups 122 simulated incremental 30 snapshot 291 split copy 289, 296 split mirror 31, 289 clone database 292 standby database 293 target volumes 289 split mirror feature 31 stale mirrored state 298 standby database 293, 305 storage agent 307, 309, 310, 312, 313 Storage Area Network (SAN) 3 storage pool 41, 55 Sun Solaris 91 system managed space (SMS) 18
system managed space (SMS) 17 target volumes 289 TDP application clients 4 Tivoli Data Protection (TDP) 4 Tivoli Data Protection for applications 4 Tivoli Disaster Recovery Manager 4 Tivoli Space Manager 4 Tivoli Storage Management 3 Tivoli Storage Manager administrator 3 API 4 backup/archive client 5 copygroup 40 data objects 35 database backup and restore 5 DRM 4 expiration 44 HSM 4 include/exclude file 72 server 3 Tivoli Storage Manager (TSM) 19 Tivoli Storage Manager Backup-Archive client 4 Tivoli Storage Manager server DEFINE ASSOCIATION 196 DEFINE SCHEDULE 196 trace 278 TSM CONFIG 278 transaction logs 14
U
units of recovery 25 user exit 67 automatic error notification 129 return codes 282
V
verification of DB2 backups 124 db2adutl 126 db2ckbkp 124 version recovery 214
T
tables definition 7 tablespace backup 178 tablespaces 9, 17 database managed space (DMS) 17 point in time recovery 237 roll-forward recovery 224
329
330
What other subjects would you like to see IBM Redbooks address?
Please rate your overall satisfaction: Please identify yourself as belonging to one of the following groups: Your email address: The data you provide here may be used to provide you with information from IBM or our business partners about our products, services or activities. Questions about IBMs privacy policy?
O Very Good
O Good
O Average
O Customer O Business Partner O IBM, Lotus or Tivoli Employee O None of the above
O Please do not use the information collected here for future marketing or promotional contacts or other communications beyond the scope of this transaction.
The following link explains how we protect your personal information. ibm.com/privacy/yourprivacy/
331
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.