Foreword xxiii Preface xxvAcknowledgments xxxi About the Authors xxxiii Chapter 1 Introduction to DB2 1
1.1 Brief History of DB2 1
1.2 The Role of DB2 in the Information On-Demand World 4
1.3 DB2 Editions 13
1.4 DB2 Clients 20
1.5 Try-and-Buy Versions 22
1.6 Host Connectivity 23
1.7 Federation Support 23
1.8 Replication Support 24
1.9 IBM WebSphere Federation Server and WebSphere Replication Server 25
1.10 Special Package Offerings for Developers 25
1.11 DB2 Syntax Diagram Conventions 26
1.12 Case Study 28
1.13 Summary 29
1.14 Review Questions 30
Chapter 2 DB2 at a Glance: The Big Picture 33
2.1 SQL Statements, XQuery Statements, and DB2 Commands 33
2.2 DB2 Tools Overview 38
2.4 Federation 55
2.5 Case Study: The DB2 Environment 56
2.6 Database Partitioning Feature 58
2.7 Case Study: DB2 with DPF Environment 74
2.8 IBM Balanced Warehouse 79
2.9 Summary 81
2.10 Review Questions 81
Chapter 3 Installing DB2 85
3.1 DB2 Installation: The Big Picture 85
3.2 Installing DB2 Using the DB2 Setup Wizard 88
3.3 Non-Root Installation on Linux and Unix 102
3.4 Required User IDs and Groups 105
3.5 Silent Install Using a Response File 108
3.6 Advanced DB2 Installation Methods (Linux and UNIX Only) 113
3.7 Installing a DB2 License 116
3.8 Installing DB2 in a DPF Environment 118
3.9 Installing Multiple db2 Versions and Fix Packs on the Same Server 119
3.10 Installing DB2 Fix Packs 126
3.11 Migrating DB2 129
3.12 Case Study 131
3.13 Summary 133
3.14 Review Questions 134
Chapter 4 Using the DB2 Tools 137
4.1 DB2 Tools: The Big Picture 137
4.2 The Command-Line Tools 138
4.3 Web-Based Tools 157
4.4 General Administration Tools 158
4.5 Information Tools 165
4.6 Monitoring Tools 167
4.7 Setup Tools 171
4.8 Other Tools 175
4.9 Tool Settings 179
4.10 Case Study 179
4.11 Summary 184
4.12 Review Questions 185
Chapter 5 Understanding the DB2 Environment, DB2 Instances, and Databases 189
5.1 The DB2 Environment, DB2 Instances, and Databases: The Big Picture 189
5.2 The DB2 Environment 190
5.3 The DB2 Instance 198
5.4 The Database Administration Server 216
5.5 Configuring a Database 217
5.6 Instance and Database Design Considerations 224
5.7 Case Study 225
5.8 Summary 227
5.9 Review Questions 227
Chapter 6 Configuring Client and Server Connectivity 231
6.1 Client and Server Connectivity: The Big Picture 231
6.2 The DB2 Database Directories 233
6.3 Supported Connectivity Scenarios 243
6.4 Configuring Database Connections Using the Configuration Assistant 258
6.5 Diagnosing DB2 Connectivity Problems 276
6.6 Case Study 283
6.7 Summary 285
6.8 Review Questions 286
Chapter 7 Working with Database Objects 289
7.1 DB2 Database Objects: The Big Picture 289
7.2 Databases 292
7.3 Partition Groups 298
7.4 Table Spaces 299
7.5 Buffer Pools 300
7.6 Schemas 301
7.7 Data Types 302
7.8 Tables
7.9 Indexes
7.10 Multidimensional Clustering Tables and Block Indexes 347
7.11 Combining DPF, Table Partitioning, and MDC 351
7.12 Views 352
7.13 Packages 357
7.14 Triggers 358
7.15 Stored Procedures 360
7.16 User-Defined Functions 362
7.17 Sequences 364
7.18 Case Study 366
7.19 Summary 369
7.20 Review Questions 370
Chapter 8 The DB2 Storage Model 375
8.1 The DB2 Storage Model: The Big Picture 375
8.2 Databases: Logical and Physical Storage of Your Data 377
8.3 Database Partition Groups 384
8.4 Table Spaces 388
8.5 Buffer Pools 406
8.6 Case Study 410
8.7 Summary 412
8.8 Review Questions 412
Chapter 9 Leveraging the Power of SQL 417
9.1 Querying DB2 Data 418
9.2 Modifying Table Data 433
9.3 Selecting from UPDATE, DELETE, or INSERT 434
9.4 The MERGE Statement 436
9.5 Recursive SQL 437
9.6 The UNION, INTERSECT, and EXCEPT Operators 439
9.7 Case Study 441
9.8 Summary 445
9.9 Review Questions 445
Chapter 10 Mastering the DB2 pureXML Support 453
10.1 XML: The Big Picture 454
10.2 pureXML in DB2 478
10.3 Querying XML Data 486
10.4 SQL/XML Publishing Functions 507
10.5 Transforming XML Documents Using XSLT Functions 509
10.6 Inserting XML Data into a DB2 Database 509
10.7 Updating and Deleting XML Data 511
10.8 XML Indexes 514
10.9 XML Schema Support and Validation in DB2 522
10.10 Annotated XML Schema Decomposition 529
10.11 XML Performance Considerations 532
10.12 pureXML Restrictions 533
10.13 Case Study 534
10.14 Summary 538
10.15 Review Questions 538
Chapter 11 Implementing Security 543
11.1 DB2 Security Model: The Big Picture 543
11.2 Authentication 545
11.3 Data Encryption 558
11.4 Administrative Authorities 558
11.5 Database Object Privileges 565
11.6 Label-Based Access Control (LBAC) 583
11.7 Authority and Privilege Metadata 590
11.8 Windows Domain Considerations 594
11.9 Trusted Contexts Security Enhancement 596
11.10 Case Study 598
11.11 Summary 599
11.12 Review Questions 600
Chapter 12 Understanding Concurrency and Locking 603
12.1 DB2 Locking and Concurrency: The Big Picture 603
12.2 Concurrency and Locking Scenarios 604
12.3 DB2 Isolation Levels 607
12.4 Changing Isolation Levels 612
12.5 DB2 Locking 619
12.6 Diagnosing Lock Problems 630
12.7 Techniques to Avoid Locking 643
12.8 Case Study 646
12.9 Summary 647
12.10 Review Questions 647
Chapter 13 Maintaining Data 651
13.1 DB2 Data Movement Utilities: The Big Picture 651
13.2 Data Movement File Formats 653
13.3 The DB2 EXPORT Utility 654
13.4 The DB2 IMPORT Utility 667
13.5 The DB2 Load Utility 676
13.6 The DB2MOVE Utility 697
13.7 The db2relocatedb Utility 700
13.8 Generating Data Definition Language 701
13.9 DB2 Maintenance Utilities 703
13.10 Case Study 715
13.11 Summary 717
13.12 Review Questions 717
Chapter 14 Developing Database Backup and Recovery Solutions 721
14.1 Database Recovery Concepts: The Big Picture 721
14.2 DB2 Transaction Logs 725
14.3 Recovery Terminology 737
14.4 Performing Database and Table Space Backups 738
14.5 Database and Table Space Recovery Using the RESTORE DATABASE Command 746
14.6 Database and Table Space Roll Forward 754
14.7 Recovering a Dropped Table 758
14.8 The Recovery History File 760
14.9 Database Recovery Using the RECOVER DATABASE Command 762
14.10 Rebuild Database Option 764
14.11 Backup Recovery through Online Split Mirroring and Suspended I/O Support 773
14.12 Maintaining High Availability with DB2 782
14.13 The Fault Monitor 799
14.14 Case Study 801
14.15 Summary 805
Chapter 15 The DB2 Process Model 811
15.1 The DB2 Process Model: The Big Picture 811
15.2 Threaded Engine Infrastructure 814
15.3 The DB2 Engine Dispatchable Units 816
15.4 Tuning the Number of EDUs 831
15.5 Monitoring and Tuning the DB2 Agents 833
15.6 The Connection Concentrator 834
15.7 Commonly Seen DB2 Executables 835
15.8 Additional Services/Processes on Windows 836
15.9 Case Study 837
15.10 Summary 838
15.11 Review Questions 839
Chapter 16 The DB2 Memory Model 843
16.1 DB2 Memory Allocation: The Big Picture 843
16.2 Instance-Level Shared Memory 845
16.3 Database-Level Shared Memory 846
16.4 Application-Level Shared Memory 850
16.5 Agent Private Memory 853
16.6 The Memory Model 855
16.7 Case Study 857
16.8 Summary 861
16.9 Review Questions 861
Chapter 17 Database Performance Considerations 865
17.1 Relation Data Performance Fundamentals 866
17.2 System/Server Configuration 866
17.3 The DB2 Configuration Advisor 869
17.4 Configuring the DB2 Instance 877
17.5 Configuring Your Databases 879
17.6 Lack of Proper Maintenance 884
17.7 Automatic Maintenance 888
17.8 The Snapshot Monitor 890
17.9 Event Monitors 893
17.10 The DB2 Optimizer 896
17.11 The Explain Tool and Explain Tables 897
17.12 Using Visual Explain to Examine Access Plans 898
17.13 Workload Management 899
17.14 Case Study 902
17.15 Summary 905
17.16 Review Questions 905
Chapter 18 Diagnosing Problems 909
18.1 Problem Diagnosis: The Big Picture 909
18.2 How DB2 Reports Issues 909
18.3 DB2 Error Message Description 911
18.4 DB2 First Failure Data Capture 913
18.5 Receiving E-mail Notifications 919
18.6 Tools for Troubleshooting 921
18.7 Searching for Known Problems 930
18.8 Case Study 931
18.9 Summary 934
18.10 Review Questions 935
Appendix A Solutions to the Review Questions 937 Appendix B Use of Uppercase versus Lowercase in DB2 961 Appendix C IBM Servers 965 Appendix D Using the DB2 System Catalog Tables 967Resources 981
Index 987