Unleashing DB2 10 for Linux, UNIX, and Windows

Front cover IBM? Information Management Software

Unleashing DB2 10 for Linux, UNIX, and Windows

Discover storage and availability features that enable faster business decisions Simplify application development and portability Explore real-world examples to launch your DB2 10 experience

redbooks

Danny Arnold Steve Diniro Vivian Lee Stan Musker

Jo-Ann Woods

International Technical Support Organization Unleashing DB2 10 for Linux, UNIX, and Windows August 2012

SG24-8032-00

Note: Before using this information and the product it supports, read the information in "Notices" on page vii.

First Edition (August 2012) This edition applies to Version 10, Release 1 of DB2 for Linux, UNIX, and Windows. ? Copyright International Business Machines Corporation 2012. All rights reserved. Note to U.S. Government Users Restricted Rights -- Use, duplication or disclosure restricted by GSA ADP Schedule Contract with IBM Corp.

Contents

Notices . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . vii Trademarks . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . viii

Preface . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . ix The team who wrote this book . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . x Now you can become a published author, too! . . . . . . . . . . . . . . . . . . . . . . . . . xi Comments welcome. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . xi Stay connected to IBM Redbooks . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . xii

Chapter 1. Introduction to DB2 10 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1 1.1 Purpose of this book . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 2 1.2 Introduction to DB2 10. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 3 1.3 Company overview: Great Toque Outdoors . . . . . . . . . . . . . . . . . . . . . . . . 5

Chapter 2. Time Travel Query. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 7 2.1 Overview of Time Travel Query. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 8 2.2 Business value . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 8 2.3 Business application examples . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 9

2.3.1 Time Travel Query description and usage . . . . . . . . . . . . . . . . . . . . 10 2.3.2 Adding the Time Travel Query to a DB2 10 database . . . . . . . . . . . 14 2.4 Summary . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 34

Chapter 3. Adaptive compression . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 35 3.1 Overview of adaptive compression . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 36 3.2 Business value . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 36 3.3 Business application examples . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 39

3.3.1 Creating new tables with adaptive compression . . . . . . . . . . . . . . . . 40 3.3.2 Identifying candidate tables for adaptive compression . . . . . . . . . . . 42 3.3.3 Converting existing tables to use adaptive compression . . . . . . . . . 45 3.3.4 Monitoring compression ratios and optionally performing a table

reorganization . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 46 3.4 Summary . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 48

Chapter 4. Multi-temperature storage . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 49 4.1 Overview of multi-temperature storage . . . . . . . . . . . . . . . . . . . . . . . . . . . 50 4.2 Business value . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 50 4.3 Business application examples . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 52

4.3.1 Multi-temperature storage description and usage . . . . . . . . . . . . . . . 52 4.3.2 Adding multi-temperature storage to a DB2 10 database . . . . . . . . . 54

? Copyright IBM Corp. 2012. All rights reserved.

iii

4.4 Summary . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 64

Chapter 5. Row and column access control . . . . . . . . . . . . . . . . . . . . . . . . 65 5.1 Overview of RCAC . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 66 5.2 Business value . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 66 5.3 Business application examples . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 68

5.3.1 Row and column access control description and usage . . . . . . . . . . 68 5.3.2 Adding row and column access control to a DB2 10 database . . . . . 70 5.4 Summary . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 85

Chapter 6. Availability enhancements . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 87 6.1 HADR multiple standby databases . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 88

6.1.1 Business value . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 89 6.1.2 Business application examples . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 91 6.1.3 Summary . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 98 6.2 Continuous availability with DB2 pureScale Feature. . . . . . . . . . . . . . . . . 98 6.2.1 Business value . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 99 6.2.2 Business application examples . . . . . . . . . . . . . . . . . . . . . . . . . . . . 100 6.2.3 Summary . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 101

Chapter 7. Oracle compatibility . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 103 7.1 Overview of Oracle compatibility . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 104 7.2 Business value . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 104 7.3 Business application examples . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 105

7.3.1 Concurrency control . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 105 7.3.2 Data types . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 106 7.3.3 Implicit casting. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 107 7.3.4 Built-in functions . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 108 7.3.5 Oracle SQL support . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 111 7.3.6 PL/SQL support. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 113 7.3.7 Built-in packages. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 117 7.4 Enabling compatibility . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 118 7.5 Summary . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 119

Chapter 8. Ingest utility. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 121 8.1 Overview of the ingest utility . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 122 8.2 Business value . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 123 8.3 Business application examples . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 125

8.3.1 Preparation: Design and test INGEST command . . . . . . . . . . . . . . 125 8.3.2 Preparation: Install a client and prepare the environment. . . . . . . . 129 8.3.3 Implementation . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 130 8.3.4 Post-implementation . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 130 8.4 Summary . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 134

iv Unleashing DB2 10 for Linux, UNIX, and Windows

Appendix A. Ingest utility script . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 135 Introduction to the ingest utility script . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 136 The ingest_files.sh script . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 136 Related publications . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 143 IBM Redbooks publications . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 143 Other publications . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 143 Online resources . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 144 Help from IBM . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 144

Contents v

vi Unleashing DB2 10 for Linux, UNIX, and Windows

................
................

In order to avoid copyright disputes, this page is only a partial summary.

Google Online Preview   Download