Sei sulla pagina 1di 737
IBM DB2 10.1 for Linux, UNIX, and Windows Preparation Guide for DB2 10.1 Advanced DBA

IBM DB2 10.1 for Linux, UNIX, and Windows

Preparation Guide for DB2 10.1 Advanced DBA for Linux, UNIX, and Windows Exam 614

Updated September, 2014

SC27-5574-00

IBM DB2 10.1 for Linux, UNIX, and Windows Preparation Guide for DB2 10.1 Advanced DBA

IBM DB2 10.1 for Linux, UNIX, and Windows

Preparation Guide for DB2 10.1 Advanced DBA for Linux, UNIX, and Windows Exam 614

Updated September, 2014

SC27-5574-00

Note Before using this information and the product it supports, read the general information under

Note Before using this information and the product it supports, read the general information under Appendix B, “Notices,” on page 705.

this information and the product it supports, read the general information under Appendix B, “Notices,” on

Edition Notice

This document contains proprietary information of IBM. It is provided under a license agreement and is protected by copyright law. The information contained in this publication does not include any product warranties, and any statements provided in this manual should not be interpreted as such.

You can order IBM publications online or through your local IBM representative.

v

To order publications online, go to the IBM Publications Center at http://www.ibm.com/shop/publications/ order

v

To find your local IBM representative, go to the IBM Directory of Worldwide Contacts at http://www.ibm.com/ planetwide/

To order DB2 publications from DB2 Marketing and Sales in the United States or Canada, call 1-800-IBM-4YOU

(426-4968).

When you send information to IBM, you grant IBM a nonexclusive right to use or distribute the information in any way it believes appropriate without incurring any obligation to you.

© Copyright IBM Corporation 2014. US Government Users Restricted Rights – Use, duplication or disclosure restricted by GSA ADP Schedule Contract with IBM Corp.

Contents

About this book .

.

.

.

.

.

.

.

.

.

.

ix

Part 1. Database design .

 

.

.

.

.

.

.1

Chapter 1. Automatic storage

 

.

.

.

.

.3

Databases use automatic storage by default

 

.4

Chapter 2. Table spaces .

 

.

.

.

.

.

.

.5

Table spaces for system, user and temporary data .

.

7

. Automatic storage table spaces .

Types of table spaces

.

.

.

 

.

.

.

.

.

.

.

.

.

.

.

.

.8

.9

How automatic storage table spaces manage

. Container names in automatic storage table .

storage expansion

.

.

.

.

.

.

.

.

.

.

.

.

.

spaces

.

.

.

.

.

.

.9

. 11

Converting table spaces to use automatic storage 13

The table space high water mark .

.

.

.

.

.

. 14

. File system caching configurations

Reclaimable storage

.

.

.

.

.

.

.

.

.

.

.

.

.

. 16

. 22

.

.

.

.

.

.

. 24

Extent sizes in table spaces Page, table and table space size

. Disk I/O efficiency and table space design .

.

.

.

.

.

.

. 25

. 26

Table spaces in a partitioned database environment 28

. Creating temporary table spaces

Defining initial table spaces on database creation 33

Creating table spaces

. 32

. 28

.

.

.

.

.

.

.

.

.

.

.

.

Altering automatic storage table spaces .

.

.

.

. 34

Reclaiming unused storage in automatic storage

table spaces

 

.

.

.

.

.

.

.

.

.

.

. 35

Scenarios: Adding and removing storage with

 

automatic storage table spaces

 

.

.

.

.

. 37

Monitoring a table space rebalance operation .

 

.

. 44

Table space states .

 

.

.

.

.

.

.

.

.

.

.

. 44

Switching table spaces from offline to online .

 

.

. 53

Dropping table spaces

 

.

.

.

.

.

.

.

.

. 53

Chapter 3. Buffer pools

.

.

.

.

.

.

.

55

Designing buffer pools

 

.

.

.

.

.

.

.

.

.

. 56

Buffer pool hit ratios .

.

.

.

.

.

.

.

.

.

. 57

Buffer pool memory protection (AIX running on

 

POWER6) .

.

.

.

.

.

.

.

.

.

.

.

.

.

. 57

Buffer pool monitoring in a DB2 pureScale

 

environment

.

.

.

.

.

.

.

.

.

.

.

. 58

Buffer pool hit rates and hit ratios in a DB2

 

pureScale environment

 

.

.

.

.

.

.

.

.

.

. 59

Formulas for calculating buffer pool hit ratios . Calculating buffer pool hit ratios in a DB2

 

. 61

pureScale environment

 

.

.

.

.

.

.

.

.

. 62

Creating buffer pools .

.

.

.

.

.

.

.

.

.

. 65

Modifying buffer pools

.

.

.

.

.

.

.

.

.

. 66

Dropping buffer pools

.

.

.

.

.

.

.

.

. 67

Chapter 4. Storage groups .

 

.

.

.

.

.

69

Default storage groups

 

.

.

.

.

.

.

.

.

.

. 69

Storage group and table space media attributes .

. 70

Creating storage groups .

.

.

.

.

.

.

.

.

.

.

.

.

.

.

.

.

.

.

.

.

.

.

.

.

.

.

.

.

.

.

.

.

.

.

. 71

Altering storage groups .

.

. 72

Adding storage paths .

Dropping storage paths .

.

.

. 72

. 73

Monitoring storage paths .

.

. 74

Replacing the paths of a storage group .

.

.

. 75

Renaming storage groups . Dropping storage groups .

. Scenario: Moving a table space to a new storage .

group .

. Associating a table space to a storage group

.

.

.

.

.

.

.

.

.

.

.

.

.

.

.

.

.

.

.

.

.

.

.

.

.

.

.

.

.

. 75

. 76

. 77

. 77

Chapter 5. Multi-temperature storage

79

Chapter 6. IBM Data Studio .

.

.

.

.

.

83

Using IBM Data Studio for key tasks .

.

.

.

.

. 83

. IBM Data Studio web console .

IBM Data Studio client

.

.

. Database administration with IBM Data Studio

.

.

.

.

.

.

.

 

.

.

.

. 85

. 88

. 89

Administering databases with task assistants . Database administration commands that you can

run from task assistants .

.

.

.

.

.

.

. 91

. 96

. Managing jobs in IBM Data Studio . Creating and managing jobs

.

.

.

.

.

.

. 100

.

.

. 102

.

.

. 102

Scenario: Creating and scheduling a job Importing tasks from DB2 Task Center .

. Diagramming access plans with Visual Explain .

.

 

. 104

. 105

Diagrams of access plans

.

.

.

.

.

.

.

. 108

. Setting preferences for Visual Explain .

Query blocks

.

.

.

.

.

.

.

.

.

.

.

.

. 108

. 109

Part 2. Data partitioning and

clustering

.

.

.

.

.

.

.

.

.

.

.

.

111

Chapter 7. Partitioned database

environments

.

.

.

.

.

.

.

.

.

.

.

117

Database partitioning across multiple database

. Database partition groups .

partitions

.

.

.

.

.

.

.

.

.

.

.

.

.

.

.

.

.

.

.

. 118

. 119

Distribution maps

.

.

.

.

.

.

. 122

Distribution keys .

.

.

.

.

.

.

.

.

.

.

.

.

. 123

. 124

Table collocation Partition compatibility .

. Setting up partitioned database environments

.

.

.

.

.

.

.

. 124

. 125

Adding database partition servers to an instance

. Setting up multiple logical partitions

(Windows)

.

. Configuring multiple logical partitions .

.

.

.

. Enabling inter-partition query parallelism .

. Enabling intrapartition parallelism for queries

.

.

.

.

.

.

. 127

. 128

. 128

. 129

131

Adding database partitions in partitioned database

environments

.

.

.

.

.

.

.

.

.

.

. 134

Adding an online database partition

. 135

Restrictions when working online to add a

Logging considerations for MDC and ITC tables 205

database partition

 

.

.

.

.

.

.

.

.

. 136

Adding a database partition offline (Linux and

. Adding a database partition offline (Windows)

UNIX) .

.

.

.

.

.

.

.

.

.

.

.

.

. 136

138

Error recovery when adding database partitions Enabling communication between database

139

partitions using FCM communications .

 

.

.

.

. 140

Managing database partitions

 

.

.

.

.

.

. 141

Listing database partition servers in an instance

(Windows)

.

.

.

.

.

.

.

.

.

.

. 142

Eliminating duplicate entries from a list of machines in a partitioned database environment. 142 Specifying the list of machines in a partitioned

database environment

.

.

.

.

.

.

.

.

. 143

Changing the database configuration across

multiple database partitions

.

.

.

.

.

.

. 144

Adding containers to SMS table spaces on

. Using database partition expressions .

database partitions

.

.

.

.

.

.

.

.

.

. 144

. 144

. Changing database partitions (Windows) .

.

. 146

Redistributing data in a database partition .

group

.

.

.

.

.

.

.

.

.

.

.

. 148

Issuing commands in partitioned database

. Dropping database partitions .

environments

.

. Tables in partitioned database environments .

.

.

.

.

.

.

.

.

.

.

.

. 148

. 159

. 160

Redistributing data across database partitions .

. 162

Data redistribution

.

.

.

.

.

.

.

.

.

. 162

Determining if data redistribution is needed .

. 165

Prerequisites for data redistribution .

.

.

.

.

.

.

. 166

Restrictions on data redistribution .

.

. 168

Best practices for data redistribution

.

. 170

Data redistribution mechanism

.

.

.

.

.

. 171

Redistributing data across database partitions by using the REDISTRIBUTE DATABASE PARTITION GROUP command Redistributing database partition groups using the STEPWISE_REDISTRIBUTE_DBPG

.

.

.

. 172

procedure

.

.

.

.

.

.

.

.

.

.

.

.

. 173

Monitoring a data redistribution operation .

. 175

Redistribution event log files

 

.

.

.

.

. 176

Scenario: Redistributing data in new database

partitions .

.

.

.

.

.

.

.

.

.

.

.

.

. 180

Chapter 8. Multidimensional clustering

tables.

.

.

.

.

.

.

.

.

.

.

.

.

.

.

185

New insert time clustering tables

.

 

.

.

.

. 185

Comparison of regular and MDC tables

.

.

.

. 185

Block indexes for MDC tables

.

.

.

.

.

. 187

Block indexes and query performance for MDC

tables .

.

.

.

.

.

.

.

.

.

.

.

.

.

. 189

Maintaining clustering automatically during

INSERT operations

.

.

.

.

.

.

.

.

.

. 193

Block maps for MDC and ITC tables .

.

.

.

. 195

Updates to MDC and ITC tables

.

.

.

.

. 197

Deleting from MDC and ITC tables .

.

.

.

.

. 197

Multidimensional and insert time clustering extent

management

.

.

.

.

.

.

.

.

.

.

.

. 198

. Creating MDC or ITC tables

.

.

.

.

.

.

.

. 198

Load for MDC and ITC tables

.

.

.

.

.

. 204

Block indexes for MDC and ITC tables .

.

.

. 205

Choosing MDC table dimensions

Scenario: MDC tables .

.

.

.

.

.

.

.

.

.

.

.

.

.

.

.

.

. 206

. 213

Scenario: Creating an ITC table

.

.

. 216

Scenario: Converting an existing table to an ITC

 

table .

.

.

.

.

.

.

.

.

.

.

.

.

.

.

. 216

Chapter 9. Partitioned tables .

.

.

.

.

217

Table partitioning keys .

.

.

.

.

.

.

.

.

. 217

Table partitioning and multidimensional clustering

tables .

.

.

.

.

.

.

.

.

.

.

.

.

.

.

. 219

Optimization strategies for partitioned tables Partitioned materialized query table (MQT)

 

. 224

behavior

.

.

.

.

.

.

.

.

.

.

. 229

Large object behavior in partitioned tables

.

. 232

Data partitions and ranges .

.

.

.

.

.

.

.

. 233

Adding data partitions to partitioned tables .

 

. 234

Attaching data partitions

.

.

.

.

.

.

.

.

.

.

.

.

.

.

.

.

.

.

.

.

.

.

. 236

Detaching data partitions

.

.

. 246

Dropping data partitions

.

.

. 255

Creating partitioned tables .

Defining ranges on partitioned tables .

.

.

.

.

. 256

. 257

Placement of the data, index and long data of a

data partition

.

.

.

.

.

.

.

.

.

.

.

.

. 260

Altering partitioned tables .

.

.

. 261

Guidelines and restrictions on altering

partitioned tables

.

.

.

.

.

.

. 262

Special considerations for XML indexes when altering a table to ADD, ATTACH, or DETACH

. Scenario: Rotating data in a partitioned table

a partition .

.

.

.

.

.

.

.

.

.

.

. 264

265

Scenarios: Rolling in and rolling out partitioned

table data

.

.

.

.

.

.

.

.

.

.

.

.

. 267

Migrating existing tables and views to partitioned

. Converting existing indexes to partitioned indexes

tables .

.

.

.

.

.

.

.

.

.

.

.

.

.

. 270

272

Chapter 10. Range-clustered tables

275

Guidelines for using range-clustered tables Scenarios: Range-clustered tables Restrictions on range-clustered tables

 

.

.

. 276

 

276

277

Part 3. High Availability and

 

Diagnostics

.

.

.

.

.

.

.

.

.

.

.

279

Chapter 11. Developing a backup and

recovery strategy.

.

.

.

.

.

.

.

.

.

281

Database logging

.

.

.

.

.

.

.

.

.

.

.

.

.

.

.

.

.

.

.

.

.

.

.

.

.

.

. 283

Circular logging

.

.

.

.

. 284

Archive logging

.

.

.

.

. 285

Log control files

.

.

.

.

. 286

.

.

.

.

. 286

Storage considerations for recovery Archived log file compression

. Backup and restore operations between different operating systems and hardware platforms

.

.

.

. 287

. 288

Log stream merging and log file management in a

DB2 pureScale environment

.

.

.

.

.

.

.

. 289

Log sequence numbers in DB2 pureScale

. Including log files with a backup image Incremental backup and recovery

environments

.

.

.

.

.

.

.

.

.

.

.

.

.

.

. 293

. 293

. 295

Restoring from incremental backup images

Limitations to automatic incremental restore .

. 296

. 298

Chapter 12. Backing up databases

301

. Using a split mirror as a backup image

Performing a snapshot backup

.

.

.

.

.

.

.

. 303

. 304

Using a split mirror as a backup image in a DB2

 

pureScale environment .

.

.

.

.

.

.

.

.

. 305

. Backing up to named pipes

Backing up to tape

.

.

.

.

.

.

.

.

.

.

.

.

.

.

.

. 306

. 308

Backing up partitioned databases

.

.

.

.

. 309

Backup and restore operations in a DB2 pureScale

environment .

.

.

.

.

.

.

.

.

.

.

.

. 310

. Enabling automatic backup

.

.

.

.

.

.

. 315

Configuring an automated maintenance policy using SYSPROC.AUTOMAINT_SET_POLICY or SYSPROC.AUTOMAINT_SET_POLICYFILE

316

.

.

.

.

.

. 317

Monitoring backup operations Optimizing backup performance .

. Compatibility of online backup and other utilities 318

. 317

.

.

.

.

Chapter 13. Recovering databases

321

Optimizing recovery performance

.

.

.

.

.

. 321

Recovering data using db2adutl .

.

.

.

.

.

. 323

Recovering a dropped table

.

.

.

.

.

.

.

. 336

Chapter 14. Restoring databases .

.

.

339

Restoring from a snapshot backup image

.

. 341

Using incremental restore in a test and production

environment .

.

.

.

.

.

.

.

.

.

.

.

. 342

. Performing a redirected restore operation .

.

.

. 344

Redefine table space containers by restoring a database using an automatically generated

script .

.

.

.

.

.

.

.

.

.

.

.

.

.

. 348

Performing a redirected restore using an

automatically generated script

.

.

.

.

. 350

Cloning a production database using different

storage group paths .

.

.

.

.

.

.

.

.

. 351

Database rebuild

. Database rebuild and table space containers .

.

.

.

.

.

.

.

.

Rebuilding selected table spaces

.

.

.

.

.

.

.

.

.

.

.

.

.

. 352

. 356

Database rebuild and temporary table spaces

357

Choosing a target image for database rebuild

357

. 361

Rebuild and incremental backup images .

. 362

Rebuilding partitioned databases Restrictions for database rebuild . Rebuild sessions - CLP examples .

. 363

. 364

. 365

Transporting database schemas

.

.

.

.

.

.

.

.

. 373

Transportable objects

. 375

Transport examples Troubleshooting: transporting schemas

.

.

. 377

379

Monitoring the progress of restore operations .

. 380

Optimizing restore performance

.

.

.

.

. 380

Chapter 15. Rolling forward databases 383

Rollforward sessions - CLP examples

.

.

. 384

Rolling forward changes in a table space . Database rollforward operations in a DB2

 

.

.

. 388

pureScale environment

.

.

.

.

.

.

. 392

Monitoring a rollforward operation

.

.

.

.

. 394

Chapter 16. DB2 Workload Manager

 

(WLM)

.

.

.

.

.

.

.

.

.

.

.

.

.

.

397

Workload management concepts

 

.

.

. 397

Phases of workload management

.

.

.

.

. 397

Frequently asked questions about DB2 workload

 

management

.

.

.

.

.

.

.

.

.

.

.

.

. 399

Integration of AIX Workload Manager with DB2

 

workload management

.

.

.

.

.

. 409

Integration of Linux workload management with

DB2 workload management

.

.

.

.

.

.

. 414

. Workload management sample application

 

.

.

. 420

Workload management scenarios

.

.

. 420

Scenario: Investigating a workload-related

 

system slowdown

.

.

.

.

.

.

. 420

Scenario: Identifying activities that are taking

 

too long to complete .

.

.

.

.

.

.

.

.

. 421

Scenario: How to cancel activities queued for

 

more than an hour

.

.

.

.

.

.

.

.

.

. 424

Scenario: Moving table spaces to different

 

.

.

.

.

.

.

.

. 427

storage devices Additional scenarios .

. DB2 workload management tutorial .

.

.

.

.

.

.

.

.

.

.

.

. 428

. 428

Chapter 17. High availability disaster

 

recovery (HADR) .

.

.

.

.

.

.

.

.

.

429

High Availability Disaster Recovery (HADR)

synchronization mode

.

.

.

.

.

.

.

 

.

. 431

. HADR multiple standby databases .

.

.

.

.

. 435

Restrictions for multiple standby databases

.

. 436

Initializing HADR in multiple standby mode Enabling multiple standby mode on a

436

preexisting HADR setup .

.

.

.

.

.

.

.

. 438

Modifications to a multiple standby database

 

setup .

.

.

.

.

.

.

.

.

.

.

.

.

.

. 440

Database configuration for multiple HADR

 

standby databases .

.

.

.

.

.

.

.

.

.

. 441

Rolling upgrades in HADR multiple standby

 

. High availability disaster recovery (HADR) monitoring in multiple standby mode

mode .

.

.

.

.

.

.

.

.

.

.

.

 

.

. 443

. 444

Takeover in HADR multiple standby mode .

 

. 447

Scenario: Deploying an HADR multiple standby

database setup

.

.

.

.

.

.

.

. 448

Examples: Takeover in HADR multiple standby

mode .

.

.

.

.

.

.

.

.

.

.

.

.

. 453

. HADR reads on standby feature .

.

.

.

.

.

.

. 458

Enabling reads on standby

.

.

.

.

. 458

Data concurrency on the active standby

 

.

.

.

.

.

.

.

.

.

. 459

database HADR delayed replay

. Recovering data by using HADR delayed replay 464 Performing rolling updates in a DB2 High Availability Disaster Recovery (HADR)

. 463

.

.

.

.

.

.

.

.

environment

.

.

.

.

.

.

.

.

.

. 466

High availability disaster recovery (HADR)

support .

.

.

.

.

.

.

.

.

.

.

.

.

.

. 469

System requirements for DB2 high availability

. Installation and storage requirements for high availability disaster recovery (HADR)

disaster recovery (HADR)

.

.

.

.

. 469

. 471

HADR and Network Address Translation (NAT)

support .

.

.

.

.

.

.

.

.

.

.

.

.

. 472

Restrictions for High Availability Disaster

 

Recovery (HADR)

.

.

.

.

.

.

.

.

. 473

DB2 High availability disaster recovery (HADR)

 

management

.

.

.

.

.

.

.

.

.

.

.

.

. 474

DB2 High Availability Disaster Recovery

 

(HADR) commands

.

.

.

.

.

.

.

. 475

Initializing high availability disaster recovery

. Initializing a standby database

(HADR) .

.

.

.

.

.

.

.

.

.

.

.

.

.

.

.

.

.

. 477

. 479

. Using a split mirror as a standby database

.

. 480

Using a split mirror as a standby database in a

DB2 pureScale environment

.

.

.

.

.

.

. 482

Database configuration for high availability

 

disaster recovery (HADR) Setting the hadr_timeout and

.

.

.

.

.

.

. 485

hadr_peer_window database configuration

 

parameters

<