Administration Guide
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.
Order publications through your IBM representative or the IBM branch office
serving your locality or by calling 1-800-879-2755 in U.S. or
1-800-IBM-4YOU in Canada.
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 International Business Machines Corporation 1993, 1997. 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.
Part 1. Database Design and Implementation
Chapter 1. Designing Your Logical Database
Decide What Data to Record in the Database
Define Tables for Each Type of Relationship
One-to-Many and Many-to-One Relationships
Many-to-Many Relationships
One-to-One Relationships
Provide Column Definitions for All Tables
Identify One or More Columns as a Primary Key
Identifying Candidate Key Columns
Be Sure Equal Values Represent the Same Entity
Consider Normalizing Your Tables
First Normal Form
Second Normal Form
Third Normal Form
Fourth Normal Form
Planning for Constraint Enforcement
Unique Constraints
Referential Integrity
Table Check Constraints
Triggers
Other Database Design Considerations
Chapter 2. Designing Your Physical Database
Database Physical Directories
Database Physical Files
Estimating Space Requirements for Tables
System Catalog Tables
User Table Data
Long Field Data
Large Object (LOB) Data
Index Space
Additional Space Requirements
Log File Space
Temporary Work Space
Designing Nodegroups
Nodegroup Design Considerations
Designing and Choosing Table Spaces
System Managed Space Table Space
Database Managed Space Table Space
Adding Containers to DMS Table Spaces
Table Space Design Considerations
Chapter 3. Implementing Your Design
Introductory Concepts for Database Implementation
Starting and Stopping DB2
Using Multiple Instances of the Database Manager
Organizing and Grouping Objects by Schema
Enabling Intra-Partition Parallelism
Enabling Data Partitioning
Before Creating a Database
Design Logical and Physical Database Characteristics
Create an Instance
Establish Environment Variables and the Profile Registry
DB2 Administration Server (DAS)
Create a Node Configuration File
Create a Database Configuration File
Enable FCM Communications
Creating a Database
Definition of Initial Nodegroups
Definition of Initial Table Spaces
Definition of System Catalog Tables
Definition of Database Directories
Definition of Database Recovery Log
Binding Utilities to the Database
Cataloging a Database
Creating Nodegroups
Creating a Table Space
Creating a Schema
Creating a Table
Creating a Trigger
Creating a User-Defined Function (UDF)
Creating a User-Defined Type (UDT)
Creating a View
Creating an Alias
Creating an Index
Before Altering a Database
Changing Logical and Physical Design Characteristics
Changing Environment Variables and the Profile Registry Variables
Changing the Node Configuration File
Changing the Database Configuration File
Altering a Database
Altering a Nodegroup
Dropping a Database
Altering a Table Space
Dropping a Schema
Altering a Table
Dropping a Trigger
Dropping a User-Defined Function (UDF)
Dropping a User-Defined Type
Dropping a View
Dropping an Index
Statement Dependencies When Changing Objects
Chapter 4. Controlling Database Access
An Overview of DB2 Security
Authentication
Authorization
Selecting an Authentication Method for Your Server
Authentication Considerations for Remote Clients
Partitioned Database Considerations
Using DCE Security Services to Authenticate Users
How to Setup a DB2 User for DCE
How to Setup a DB2 Server to Use DCE
How to Setup a DB2 Client Instance to Use DCE
DB2 Restrictions Using DCE Security
Privileges, Authorities, and Authorization
System Administration Authority (SYSADM)
System Control Authority (SYSCTRL)
System Maintenance Authority (SYSMAINT)
Database Administration Authority (DBADM)
Database Privileges
Schema Privileges
Table and View Privileges
Package Privileges
Index Privileges
Controlling Access to Database Objects
Granting Privileges
Revoking Privileges
Managing Implicit Authorizations by Creating and Dropping Objects
Allowing Indirect Privileges through a Package
Controlling Access to Data with Views
Tasks and Required Authorizations
Using the System Catalog
Retrieving Authorization Names with Granted Privileges
Retrieving All Names with DBADM Authority
Retrieving Names Authorized to Access a Table
Retrieving All Privileges Granted to Users
Securing the System Catalog Views
Chapter 5. Utilities for Moving Data
Using the LOAD Utility
Overview of the LOAD Process
Details About LOAD
LOAD Performance Considerations
LOAD Temporary Space Limitations
Restarting LOAD and Database Recovery
LOAD Exception Table
Checking For Constraint Violations
Using the AutoLoader Utility
Planning to Use the AutoLoader Utility
Running the AutoLoader Utility
Some Considerations with AutoLoader
Sample AutoLoader Configuration File
Loading into Multiple Database Partitions
Using the IMPORT Utility
Using IMPORT with Buffered Inserts
Import in a Client/Server Environment
Differences Between the IMPORT and LOAD Utilities
Using the EXPORT Utility
LOAD, IMPORT, and EXPORT File Formats
Delimited ASCII (DEL) File Format
Nondelimited ASCII (ASC) File Format
WSF File Format
PC/IXF File Format
Moving Data Between Systems
Moving Data Between DB2 Databases
Moving Data Using the db2move Tool
Moving Data With DB2 Connect
Using Replication to Move Your Data
Chapter 6. Recovering a Database
Overview of Recovery
Factors Affecting Recovery
Recoverable and Non-Recoverable Databases
Database Logs
Reducing Logging on Work Tables
Point of Recovery
Frequency of Backups and Time Required
Recovery Time Required
Storage Considerations
Keeping Related Data Together
Recovery Performance Considerations
Disaster Recovery Considerations
Reducing the Impact of Media Failure
Protecting Against Disk Failure
Reducing the Impact of Transaction Failure
System Clock Synchronization in a Partitioned Database System
Recovery Method: Crash Recovery
Getting to a Consistent Database
Transaction Failure Recovery in a Partitioned Database Environment
Identifying the Failed Database Partition Server
Recovery Method: Restore Recovery
Backing Up a Database
Restoring a Database
Recovery History File Information
Recovery Method: Roll-Forward Recovery
Rolling Forward Changes in a Database
ADSTAR Distributed Storage Manager
Setting up an ADSTAR Distributed Storage Manager Client for UNIX-Based Platforms
Setting up an ADSTAR Distributed Storage Manager Client for Other Platforms
Considerations for Using ADSTAR Distributed Storage Manager
Part 2. Distributed Transaction Processing
Chapter 7. Distributed Databases
Using a Single Database in a Transaction
Using Multiple Databases in a Single Transaction
Updating a Single Database
Updating Multiple Databases
Configuration Considerations
Understanding the Two-Phase Commit Process
Recovering from Problems During Two-Phase Commit
Manual Recovery of Indoubt Transactions
Resynchronizing Indoubt Transactions if AUTORESTART=OFF
Recovery of Indoubt DRDA Transactions
Recovery Using SNA Communications
Recovery Using TCP/IP Communications
Chapter 8. Using DB2 with an XA-Compliant Transaction Manager
Setting Up a Database as a Resource Manager
Database Connection Considerations
Making a Heuristic Decision
Security Considerations
Configuration Considerations
XA Interface Problem Determination
Using Encina for Transaction Processing Through TM-XA Interface
Part 3. Tuning Application Performance
Chapter 9. Application Considerations
Concurrency
Repeatable Read
Read Stability
Cursor Stability
Uncommitted Read
Choosing the Isolation Level
Specifying the Isolation Level
Locking
Attributes of Locks
Locks and Application Performance
Factors Affecting Locking
LOCK TABLE Statement
CLOSE CURSOR WITH RELEASE
Summary of Locking Considerations
Adjusting the Optimization Class
How Do You Set the Optimization Class?
How Much Optimization is Necessary?
Quickly Retrieving the First Few Rows Using OPTIMIZE FOR n ROWS
Row Blocking
Tuning Queries
Using a select-statement
Compound SQL
Performance Considerations and Character Conversion
Extended UNIX Code (EUC) Code Page Support
Stored Procedures
Activating a Database
Parallel Processing of Applications
Chapter 10. Environmental Considerations
Configuration Parameters Affecting Query Optimization
Nodegroup Impact on Query Optimization
Table Space Impact on Query Optimization
Index Management
Indexing versus No Indexing
Guidelines for Indexing
Performance Tips for Administering Indexes
Chapter 11. System Catalog Statistics
Collecting Statistics using the RUNSTATS Utility
The Database Partition Where RUNSTATS is Executed
Analyzing Statistics
Collecting and Using Distribution Statistics
Understanding Distribution Statistics
When Should You Use Distribution Statistics?
How Many Statistics Should You Keep?
How Does the Optimizer Use Distribution Statistics?
Collecting and Using Detailed Index Statistics
Understanding Detailed Index Statistics
When Should You Use Detailed Index Statistics?
User Update-Capable Catalog Statistics
Rules for Updating Catalog Statistics
Rules for Updating Table Statistics
Rules for Updating Column Statistics
Rules for Updating Distribution Statistics for Columns
Rules for Updating Index Statistics
Updating Statistics for User-Defined Functions
Modelling Production Databases
Chapter 12. Understanding the SQL Compiler
Overview of the SQL Compiler
Query Rewrite by the SQL Compiler
Operation Merging
Example - View Merges
Example - Subquery to Join Transformations
Example - Redundant Join Elimination
Example - Shared Aggregation
Operation Movement
Example - DISTINCT Elimination
Example - General Predicate Pushdown
Example - Decorrelation
Predicate Translation
Example - Addition of Implied Predicates
Example - OR to IN Transformations
Data Access Concepts and Optimization
Index Scan Concepts
Relation Scan versus Index Scan
Predicate Terminology
Join Concepts
Join Strategies in a Partitioned Database
Influence of Sorting on the Optimizer
Optimization Strategies for Intra-partition Parallelism
Parallel Scan Strategies
Parallel Sort Strategies
Parallel Temporary Tables
Parallel Join Strategies
Chapter 13. SQL Explain Facility
Choosing an Explain Tool
Using the SQL Explain Facility
Introductory Concepts for Explain
Explain Information for Data Objects
Explain Information for Data Operators
How Explain Information is Organized
Explain Instance Information
Explain Snapshot Information
Explain Table Information
Obtaining Explain Data
Capturing Explain Table Information
Capturing Explain Snapshot Information
Guidelines on Using Explain Output
Visual Explain
Part 4. Tuning and Configuring Your System
Chapter 14. Operational Performance
How DB2 Uses Memory
Setting Parameters That Affect Memory Usage
FCM Requirements
Managing the Database Buffer Pool
Managing Multiple Database Buffer Pools
Choosing One or Many Buffer Pools
Prefetching Data into the Buffer Pool
Understanding Sequential Prefetching
Prefetching and Intra-Partition Parallelism
Configuring I/O Servers for Prefetching and Parallel I/O
Enabling Parallel I/O
Allocating Multiple Pages at a Time
Sorting
Different Types of Sorting
Tuning the Parameters that Affect Sorting
Looking for Indicators of Sorting Performance Problems
Techniques for Managing Sorting Performance
Reorganizing Table Data
Performance Considerations for DMS Devices
Managing Initialization Overhead
Database Agents
Using the Database System Monitor
Extending Memory
Chapter 15. Using the Governor
Starting and Stopping the Governor
The Governor Daemon
Creating the Governor Configuration File
Governor Log Files
Querying Governor Log Files
Running the Governor and Database Manager Performance
Chapter 16. Redistributing Data Across Database Partitions
How to Partition Data
Adding and Dropping Database Partitions
Specifying a Target Partitioning Map
How Data Is Redistributed Across Database Partitions
How Data Is Redistributed in Tables
Recovering From Redistribution Errors
Data Redistribution and Other Operations
Following Data Redistribution
Chapter 17. Scaling Your Configuration
Adding Processors to a Machine
Adding Database Partitions to a System
Adding Database Partitions to a Running System
Adding Database Partitions to a Stopped System
Dropping a Database Partition from a System
Chapter 18. Benchmark Testing
Benchmark Testing Methodology
Preparing for Benchmark Testing
Creating a Benchmark Program
Executing the Benchmark Tests
Chapter 19. Configuring DB2
Tuning Configuration Parameters
Database Manager Parameters
Database Manager Configuration Parameter Summary
Database Parameters
Database Configuration Parameter Summary
Parameter Details by Function
Capacity Management
Database Shared Memory
Application Shared Memory
Agent Private Memory
Agent/Application Communication Memory
Database Manager Instance Memory
Locks
I/O and Storage
Agents
Database Application Remote Interface (DARI)
Logging and Recovery
Database Log Files
Database Log Activity
Recovery
Distributed Unit of Work Recovery
Database Management
Attributes
Status
Compiler Settings
Communications
Communication Protocol Setup
Distributed Services
DB2 Discovery
Parallel
Connection Elapse Time (conn_elapse)
Number of FCM Message Anchors (fcm_num_anchors)
Number of FCM Buffers (fcm_num_buffers)
Number of FCM Connection Entries (fcm_num_connect)
Number of FCM Request Blocks (fcm_num_rqb)
Node Connection Retries (max_connretries)
Maximum Query Degree of Parallelism (max_querydegree)
Maximum Time Difference Among Nodes (max_time_diff)
Enable Intra-Partition Parallelism (intra_parallel)
Start and Stop Timeout (start_stop_time)
Instance Management
Diagnostic
Database System Monitor Parameters
System Management
Instance Administration
Part 5. Appendixes
Appendix A. Planning Database Migration
Migration Considerations
Migration Restrictions
Security and Authorization
Storage Requirements
Release-to-Release Incompatibilities
Migrating a Database
Appendix B. Incompatibilities Between Releases
System Catalog Tables/Views
System Catalog Views
System Catalog Tables
Unique Table Identification
Application Programming
NS and NX Lock Modes
CREATE TABLE NOT LOGGED INITIALLY
DB2 Call Level Interface (DB2 CLI) Defaults
Obsolete DB2 CLI Keywords
DB2 CLI SQLSTATEs
DB2 CLI Mixing Embedded SQL, Without CONNECT RESET
DB2 CLI Use of VARCHAR FOR BIT DATA
DB2 CLI Data Conversion Values for SQLGetInfo
DB2 CLI/ODBC Configuration Keyword Defaults
Obsolete DB2 CLI/ODBC Configuration Keywords
DB2 CLI SQLSTATEs
Stored Procedure Catalog Table
PREP Command - LANGLEVEL
Change to SMALLINT Constants
Error Handling
Maximum Number of Sections in a Package
Bind Warnings
Bind Options
PREP with BINDFILE
Varchar Structures in COBOL
Incompatible APIs
Supported Level of JDBC
Calling Convention for Java Stored Procedures and UDFs
Java Runtime Environment
Obsolete System Monitor Requests for DB2 PE Version 1.2
SQL
Updating Partitioning Key Columns
Column NGNAME
Node Number Temporary Space Usage
Authorities for Create and Drop Nodegroups
Target Map in REDISTRIBUTE NODEGROUP
Node Group for Create Table
Revoking CONTROL on Tables or Views
High Level Qualifiers for Objects in DB2 Version 5
Inoperative VIEWs
Unusable VIEWs
SQLCODE Changes
WITH CHECK OPTION on CREATE VIEW
SQLSTATE Changes
FOR BIT DATA Comparisons
Code Page Conversion
Isolation Levels and Blocking All
ORDER BY Temporary Space Usage
Using Quotes in SQL Statements
Database Security and Tuning
GROUP Authorizations
Authentication Type
SYSADM Groups
Security Enhancements
Utilities and Tools
Executable Name Changes
Backup and Restore - BUFF_SIZE Parameter
Backup and Restore - Changes Only Option
Backup and Restore - User Exits
Backup and Restore - Authority
Import - IMPORT REPLACE Option
REORG - Alternate Path Option
Connectivity and Coexistence
Distributed Transaction Processing - Connect Type
Distributed Transaction Processing - SQLERRD Changes
DDCS - SQLJSETP
DDCS - DDCSSETP
DDCS - SQLJTRC.CMD
DDCS - SQLJBIND.CMD
APPC and APPN Nodes
Configuration Parameters
ADSM_PASSWORD
MAXDARI and MAXCAGENTS
LOGFILSIZ
PCKCACHEFILSIZ
APPLHEAPSZ and APP_CTL_HEAP_SZ
BUFFPAGE and Multiple Buffer Pools
NEWLOGPATH
MULTIPAGE_ALLOC
EXTENTSIZE vs SEGPAGES
LOCKLIST
BUFFPAGE and SORTHEAP
Numeric Values for Database Manager Configuration Tokens
Numeric Values for Database Manager Configuration Tokens
New Generic Out-of-Range Return Codes
Segments versus 4KB Pages
Obsolete Database Configuration Parameters
Obsolete Database Manager Configuration Parameters
Appendix C. Memory Usage for DB2 Universal Database Version 5
Appendix D. Naming Rules
Database Names
Database and Database Alias Names
User IDs and Passwords
Schema Names
Group and User Names
Object Names
Appendix E. DB2 Registry Values and Environment Variables
Appendix F. Using Distributed Computing Environment (DCE) Directory Services
Creating Directory Objects
Database Objects
Database Locator Objects
Routing Information Objects
Attributes of Each Object Class
Details About Each Attribute
Directory Services Security
Configuration Parameters and Environment Variables
CATALOG, CONNECT, and ATTACH Commands
CATALOG GLOBAL DATABASE Command
CONNECT Command
ATTACH Command
How a Client Connects to a Database
Connecting to Databases in the Same Cell
Connecting to a Database in a Different Cell
How Directories are Searched
ATTACH Command
CONNECT Command
Temporarily Overriding DCE Directory Information
Directory Services Tasks
DCE Administrator Tasks
Database Administrator Tasks
Database User Tasks
Directory Services Restrictions
Appendix G. X/Open Distributed Transaction Processing Model
Application Program (AP)
Transaction Manager (TM)
Resource Managers (RM)
XA Function Supported
XA Switch Usage
XA Open and Close Strings Usage
Making the Transacation Manager Known to the Resource Manager
Appendix H. Sample Tables
The Sample Database
To Install the Sample Database
To Erase the Sample Database
CL_SCHED Table
DEPARTMENT Table
EMPLOYEE Table
EMP_ACT Table
EMP_PHOTO Table
EMP_RESUME Table
IN_TRAY Table
ORG Table
PROJECT Table
SALES Table
STAFF Table
STAFFG Table
Sample Files with BLOB and CLOB Data Type
Quintana Photo
Quintana Resume
Nicholls Photo
Nicholls Resume
Adamson Photo
Adamson Resume
Walker Photo
Walker Resume
Appendix I. Catalog Views
Updatable Catalog Views
"Roadmap" to Catalog Views
"Roadmap" to Updatable Catalog Views
SYSCAT.BUFFERPOOLS
SYSCAT.BUFFERPOOLNODES
SYSCAT.CHECKS
SYSCAT.COLAUTH
SYSCAT.COLCHECKS
SYSCAT.COLDIST
SYSCAT.COLUMNS
SYSCAT.CONSTDEP
SYSCAT.DATATYPES
SYSCAT.DBAUTH
SYSCAT.EVENTMONITORS
SYSCAT.EVENTS
SYSCAT.FUNCPARMS
SYSCAT.FUNCTIONS
SYSCAT.INDEXAUTH
SYSCAT.INDEXES
SYSCAT.KEYCOLUSE
SYSCAT.NODEGROUPDEF
SYSCAT.NODEGROUPS
SYSCAT.PACKAGEAUTH
SYSCAT.PACKAGEDEP
SYSCAT.PACKAGES
SYSCAT.PARTITIONMAPS
SYSCAT.PROCEDURES
SYSCAT.PROCPARMS
SYSCAT.REFERENCES
SYSCAT.SCHEMAAUTH
SYSCAT.SCHEMATA
SYSCAT.STATEMENTS
SYSCAT.TABAUTH
SYSCAT.TABCONST
SYSCAT.TABLES
SYSCAT.TABLESPACES
SYSCAT.TRIGDEP
SYSCAT.TRIGGERS
SYSCAT.VIEWDEP
SYSCAT.VIEWS
SYSSTAT.COLDIST
SYSSTAT.COLUMNS
SYSSTAT.FUNCTIONS
SYSSTAT.INDEXES
SYSSTAT.TABLES
Appendix J. User Exit for Database Recovery
Overview for OS/2
Overview for UNIX-Based Operating Systems
Invoking a User Exit Program
Sample User Exit Programs
Sample User Exit Programs for OS/2
Sample User Exit Programs for UNIX-Based Operating Systems
Calling Format
Calling Format for OS/2
Calling Format for UNIX-Based or Windows NT Operating Systems
Archive and Retrieve Considerations
Backup and Restore Considerations (DB2 for OS/2 only)
Error Handling
Appendix K. Explain Tables and Definitions
EXPLAIN_ARGUMENT Table
EXPLAIN_INSTANCE Table
EXPLAIN_OBJECT Table
EXPLAIN_OPERATOR Table
EXPLAIN_PREDICATE Table
EXPLAIN_STATEMENT Table
EXPLAIN_STREAM Table
Table Definitions for Explain Tables
EXPLAIN_ARGUMENT Table Definition
EXPLAIN_INSTANCE Table Definition
EXPLAIN_OBJECT Table Definition
EXPLAIN_OPERATOR Table Definition
EXPLAIN_PREDICATE Table Definition
EXPLAIN_STATEMENT Table Definition
EXPLAIN_STREAM Table Definition
Appendix L. SQL Explain Tools (db2expln and dynexpln)
Running db2expln and dynexpln
Syntax for db2expln
Usage Notes for db2expln
Syntax for dynexpln
Usage Notes for dynexpln
Description of db2expln and dynexpln Output
Table Access
Temporary Tables
Joins
Data Streams
Insert, Update, and Delete
Row Identifier (RID) Preparation
Aggregation
Parallel Processing
Miscellaneous Statements
Examples of db2expln and dynxpln Output
Example One: "No Parallelism" Plan
Example Two: Non-Partitioned Parallel Plan
Example Three: Partitioned Database Plan
Appendix M. National Language Support (NLS)
Deriving Code Page Values
Deriving Locales in Application Programs
How DB2 Derives Locales
Country Code and Code Page Support
Character Sets
DBCS Character Sets
Character Set for Identifiers
Coding of SQL Statements
Collating Sequences
Overview
Specifying a Collating Sequence
Datetime Values
Date
Time
Timestamp
String Representations of Datetime Values
Date Strings
Time Strings
Timestamp Strings
MBCS Considerations
Appendix N. Splitting Data with db2split
Using db2split
Populating a Table in a New Table Space
Populating a Table in an Existing Table Space
db2split Parameters
Example Data File for db2split
Getting a Partitioning Map with db2gpmap
Running db2split
db2split Header Information
Appendix O. Supplemental AutoLoader Information
Introduction
Files
Setup for AutoLoader
Usage
Hints and Tips
Troubleshooting
Appendix P. Issuing Commands to Multiple Database Partitions
Commands
Defining synonyms
Specifying the Command to be Run
Running Commands in Parallel
Monitoring rah Processes
Prefix Sequences
Specifying the List of Hosts
Eliminating Duplicate Entries from the Host List
Controlling the Shell Script
$RAHDOTFILES
Determining problems with rah:
Appendix Q. Supporting High Availability Cluster Multi-Processing Configurations
Hot Standby
Examples
Mutual Takeover
Examples
Additional HACMP Resources
Appendix R. Notices
Trademarks
Trademarks of Other Companies
Index
[ Top of Page | Previous Page | Next Page | Table of Contents | Index ]
[ DB2 List of Books |
Search the DB2 Books ]