db2version 9.1 for z/os - s.k. consulting v9 administration manual_dsnagk13.pdf · adding the saf...

1063
DB2 Version 9.1 for z/OS Administration Guide SC18-9840-03

Upload: others

Post on 02-Jan-2020

11 views

Category:

Documents


0 download

TRANSCRIPT

  • DB2 Version 9.1 for z/OS

    Administration Guide

    SC18-9840-03

    ���

  • DB2 Version 9.1 for z/OS

    Administration Guide

    SC18-9840-03

    ���

  • NoteBefore using this information and the product it supports, be sure to read the general information under “Notices” at theend of this information.

    Fourth edition (December 2008)

    This edition applies to DB2 Version 9.1 for z/OS (DB2 V9.1 for z/OS), product number 5635-DB2, and to anysubsequent releases until otherwise indicated in new editions. Make sure you are using the correct edition for thelevel of the product.

    Specific changes are indicated by a vertical bar to the left of a change. A vertical bar to the left of a figure captionindicates that the figure has changed. Editorial changes that have no technical significance are not noted.

    © Copyright International Business Machines Corporation 1982, 2008.US Government Users Restricted Rights – Use, duplication or disclosure restricted by GSA ADP Schedule Contractwith IBM Corp.

  • Contents

    About this information . . . . . . . . . . . . . . . . . . . . . . . . . . . . xviiWho should read this information . . . . . . . . . . . . . . . . . . . . . . . . . . . xviiDB2 Utilities Suite . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . xviiTerminology and citations . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . xviiiAccessibility features for DB2 Version 9.1 for z/OS . . . . . . . . . . . . . . . . . . . . . xviiiHow to send your comments . . . . . . . . . . . . . . . . . . . . . . . . . . . . . xixHow to read syntax diagrams . . . . . . . . . . . . . . . . . . . . . . . . . . . . . xix

    Part 1. Designing a database . . . . . . . . . . . . . . . . . . . . . . . . . 1

    Chapter 1. Database objects and relationships . . . . . . . . . . . . . . . . . . . 3Logical database design with the entity-relationship model . . . . . . . . . . . . . . . . . . . . 3

    Modeling your data . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 3Recommendations for logical data modeling . . . . . . . . . . . . . . . . . . . . . . . . 5Practical examples of data modeling . . . . . . . . . . . . . . . . . . . . . . . . . . 5Entities for different types of relationships . . . . . . . . . . . . . . . . . . . . . . . . 5Entity attributes . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 7Entity normalization . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 9

    Logical database design with Unified Modeling Language. . . . . . . . . . . . . . . . . . . . 13Physical database design . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 15

    Denormalization of tables . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 15Views as a way to customize what data users see . . . . . . . . . . . . . . . . . . . . . 17Indexes on table columns. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 18

    Chapter 2. Implementing your database design . . . . . . . . . . . . . . . . . . 19Implementing DB2 databases . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 19

    Creating DB2 databases . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 19Dropping DB2 databases . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 20

    Implementing DB2 storage groups. . . . . . . . . . . . . . . . . . . . . . . . . . . . 20Advantages of storage groups . . . . . . . . . . . . . . . . . . . . . . . . . . . . 20Creating DB2 storage groups . . . . . . . . . . . . . . . . . . . . . . . . . . . . 22Enabling SMS to control DB2 storage groups . . . . . . . . . . . . . . . . . . . . . . . 22Deferring allocation of DB2-managed data sets . . . . . . . . . . . . . . . . . . . . . . 22How DB2 extends data sets . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 23DB2 space allocation . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 24Managing DB2 data sets with DFSMShsm . . . . . . . . . . . . . . . . . . . . . . . . 28Managing your own data sets . . . . . . . . . . . . . . . . . . . . . . . . . . . . 32Defining index space storage . . . . . . . . . . . . . . . . . . . . . . . . . . . . 35Creating EA-enabled table spaces and index spaces . . . . . . . . . . . . . . . . . . . . . 36

    Implementing DB2 table spaces. . . . . . . . . . . . . . . . . . . . . . . . . . . . . 37Creating a table space explicitly . . . . . . . . . . . . . . . . . . . . . . . . . . . 37Guidelines and recommendations for table spaces . . . . . . . . . . . . . . . . . . . . . 38Examples of table space definitions . . . . . . . . . . . . . . . . . . . . . . . . . . 45

    Implementing DB2 tables . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 47Creating base tables . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 47Guidelines for table names . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 48Creating temporary tables . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 48Creating materialized query tables. . . . . . . . . . . . . . . . . . . . . . . . . . . 52Creating tables that use table-controlled partitioning. . . . . . . . . . . . . . . . . . . . . 53Creating tables that use index-controlled partitioning . . . . . . . . . . . . . . . . . . . . 56Creating a clone table . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 56

    Implementing DB2 views . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 57Creating DB2 views . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 57Guidelines for view names . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 59

    © Copyright IBM Corp. 1982, 2008 iii

    ||

  • How DB2 inserts and updates data through views . . . . . . . . . . . . . . . . . . . . . 59Dropping DB2 views . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 60

    Implementing DB2 indexes . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 60Creating DB2 indexes . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 60Guidelines for defining indexes. . . . . . . . . . . . . . . . . . . . . . . . . . . . 60How DB2 implicitly creates an index . . . . . . . . . . . . . . . . . . . . . . . . . . 62Recommendations for index page size . . . . . . . . . . . . . . . . . . . . . . . . . 62Index versions . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 63Compressing indexes . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 64

    Implementing DB2 schemas . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 65Creating a schema by using the schema processor . . . . . . . . . . . . . . . . . . . . . 65Processing schema definitions . . . . . . . . . . . . . . . . . . . . . . . . . . . . 66

    Loading data into DB2 tables . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 66Loading data with the LOAD utility . . . . . . . . . . . . . . . . . . . . . . . . . . 67Loading data by using the INSERT SQL statement . . . . . . . . . . . . . . . . . . . . . 70Loading data from DL/I . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 72

    Implementing DB2 stored procedures. . . . . . . . . . . . . . . . . . . . . . . . . . . 72Creating stored procedures . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 72Deleting stored procedures . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 72

    Implementing DB2 user-defined functions . . . . . . . . . . . . . . . . . . . . . . . . . 72Creating user-defined functions. . . . . . . . . . . . . . . . . . . . . . . . . . . . 73Deleting user-defined functions. . . . . . . . . . . . . . . . . . . . . . . . . . . . 73

    Estimating disk storage for user data . . . . . . . . . . . . . . . . . . . . . . . . . . . 73General approach to estimating storage . . . . . . . . . . . . . . . . . . . . . . . . . 73Calculating the space required for a table . . . . . . . . . . . . . . . . . . . . . . . . 75Calculating the space required for an index. . . . . . . . . . . . . . . . . . . . . . . . 78

    Saving space with data compression . . . . . . . . . . . . . . . . . . . . . . . . . . . 83Compressing data . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 83Calculating the space that is required for a dictionary . . . . . . . . . . . . . . . . . . . . 83

    Chapter 3. Altering your database design . . . . . . . . . . . . . . . . . . . . . 87Altering DB2 databases . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 87

    ALTER DATABASE options . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 87Altering DB2 storage groups. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 88

    Letting SMS manage your DB2 storage groups . . . . . . . . . . . . . . . . . . . . . . 88Adding or removing volumes from a DB2 storage group . . . . . . . . . . . . . . . . . . . 88

    Altering table spaces . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 89Changing the logging attribute . . . . . . . . . . . . . . . . . . . . . . . . . . . . 90Changing the space allocation for user-managed data sets . . . . . . . . . . . . . . . . . . . 91Dropping, recreating, or converting a table space . . . . . . . . . . . . . . . . . . . . . . 92Rebalancing data in partitioned table spaces . . . . . . . . . . . . . . . . . . . . . . . 93Altering a page set to contain DB2-defined extents . . . . . . . . . . . . . . . . . . . . . 94

    Altering DB2 tables. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 94Adding a new column to a table . . . . . . . . . . . . . . . . . . . . . . . . . . . 95Specifying a default value when altering a column . . . . . . . . . . . . . . . . . . . . . 96Altering the data type of a column . . . . . . . . . . . . . . . . . . . . . . . . . . 97Altering a table for referential integrity . . . . . . . . . . . . . . . . . . . . . . . . . 102Adding or dropping table check constraints . . . . . . . . . . . . . . . . . . . . . . . 105Adding a partition . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 106Altering partitions . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 108Adding XML columns . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 114Altering materialized query tables . . . . . . . . . . . . . . . . . . . . . . . . . . 115Altering the assignment of a validation routine . . . . . . . . . . . . . . . . . . . . . . 117Altering a table for capture of changed data . . . . . . . . . . . . . . . . . . . . . . . 118Changing an edit procedure or a field procedure . . . . . . . . . . . . . . . . . . . . . 119Altering the subtype of a string column . . . . . . . . . . . . . . . . . . . . . . . . 119Altering the attributes of an identity column . . . . . . . . . . . . . . . . . . . . . . . 119Changing data types by dropping and re-creating the table . . . . . . . . . . . . . . . . . . 120Moving a table to a table space of a different page size . . . . . . . . . . . . . . . . . . . 123

    Altering DB2 views . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 124Altering views by using the INSTEAD OF trigger . . . . . . . . . . . . . . . . . . . . . 124

    iv Administration Guide

    ||||

    ||

    ||

    ||

    ||

  • Altering DB2 indexes . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 125Adding a column to an index when you add the column to a table . . . . . . . . . . . . . . . 126Altering how varying-length index columns are stored . . . . . . . . . . . . . . . . . . . 126Altering the clustering of an index . . . . . . . . . . . . . . . . . . . . . . . . . . 127Dropping and redefining a DB2 index . . . . . . . . . . . . . . . . . . . . . . . . . 128Reorganizing indexes . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 128Recycling index version numbers. . . . . . . . . . . . . . . . . . . . . . . . . . . 128

    Altering stored procedures . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 129Altering user-defined functions . . . . . . . . . . . . . . . . . . . . . . . . . . . . 130Altering implicitly created XML objects. . . . . . . . . . . . . . . . . . . . . . . . . . 130Changing the high-level qualifier for DB2 data sets. . . . . . . . . . . . . . . . . . . . . . 131

    Defining a new integrated catalog alias. . . . . . . . . . . . . . . . . . . . . . . . . 132Changing the qualifier for system data sets . . . . . . . . . . . . . . . . . . . . . . . 132Changing qualifiers for other databases and user data sets . . . . . . . . . . . . . . . . . . 135

    Tools for moving DB2 data . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 138Moving DB2 data . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 140Moving a DB2 data set . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 141Scenario: Moving from index-controlled to table-controlled partitioning . . . . . . . . . . . . . . 142

    Part 2. Security and auditing . . . . . . . . . . . . . . . . . . . . . . . . 145

    Chapter 4. Getting started with DB2 security . . . . . . . . . . . . . . . . . . . 147DB2 security solutions . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 147What’s new in DB2 Version 9.1 security? . . . . . . . . . . . . . . . . . . . . . . . . . 147DB2 data access control . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 148

    ID-based privilege control within DB2 . . . . . . . . . . . . . . . . . . . . . . . . . 149Role-based privilege control within DB2 . . . . . . . . . . . . . . . . . . . . . . . . 150Privileges and authorities . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 150Ownership-based privilege control within DB2 . . . . . . . . . . . . . . . . . . . . . . 151Multilevel security. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 151Authorization control through exit routines . . . . . . . . . . . . . . . . . . . . . . . 151

    DB2 subsystem access control . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 151Managing access requests from local applications . . . . . . . . . . . . . . . . . . . . . 152Managing access requests from remote applications . . . . . . . . . . . . . . . . . . . . 152

    Data set protection . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 152RACF for data protection . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 152Data encryption . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 153

    Scenario: Securing data access at Spiffy Computer . . . . . . . . . . . . . . . . . . . . . . 153Determining security objectives . . . . . . . . . . . . . . . . . . . . . . . . . . . 153Securing manager access to employee data . . . . . . . . . . . . . . . . . . . . . . . 154Securing access to payroll operations and management . . . . . . . . . . . . . . . . . . . 157Managing access privileges of other authorities . . . . . . . . . . . . . . . . . . . . . . 160

    Chapter 5. Managing access through authorization IDs or roles. . . . . . . . . . . 165Authorization IDs and roles . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 166

    Authorization IDs . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 166Roles in a trusted context . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 166

    Privileges and authorities . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 167Explicit privileges . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 167Implicit privileges through object ownership . . . . . . . . . . . . . . . . . . . . . . . 172Administrative authorities . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 173Utility authorities for DB2 catalog and directory. . . . . . . . . . . . . . . . . . . . . . 179Privileges by authorization ID and authority . . . . . . . . . . . . . . . . . . . . . . . 180

    Managing explicit privileges . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 185Granting privileges to a role . . . . . . . . . . . . . . . . . . . . . . . . . . . . 186Granting privileges to the PUBLIC ID . . . . . . . . . . . . . . . . . . . . . . . . . 186Granting privileges to remote users . . . . . . . . . . . . . . . . . . . . . . . . . . 187Granting privileges through views . . . . . . . . . . . . . . . . . . . . . . . . . . 187Granting privileges with the GRANT statement . . . . . . . . . . . . . . . . . . . . . . 188Revoking privileges with the REVOKE statement . . . . . . . . . . . . . . . . . . . . . 193

    Contents v

    ||

    ||||

    ||

    ||

    ||

  • Managing implicit privileges . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 201Managing implicit privileges through object ownership . . . . . . . . . . . . . . . . . . . 202Managing implicit privileges through plan or package ownership . . . . . . . . . . . . . . . . 204Managing implicit privileges through routines . . . . . . . . . . . . . . . . . . . . . . 211

    Retrieving privilege records in the DB2 catalog . . . . . . . . . . . . . . . . . . . . . . . 224Catalog tables with privilege records . . . . . . . . . . . . . . . . . . . . . . . . . 224Retrieving all authorization IDs or roles with granted privileges . . . . . . . . . . . . . . . . 225Retrieving multiple grants of the same privilege. . . . . . . . . . . . . . . . . . . . . . 225Retrieving all authorization IDs or roles with the DBADM authority . . . . . . . . . . . . . . . 226Retrieving all IDs or roles with access to the same table . . . . . . . . . . . . . . . . . . . 226Retrieving all IDs or roles with access to the same routine . . . . . . . . . . . . . . . . . . 227Retrieving tables or views accessible by an ID . . . . . . . . . . . . . . . . . . . . . . 228Retrieving plans or packages with access to the same table . . . . . . . . . . . . . . . . . . 228Retrieving privilege information through views . . . . . . . . . . . . . . . . . . . . . . 229

    Implementing multilevel security with DB2 . . . . . . . . . . . . . . . . . . . . . . . . 229Multilevel security. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 230Mandatory access checking . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 233Implementing multilevel security at the object level . . . . . . . . . . . . . . . . . . . . 235Implementing multilevel security with row-level granularity . . . . . . . . . . . . . . . . . 236Restricting access to the security label column . . . . . . . . . . . . . . . . . . . . . . 239Managing data in a multilevel-secure environment . . . . . . . . . . . . . . . . . . . . . 239Implementing multilevel security in a distributed environment . . . . . . . . . . . . . . . . . 247

    Chapter 6. Managing access through RACF . . . . . . . . . . . . . . . . . . . 249Establishing RACF protection for DB2 . . . . . . . . . . . . . . . . . . . . . . . . . . 249

    Defining DB2 resources to RACF . . . . . . . . . . . . . . . . . . . . . . . . . . . 250Permitting RACF access . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 252Protecting stored procedures . . . . . . . . . . . . . . . . . . . . . . . . . . . . 259Protecting connection requests that use the TCP/IP protocol . . . . . . . . . . . . . . . . . 261Establishing Kerberos authentication through RACF . . . . . . . . . . . . . . . . . . . . 262

    Implementing DB2 support for enterprise identity mapping . . . . . . . . . . . . . . . . . . . 263Configuring the z/OS LDAP server . . . . . . . . . . . . . . . . . . . . . . . . . . 264Setting up RACF for the z/OS LDAP server . . . . . . . . . . . . . . . . . . . . . . . 265Setting up the EIM domain controller . . . . . . . . . . . . . . . . . . . . . . . . . 266Adding the SAF user mapping plug-in data set to LNKLIST . . . . . . . . . . . . . . . . . 267

    Managing connection requests from local applications . . . . . . . . . . . . . . . . . . . . . 267Processing of connection requests . . . . . . . . . . . . . . . . . . . . . . . . . . 268Using secondary IDs for connection requests . . . . . . . . . . . . . . . . . . . . . . . 269Processing of sign-on requests . . . . . . . . . . . . . . . . . . . . . . . . . . . . 270Using secondary IDs for sign-on requests . . . . . . . . . . . . . . . . . . . . . . . . 272Using sample connection and sign-on exit routines for CICS transactions . . . . . . . . . . . . . 273

    Managing connection requests from remote applications . . . . . . . . . . . . . . . . . . . . 273Security mechanisms for DRDA and SNA . . . . . . . . . . . . . . . . . . . . . . . . 273Communications database for the server . . . . . . . . . . . . . . . . . . . . . . . . 274Enabling change of user passwords . . . . . . . . . . . . . . . . . . . . . . . . . . 277Authorization failure code . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 277Managing inbound SNA-based connection requests . . . . . . . . . . . . . . . . . . . . 277Managing inbound TCP/IP-based connection requests . . . . . . . . . . . . . . . . . . . 284Managing denial-of-service attacks . . . . . . . . . . . . . . . . . . . . . . . . . . 286Managing outbound connection requests . . . . . . . . . . . . . . . . . . . . . . . . 287Translating outbound IDs . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 296Sending passwords . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 298

    Chapter 7. Managing access through trusted contexts. . . . . . . . . . . . . . . 301Trusted contexts . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 301Trusted connections . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 301Defining trusted contexts . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 302Creating local trusted connections . . . . . . . . . . . . . . . . . . . . . . . . . . . 303Establishing remote trusted connections by DB2 for z/OS requesters . . . . . . . . . . . . . . . . 303Establishing remote trusted connections to DB2 for z/OS servers . . . . . . . . . . . . . . . . . 304

    vi Administration Guide

    ||||||||||

    ||

    ||||||||||||

  • Switching users of a trusted connection . . . . . . . . . . . . . . . . . . . . . . . . . 305Reusing a local trusted connection through the DSN command processor and DB2I . . . . . . . . . . 305Reusing a remote trusted connection by DB2 for z/OS requesters . . . . . . . . . . . . . . . . 306Reusing a remote trusted connection through DB2 for z/OS servers . . . . . . . . . . . . . . . 306Reusing a local trusted connection through RRSAF . . . . . . . . . . . . . . . . . . . . . 306Reusing a local trusted connection through the SQL CONNECT statement . . . . . . . . . . . . . 307

    Defining external security profiles . . . . . . . . . . . . . . . . . . . . . . . . . . . 307Enabling users to perform actions on behalf of others . . . . . . . . . . . . . . . . . . . . . 308Performing tasks on objects for other users . . . . . . . . . . . . . . . . . . . . . . . . 308

    Chapter 8. Managing access through data definition control . . . . . . . . . . . . 311Data definition statements . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 311Data definition control support . . . . . . . . . . . . . . . . . . . . . . . . . . . . 311Registration tables . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 312

    ART columns . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 312ORT columns . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 313

    Installing data definition control support . . . . . . . . . . . . . . . . . . . . . . . . . 314Enabling data definition control . . . . . . . . . . . . . . . . . . . . . . . . . . . . 314

    Controlling data definition by application name . . . . . . . . . . . . . . . . . . . . . . 314Controlling data definition by application name with exceptions . . . . . . . . . . . . . . . . 315Controlling data definition by object name . . . . . . . . . . . . . . . . . . . . . . . 317Controlling data definition by object name with exceptions . . . . . . . . . . . . . . . . . . 318

    Registering object sets . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 319Disabling data definition control . . . . . . . . . . . . . . . . . . . . . . . . . . . . 320Managing registration tables and indexes . . . . . . . . . . . . . . . . . . . . . . . . . 321

    Creating registration tables and indexes . . . . . . . . . . . . . . . . . . . . . . . . 321Naming registration tables and indexes. . . . . . . . . . . . . . . . . . . . . . . . . 322Dropping registration tables and indexes . . . . . . . . . . . . . . . . . . . . . . . . 322Creating table spaces for registration tables . . . . . . . . . . . . . . . . . . . . . . . 322Adding columns to registration tables . . . . . . . . . . . . . . . . . . . . . . . . . 322Updating registration tables . . . . . . . . . . . . . . . . . . . . . . . . . . . . 323

    Chapter 9. Protecting data through encryption and RACF . . . . . . . . . . . . . 325Encrypting your data through DB2 built-in functions . . . . . . . . . . . . . . . . . . . . . 325

    Defining columns for encrypted data . . . . . . . . . . . . . . . . . . . . . . . . . 325Defining column-level encryption . . . . . . . . . . . . . . . . . . . . . . . . . . 326Defining value-level encryption . . . . . . . . . . . . . . . . . . . . . . . . . . . 327Using predicates for encrypted data . . . . . . . . . . . . . . . . . . . . . . . . . . 329Optimizing performance of encrypted data . . . . . . . . . . . . . . . . . . . . . . . 329

    Encrypting your data with Secure Socket Layer support . . . . . . . . . . . . . . . . . . . . 331AT-TLS configuration. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 331Configuring the DB2 server for SSL . . . . . . . . . . . . . . . . . . . . . . . . . . 332Configuring the DB2 requester for SSL . . . . . . . . . . . . . . . . . . . . . . . . . 333

    Protecting data sets through RACF . . . . . . . . . . . . . . . . . . . . . . . . . . . 334Adding groups to control DB2 data sets . . . . . . . . . . . . . . . . . . . . . . . . 334Creating generic profiles for data sets . . . . . . . . . . . . . . . . . . . . . . . . . 334Authorizing DB2 IDs to use data set profiles . . . . . . . . . . . . . . . . . . . . . . . 336Enabling DB2 IDs to create data sets . . . . . . . . . . . . . . . . . . . . . . . . . 336

    Chapter 10. Auditing access to DB2. . . . . . . . . . . . . . . . . . . . . . . 337DB2 audit trace. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 337

    Authorization IDs traced by auditing . . . . . . . . . . . . . . . . . . . . . . . . . 338Audit classes . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 338Limitations of the audit trace . . . . . . . . . . . . . . . . . . . . . . . . . . . . 339Auditing in a distributed data environment . . . . . . . . . . . . . . . . . . . . . . . 340

    Audit trace records . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 340Audit trace reports . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 340Additional sources of audit information . . . . . . . . . . . . . . . . . . . . . . . . . 341Determining active security measures . . . . . . . . . . . . . . . . . . . . . . . . . . 342Using DB2 audit trace and trace records . . . . . . . . . . . . . . . . . . . . . . . . . 342

    Contents vii

    ||||||||||||

    ||||

    ||||||||

  • Starting the audit trace . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 342Stopping the audit trace . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 343Auditing specific tables . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 343Auditing specific IDs or roles . . . . . . . . . . . . . . . . . . . . . . . . . . . . 344Determining ID privileges and authorities . . . . . . . . . . . . . . . . . . . . . . . . 345Collecting audit trace records . . . . . . . . . . . . . . . . . . . . . . . . . . . . 345Formatting audit trace records. . . . . . . . . . . . . . . . . . . . . . . . . . . . 345

    Managing data accuracy and consistency . . . . . . . . . . . . . . . . . . . . . . . . . 345Ensuring data presence and uniqueness . . . . . . . . . . . . . . . . . . . . . . . . 346Protecting data integrity . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 346Tracking data changes . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 347Checking for lost and incomplete transactions . . . . . . . . . . . . . . . . . . . . . . 347

    Ensuring data consistency . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 348Using referential integrity for data consistency . . . . . . . . . . . . . . . . . . . . . . 348Using locks for data consistency . . . . . . . . . . . . . . . . . . . . . . . . . . . 348Checking data consistency . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 349

    Part 3. Operation and recovery . . . . . . . . . . . . . . . . . . . . . . . 353

    Chapter 11. DB2 basic operational concepts . . . . . . . . . . . . . . . . . . . 355Recommendations for entering commands. . . . . . . . . . . . . . . . . . . . . . . . . 355DB2 operator commands . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 355Where DB2 commands are entered . . . . . . . . . . . . . . . . . . . . . . . . . . . 358Where command responses go . . . . . . . . . . . . . . . . . . . . . . . . . . . . 360Authorities for DB2 commands . . . . . . . . . . . . . . . . . . . . . . . . . . . . 361DB2 message identifiers . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 362

    Unsolicited DB2 messages . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 363Operational control options. . . . . . . . . . . . . . . . . . . . . . . . . . . . . 363

    Chapter 12. Starting and stopping DB2 . . . . . . . . . . . . . . . . . . . . . 365Starting DB2. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 365

    Messages at start . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 365Options at start. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 366Restricting access to data . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 366Ending the wait state at start . . . . . . . . . . . . . . . . . . . . . . . . . . . . 367Restart options after an abend . . . . . . . . . . . . . . . . . . . . . . . . . . . . 367

    Stopping DB2 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 368

    Chapter 13. Submitting work to DB2 . . . . . . . . . . . . . . . . . . . . . . 369Submitting work by using DB2I . . . . . . . . . . . . . . . . . . . . . . . . . . . . 369Running TSO application programs . . . . . . . . . . . . . . . . . . . . . . . . . . . 369

    DSN subcommands for TSO environments . . . . . . . . . . . . . . . . . . . . . . . 370Sources that DB2 uses to find authorization access by the application program . . . . . . . . . . . 371

    Running IMS application programs . . . . . . . . . . . . . . . . . . . . . . . . . . . 371Running CICS application programs. . . . . . . . . . . . . . . . . . . . . . . . . . . 372Running batch application programs . . . . . . . . . . . . . . . . . . . . . . . . . . 372Running application programs using CAF . . . . . . . . . . . . . . . . . . . . . . . . . 373Running application programs using RRSAF . . . . . . . . . . . . . . . . . . . . . . . . 373

    Chapter 14. Scheduling administrative tasks . . . . . . . . . . . . . . . . . . . 375Interacting with the administrative task scheduler . . . . . . . . . . . . . . . . . . . . . . 375

    Adding a task . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 375Listing scheduled tasks . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 387Listing the last execution status of scheduled tasks . . . . . . . . . . . . . . . . . . . . . 391Removing a scheduled task. . . . . . . . . . . . . . . . . . . . . . . . . . . . . 395Manually starting the administrative task scheduler . . . . . . . . . . . . . . . . . . . . 397Manually stopping the administrative task scheduler . . . . . . . . . . . . . . . . . . . . 398Synchronization between administrative task schedulers in a data sharing environment . . . . . . . . 398Troubleshooting the administrative task scheduler . . . . . . . . . . . . . . . . . . . . . 399

    viii Administration Guide

    ||

    ||

    ||||

    ||||||||||||||||||||

  • Architecture of the administrative task scheduler . . . . . . . . . . . . . . . . . . . . . . 402The lifecycle of the administrative task scheduler . . . . . . . . . . . . . . . . . . . . . 403Scheduler task lists . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 404Architecture of the administrative task scheduler in a data sharing environment . . . . . . . . . . . 405

    Security guidelines for the administrative task scheduler . . . . . . . . . . . . . . . . . . . . 406User roles in the administrative task scheduler . . . . . . . . . . . . . . . . . . . . . . 407Protection of the interface of the administrative task scheduler . . . . . . . . . . . . . . . . . 407Protection of the resources of the administrative task scheduler . . . . . . . . . . . . . . . . 408Secure execution of tasks in the administrative task scheduler . . . . . . . . . . . . . . . . . 408

    Execution of scheduled tasks in the administrative task scheduler . . . . . . . . . . . . . . . . . 409Multi-threading in the administrative task scheduler . . . . . . . . . . . . . . . . . . . . 409Scheduled execution of a stored procedure . . . . . . . . . . . . . . . . . . . . . . . 410How the administrative task scheduler works with Unicode . . . . . . . . . . . . . . . . . . 411Scheduled execution of a JCL job . . . . . . . . . . . . . . . . . . . . . . . . . . . 411Execution of scheduled tasks in a data sharing environment. . . . . . . . . . . . . . . . . . 412

    Chapter 15. Monitoring and controlling DB2 and its connections . . . . . . . . . . 413Controlling DB2 databases and buffer pools . . . . . . . . . . . . . . . . . . . . . . . . 413

    Starting databases . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 413Monitoring databases. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 415Obtaining information about application programs . . . . . . . . . . . . . . . . . . . . . 417Obtaining information about and handling pages in error . . . . . . . . . . . . . . . . . . 419Using the STOP DATABASE command to make objects available . . . . . . . . . . . . . . . . 422Altering buffer pools . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 423Monitoring buffer pools . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 423

    Controlling user-defined functions . . . . . . . . . . . . . . . . . . . . . . . . . . . 424Starting user-defined functions . . . . . . . . . . . . . . . . . . . . . . . . . . . 424Monitoring user-defined functions . . . . . . . . . . . . . . . . . . . . . . . . . . 425Stopping user-defined functions . . . . . . . . . . . . . . . . . . . . . . . . . . . 425

    Controlling DB2 utilities . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 426Starting online utilities . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 426Monitoring and changing online utilities . . . . . . . . . . . . . . . . . . . . . . . . 426Controlling DB2 stand-alone utilities . . . . . . . . . . . . . . . . . . . . . . . . . 427

    Controlling the IRLM. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 428z/OS commands that operate on IRLM. . . . . . . . . . . . . . . . . . . . . . . . . 429Starting the IRLM . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 430Stopping the IRLM . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 430

    Monitoring threads . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 431Types of threads . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 431Output of the DISPLAY THREAD command . . . . . . . . . . . . . . . . . . . . . . . 432Displaying information about threads . . . . . . . . . . . . . . . . . . . . . . . . . 432Monitoring all DBMSs in a transaction . . . . . . . . . . . . . . . . . . . . . . . . . 436

    Controlling connections . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 438Controlling TSO connections . . . . . . . . . . . . . . . . . . . . . . . . . . . . 439Controlling CICS connections . . . . . . . . . . . . . . . . . . . . . . . . . . . . 442Controlling IMS connections . . . . . . . . . . . . . . . . . . . . . . . . . . . . 447Controlling RRS connections . . . . . . . . . . . . . . . . . . . . . . . . . . . . 456Controlling connections to remote systems . . . . . . . . . . . . . . . . . . . . . . . 460

    Controlling traces . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 474Types of DB2 traces . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 474Diagnostic traces for attachment facilities . . . . . . . . . . . . . . . . . . . . . . . . 474Controlling the DB2 trace . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 475Diagnostic trace for the IRLM . . . . . . . . . . . . . . . . . . . . . . . . . . . . 476

    Controlling the resource limit facility (governor). . . . . . . . . . . . . . . . . . . . . . . 476Changing subsystem parameter values . . . . . . . . . . . . . . . . . . . . . . . . . . 477

    Chapter 16. Managing the log and the bootstrap data set . . . . . . . . . . . . . 479How database changes are made . . . . . . . . . . . . . . . . . . . . . . . . . . . . 479

    Units of recovery and points of consistency . . . . . . . . . . . . . . . . . . . . . . . 479How DB2 rolls back work . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 480

    Contents ix

    ||||||||||||||||||||||||||||||

    ||||

  • How the initial DB2 logging environment is established . . . . . . . . . . . . . . . . . . . 481How DB2 creates log records . . . . . . . . . . . . . . . . . . . . . . . . . . . . 481How DB2 writes the active log . . . . . . . . . . . . . . . . . . . . . . . . . . . 481How DB2 writes (offloads) the archive log . . . . . . . . . . . . . . . . . . . . . . . 482

    How DB2 retrieves log records . . . . . . . . . . . . . . . . . . . . . . . . . . . . 487Managing the log . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 488

    Quiescing activity before offloading . . . . . . . . . . . . . . . . . . . . . . . . . . 488Archiving the log . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 489Dynamically changing the checkpoint frequency. . . . . . . . . . . . . . . . . . . . . . 490Setting limits for archive log tape units . . . . . . . . . . . . . . . . . . . . . . . . . 491Monitoring the system checkpoint . . . . . . . . . . . . . . . . . . . . . . . . . . 491Displaying log information . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 491

    Resetting the log RBA . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 492Log RBA range . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 492Resetting the log RBA value in a data sharing environment . . . . . . . . . . . . . . . . . . 493Resetting the log RBA value in a non-data sharing environment . . . . . . . . . . . . . . . . 493

    Canceling and restarting an offload . . . . . . . . . . . . . . . . . . . . . . . . . . . 494Displaying the status of an offload . . . . . . . . . . . . . . . . . . . . . . . . . . . 494Discarding archive log records. . . . . . . . . . . . . . . . . . . . . . . . . . . . . 494Locating archive log data sets . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 495Management of the bootstrap data set . . . . . . . . . . . . . . . . . . . . . . . . . . 498

    Restoring dual mode BSDS . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 498BSDS copies with archive log data sets . . . . . . . . . . . . . . . . . . . . . . . . . 499Recommendations for changing the BSDS log inventory . . . . . . . . . . . . . . . . . . . 499

    Chapter 17. Restarting DB2 after termination . . . . . . . . . . . . . . . . . . . 501Methods of restarting. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 501

    Types of termination . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 501Normal restart and recovery . . . . . . . . . . . . . . . . . . . . . . . . . . . . 502Automatic restart . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 507Restart in a data sharing environment . . . . . . . . . . . . . . . . . . . . . . . . . 507Restart implications for table spaces that are not logged . . . . . . . . . . . . . . . . . . . 507Conditional restart . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 508

    Terminating DB2 normally . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 509Restarting automatically . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 509Deferring restart processing . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 510

    Deferral of restart . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 511Performing conditional restart . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 511

    Options for recovery operations after conditional restart . . . . . . . . . . . . . . . . . . . 512Conditional restart records . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 512

    Resolving postponed units of recovery . . . . . . . . . . . . . . . . . . . . . . . . . . 512RECOVER POSTPONED command . . . . . . . . . . . . . . . . . . . . . . . . . . 513Recovering from an error during RECOVER POSTPONED processing . . . . . . . . . . . . . . 514

    Chapter 18. Maintaining consistency across multiple systems . . . . . . . . . . . 515Multiple system consistency . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 515

    Two-phase commit process . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 515Commit coordinator and multiple participants . . . . . . . . . . . . . . . . . . . . . . 517Illustration of multi-site update . . . . . . . . . . . . . . . . . . . . . . . . . . . 518Termination for multiple systems . . . . . . . . . . . . . . . . . . . . . . . . . . . 519Consistency after termination or failure. . . . . . . . . . . . . . . . . . . . . . . . . 520Normal restart and recovery for multiple systems . . . . . . . . . . . . . . . . . . . . . 521Multiple-system restart with conditions. . . . . . . . . . . . . . . . . . . . . . . . . 522Heuristic decisions about whether to commit or abort an indoubt thread . . . . . . . . . . . . . 522

    Resolving indoubt units of recovery . . . . . . . . . . . . . . . . . . . . . . . . . . . 522Resolution of IMS indoubt units of recovery . . . . . . . . . . . . . . . . . . . . . . . 523Resolution of CICS indoubt units of recovery. . . . . . . . . . . . . . . . . . . . . . . 524Resolution of RRS indoubt units of recovery . . . . . . . . . . . . . . . . . . . . . . . 524Resolving WebSphere Application Server indoubt units of recovery . . . . . . . . . . . . . . . 525Resolving remote DBMS indoubt units of recovery . . . . . . . . . . . . . . . . . . . . . 527

    x Administration Guide

    ||

    ||

  • Determining the coordinator’s commit or abort decision . . . . . . . . . . . . . . . . . . . 528Recovering indoubt threads . . . . . . . . . . . . . . . . . . . . . . . . . . . . 528Resetting the status of an indoubt thread . . . . . . . . . . . . . . . . . . . . . . . . 529

    Chapter 19. Backing up and recovering your data. . . . . . . . . . . . . . . . . 531Plans for backup and recovery . . . . . . . . . . . . . . . . . . . . . . . . . . . . 531

    Plans for recovery of distributed data . . . . . . . . . . . . . . . . . . . . . . . . . 531Plans for extended recovery facility toleration . . . . . . . . . . . . . . . . . . . . . . 532Plans for recovery of indexes . . . . . . . . . . . . . . . . . . . . . . . . . . . . 533Preparation for recovery: a scenario . . . . . . . . . . . . . . . . . . . . . . . . . . 533Events that occur during recovery . . . . . . . . . . . . . . . . . . . . . . . . . . 534Tips for maximizing data availability during backup and recovery . . . . . . . . . . . . . . . 539Where to find recovery information . . . . . . . . . . . . . . . . . . . . . . . . . . 542How to report recovery information . . . . . . . . . . . . . . . . . . . . . . . . . . 543How to discard SYSCOPY and SYSLGRNX records. . . . . . . . . . . . . . . . . . . . . 544Preparations for disaster recovery . . . . . . . . . . . . . . . . . . . . . . . . . . 545Recommendations for more effective recovery from inconsistency . . . . . . . . . . . . . . . . 547How to recover multiple objects in parallel . . . . . . . . . . . . . . . . . . . . . . . 549Automatic fast log apply during RECOVER . . . . . . . . . . . . . . . . . . . . . . . 550Recovery of page sets and data sets . . . . . . . . . . . . . . . . . . . . . . . . . . 550Recovery of data to a prior point of consistency . . . . . . . . . . . . . . . . . . . . . . 556Preparing to recover an entire DB2 subsystem to a prior point in time using image copies or object-levelbackups . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 565Creating essential disaster recovery elements . . . . . . . . . . . . . . . . . . . . . . . 565Resolving problems with a user-defined work file data set . . . . . . . . . . . . . . . . . . 567Resolving problems with DB2-managed work file data sets . . . . . . . . . . . . . . . . . . 567Recovering error ranges for a work file table space . . . . . . . . . . . . . . . . . . . . . 568Recovering after a conditional restart of DB2 . . . . . . . . . . . . . . . . . . . . . . . 568Regenerating missing identity column values. . . . . . . . . . . . . . . . . . . . . . . 569Recovering a table space and all of its indexes . . . . . . . . . . . . . . . . . . . . . . 570Removing various pending states from LOB and XML table spaces . . . . . . . . . . . . . . . 574Restoring data by using DSN1COPY . . . . . . . . . . . . . . . . . . . . . . . . . 575Backing up and restoring data with non-DB2 dump and restore . . . . . . . . . . . . . . . . 575Recovering accidentally dropped objects . . . . . . . . . . . . . . . . . . . . . . . . 575Recovering your DB2 system to a given point in time by using the RESTORE SYSTEM utility . . . . . . 581Recovering by using DB2 restart recovery . . . . . . . . . . . . . . . . . . . . . . . . 590Recovering by using FlashCopy backups . . . . . . . . . . . . . . . . . . . . . . . . 591Making catalog definitions consistent with your data after recovery to a prior point in time . . . . . . . 591Performing remote site recovery from a disaster at a local site . . . . . . . . . . . . . . . . . 594Backup and recovery involving clone tables . . . . . . . . . . . . . . . . . . . . . . . 595Data restore of an entire system . . . . . . . . . . . . . . . . . . . . . . . . . . . 595

    Chapter 20. Recovering from different DB2 for z/OS problems . . . . . . . . . . . 597Recovering from IRLM failure . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 597Recovering from z/OS or power failure . . . . . . . . . . . . . . . . . . . . . . . . . 597Recovering from disk failure . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 598Recovering from application errors . . . . . . . . . . . . . . . . . . . . . . . . . . . 600

    Backing out incorrect application changes (with a quiesce point) . . . . . . . . . . . . . . . . 600Backing out incorrect application changes (without a quiesce point) . . . . . . . . . . . . . . . 601

    Recovering from IMS-related failures . . . . . . . . . . . . . . . . . . . . . . . . . . 601Recovering from IMS control region failure . . . . . . . . . . . . . . . . . . . . . . . 602Recovering from IMS indoubt units of recovery . . . . . . . . . . . . . . . . . . . . . . 602Recovering from IMS application failure . . . . . . . . . . . . . . . . . . . . . . . . 605Recovering from a DB2 failure in an IMS environment . . . . . . . . . . . . . . . . . . . 605

    Recovering from CICS-related failure . . . . . . . . . . . . . . . . . . . . . . . . . . 606Recovering from CICS application failures. . . . . . . . . . . . . . . . . . . . . . . . 606Recovering DB2 when CICS is not operational . . . . . . . . . . . . . . . . . . . . . . 607Recovering DB2 when the CICS attachment facility cannot connect to DB2 . . . . . . . . . . . . . 608Recovering CICS indoubt units of recovery . . . . . . . . . . . . . . . . . . . . . . . 608Recovering from CICS attachment facility failure . . . . . . . . . . . . . . . . . . . . . 611

    Contents xi

    ||||

  • Recovering from subsystem termination . . . . . . . . . . . . . . . . . . . . . . . . . 611Recovering from temporary resource failure . . . . . . . . . . . . . . . . . . . . . . . . 612Recovering from active log failures . . . . . . . . . . . . . . . . . . . . . . . . . . . 613

    Recovering from being out of space in active logs . . . . . . . . . . . . . . . . . . . . . 613Recovering from a write I/O error on an active log data set . . . . . . . . . . . . . . . . . . 614Recovering from a loss of dual active logging . . . . . . . . . . . . . . . . . . . . . . 615Recovering from I/O errors while reading the active log . . . . . . . . . . . . . . . . . . . 616

    Recovering from archive log failures. . . . . . . . . . . . . . . . . . . . . . . . . . . 618Recovering from allocation problems with the archive log . . . . . . . . . . . . . . . . . . 618Recovering from write I/O errors during archive log offload . . . . . . . . . . . . . . . . . 618Recovering from read I/O errors on an archive data set during recovery . . . . . . . . . . . . . 619Recovering from insufficient disk space for offload processing . . . . . . . . . . . . . . . . . 620

    Recovering from BSDS failures . . . . . . . . . . . . . . . . . . . . . . . . . . . . 621Recovering from an I/O error on the BSDS . . . . . . . . . . . . . . . . . . . . . . . 621Recovering from an error that occurs while opening the BSDS . . . . . . . . . . . . . . . . . 622Recovering from unequal timestamps on BSDSs . . . . . . . . . . . . . . . . . . . . . . 622Recovering the BSDS from a backup copy . . . . . . . . . . . . . . . . . . . . . . . . 623

    Recovering from BSDS or log failures during restart . . . . . . . . . . . . . . . . . . . . . 626Recovering from failure during log initialization or current status rebuild . . . . . . . . . . . . . 628Recovering from a failure during forward log recovery . . . . . . . . . . . . . . . . . . . 639Recovering from a failure during backward log recovery . . . . . . . . . . . . . . . . . . . 645Recovering from a failure during a log RBA read request . . . . . . . . . . . . . . . . . . . 647Recovering from unresolvable BSDS or log data set problem during restart. . . . . . . . . . . . . 648Recovering from a failure resulting from total or excessive loss of log data . . . . . . . . . . . . . 651Resolving inconsistencies resulting from a conditional restart . . . . . . . . . . . . . . . . . 655

    Recovering from DB2 database failure . . . . . . . . . . . . . . . . . . . . . . . . . . 660Recovering a DB2 subsystem to a prior point in time . . . . . . . . . . . . . . . . . . . . . 661Recovering from a down-level page set problem. . . . . . . . . . . . . . . . . . . . . . . 662Recovering from a problem with invalid LOBs . . . . . . . . . . . . . . . . . . . . . . . 664Recovering from table space input-output errors . . . . . . . . . . . . . . . . . . . . . . 665Recovering from DB2 catalog or directory I/O errors . . . . . . . . . . . . . . . . . . . . . 666Recovering from integrated catalog facility failure . . . . . . . . . . . . . . . . . . . . . . 667

    Recovering VSAM volume data sets that are out of space or destroyed . . . . . . . . . . . . . . 667Recovering from out-of-disk-space or extent-limit problems . . . . . . . . . . . . . . . . . . 668

    Recovering from referential constraint violation . . . . . . . . . . . . . . . . . . . . . . . 672Recovering from distributed data facility failure . . . . . . . . . . . . . . . . . . . . . . . 673

    Recovering from conversation failure . . . . . . . . . . . . . . . . . . . . . . . . . 673Recovering from communications database failure . . . . . . . . . . . . . . . . . . . . . 674Recovering from database access thread failure . . . . . . . . . . . . . . . . . . . . . . 675Recovering from VTAM failure . . . . . . . . . . . . . . . . . . . . . . . . . . . 676Recovering from TCP/IP failure . . . . . . . . . . . . . . . . . . . . . . . . . . . 676Recovering from remote logical unit failure . . . . . . . . . . . . . . . . . . . . . . . 677Recovering from an indefinite wait condition. . . . . . . . . . . . . . . . . . . . . . . 677Recovering database access threads after security failure . . . . . . . . . . . . . . . . . . . 678

    Performing remote-site disaster recovery . . . . . . . . . . . . . . . . . . . . . . . . . 679Recovering from a disaster by using system-level backups . . . . . . . . . . . . . . . . . . 679Restoring data from image copies and archive logs . . . . . . . . . . . . . . . . . . . . . 679Recovering from disasters by using a tracker site . . . . . . . . . . . . . . . . . . . . . 694Using data mirroring for disaster recovery . . . . . . . . . . . . . . . . . . . . . . . 702

    Scenarios for resolving problems with indoubt threads . . . . . . . . . . . . . . . . . . . . 708Scenario: Recovering from communication failure . . . . . . . . . . . . . . . . . . . . . 710Scenario: Making a heuristic decision about whether to commit or abort an indoubt thread . . . . . . . 711Scenario: Recovering from an IMS outage that results in an IMS cold start . . . . . . . . . . . . . 713Scenario: Recovering from a DB2 outage at a requester that results in a DB2 cold start . . . . . . . . . 715Scenario: What happens when the wrong DB2 subsystem is cold started . . . . . . . . . . . . . 719Scenario: Correcting damage from an incorrect heuristic decision about an indoubt thread . . . . . . . 720

    Chapter 21. Reading log records . . . . . . . . . . . . . . . . . . . . . . . . 723Contents of the log . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 723

    Unit of recovery log records . . . . . . . . . . . . . . . . . . . . . . . . . . . . 723Checkpoint log records . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 727

    xii Administration Guide

    ||

  • Database page set control records . . . . . . . . . . . . . . . . . . . . . . . . . . 728Other exception information . . . . . . . . . . . . . . . . . . . . . . . . . . . . 728

    The physical structure of the log . . . . . . . . . . . . . . . . . . . . . . . . . . . . 728Physical and logical log records . . . . . . . . . . . . . . . . . . . . . . . . . . . 728The log record header . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 729The log control interval definition (LCID) . . . . . . . . . . . . . . . . . . . . . . . . 730Log record type codes . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 732Log record subtype codes . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 733Interpreting data change log records. . . . . . . . . . . . . . . . . . . . . . . . . . 735

    Reading log records with IFI . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 735Reading log records into a buffer . . . . . . . . . . . . . . . . . . . . . . . . . . . 735Reading specific log records (IFCID 0129) . . . . . . . . . . . . . . . . . . . . . . . . 736Reading complete log data (IFCID 0306) . . . . . . . . . . . . . . . . . . . . . . . . 737

    Reading log records with OPEN, GET, and CLOSE . . . . . . . . . . . . . . . . . . . . . . 739JCL DD statements for DB2 stand-alone log services . . . . . . . . . . . . . . . . . . . . 740Data sharing members that participate in a read. . . . . . . . . . . . . . . . . . . . . . 742Registers and return codes . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 743Stand-alone log OPEN request. . . . . . . . . . . . . . . . . . . . . . . . . . . . 744Stand-alone log GET request . . . . . . . . . . . . . . . . . . . . . . . . . . . . 745Stand-alone log CLOSE request . . . . . . . . . . . . . . . . . . . . . . . . . . . 747Sample application that uses stand-alone log services . . . . . . . . . . . . . . . . . . . . 748

    Reading log records with the log capture exit routine . . . . . . . . . . . . . . . . . . . . . 749

    Part 4. Appendixes . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 751

    Appendix A. Writing exit routines. . . . . . . . . . . . . . . . . . . . . . . . 753Connection routines and sign-on routines . . . . . . . . . . . . . . . . . . . . . . . . . 753

    Specifying connection and sign-on routines . . . . . . . . . . . . . . . . . . . . . . . 754Sample connection and sign-on routines . . . . . . . . . . . . . . . . . . . . . . . . 754When connection and sign-on routines are taken . . . . . . . . . . . . . . . . . . . . . 755EXPL for connection and sign-on routines . . . . . . . . . . . . . . . . . . . . . . . . 756Exit parameter list for connection and sign-on routines . . . . . . . . . . . . . . . . . . . 756Authorization ID parameter list for connection and sign-on routines . . . . . . . . . . . . . . . 757Input values for connection routines. . . . . . . . . . . . . . . . . . . . . . . . . . 758Input values for sign-on routines . . . . . . . . . . . . . . . . . . . . . . . . . . . 759Expected output for connection and sign-on routines . . . . . . . . . . . . . . . . . . . . 759Processing in the sample connection and sign-on routines . . . . . . . . . . . . . . . . . . 760Performance considerations for connection and sign-on routines . . . . . . . . . . . . . . . . 761Debugging connection and sign-on routines . . . . . . . . . . . . . . . . . . . . . . . 762Session variables in connection and sign-on routines . . . . . . . . . . . . . . . . . . . . 763

    Access control authorization exit routine . . . . . . . . . . . . . . . . . . . . . . . . . 764Specifying the access control authorization routine . . . . . . . . . . . . . . . . . . . . . 766The default access control authorization routine . . . . . . . . . . . . . . . . . . . . . . 766When the access control authorization routine is taken . . . . . . . . . . . . . . . . . . . 766Considerations for the access control authorization routine . . . . . . . . . . . . . . . . . . 767Parameter list for the access control authorization routine . . . . . . . . . . . . . . . . . . 770Expected output for the access control authorization routine. . . . . . . . . . . . . . . . . . 778Debugging the access control authorization routine. . . . . . . . . . . . . . . . . . . . . 780Determining whether the access control authorization routine is active . . . . . . . . . . . . . . 781

    Edit routines . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 781Specifying the edit routine . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 782When the edit routine is taken . . . . . . . . . . . . . . . . . . . . . . . . . . . 782Parameter lists for the edit routine . . . . . . . . . . . . . . . . . . . . . . . . . . 782Processing requirements for edit routines . . . . . . . . . . . . . . . . . . . . . . . . 783Incomplete rows and edit routines . . . . . . . . . . . . . . . . . . . . . . . . . . 783Expected output for edit routines. . . . . . . . . . . . . . . . . . . . . . . . . . . 784

    Validation routines . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 785Specifying the validation routine . . . . . . . . . . . . . . . . . . . . . . . . . . . 785When the validation routine is taken . . . . . . . . . . . . . . . . . . . . . . . . . 785Parameter lists for the validation routine . . . . . . . . . . . . . . . . . . . . . . . . 786

    Contents xiii

  • Processing requirements for validation routines . . . . . . . . . . . . . . . . . . . . . . 786Incomplete rows and validation routines . . . . . . . . . . . . . . . . . . . . . . . . 787Expected output for validation routines . . . . . . . . . . . . . . . . . . . . . . . . 787

    Date and time routines . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 788Specifying the date and time routine . . . . . . . . . . . . . . . . . . . . . . . . . 789When date and time routines are taken. . . . . . . . . . . . . . . . . . . . . . . . . 789Parameter lists for date and time routines . . . . . . . . . . . . . . . . . . . . . . . . 790Expected output for date and time routines . . . . . . . . . . . . . . . . . . . . . . . 791

    Conversion procedures . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 792Specifying a conversion procedure . . . . . . . . . . . . . . . . . . . . . . . . . . 792When conversion procedures are taken . . . . . . . . . . . . . . . . . . . . . . . . . 793Parameter lists for conversion procedures . . . . . . . . . . . . . . . . . . . . . . . . 793Expected output for conversion procedures . . . . . . . . . . . . . . . . . . . . . . . 793

    Field procedures . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 795Field definition for field procedures . . . . . . . . . . . . . . . . . . . . . . . . . . 796Specifying the field procedure . . . . . . . . . . . . . . . . . . . . . . . . . . . . 796When field procedures are taken . . . . . . . . . . . . . . . . . . . . . . . . . . . 797Control blocks for execution of field procedures . . . . . . . . . . . . . . . . . . . . . . 798Field-definition (function code 8) . . . . . . . . . . . . . . . . . . . . . . . . . . . 801Field-encoding (function code 0) . . . . . . . . . . . . . . . . . . . . . . . . . . . 803Field-decoding (function code 4) . . . . . . . . . . . . . . . . . . . . . . . . . . . 805

    Log capture routines . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 807Specifying the log capture routine . . . . . . . . . . . . . . . . . . . . . . . . . . 807When log capture routines are taken . . . . . . . . . . . . . . . . . . . . . . . . . 808Parameter lists for log capture routines . . . . . . . . . . . . . . . . . . . . . . . . . 808

    Routines for dynamic plan selection in CICS . . . . . . . . . . . . . . . . . . . . . . . . 809Routine for CICS transaction invocation stored procedure . . . . . . . . . . . . . . . . . . . 810General guidelines for writing exit routines . . . . . . . . . . . . . . . . . . . . . . . . 810

    Coding rules for exit routines . . . . . . . . . . . . . . . . . . . . . . . . . . . . 810Modifying exit routines . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 811Execution environment for exit routines . . . . . . . . . . . . . . . . . . . . . . . . 811Registers at invocation for exit routines. . . . . . . . . . . . . . . . . . . . . . . . . 811Parameter lists for exit routines . . . . . . . . . . . . . . . . . . . . . . . . . . . 812

    Row formats for edit and validation routines . . . . . . . . . . . . . . . . . . . . . . . . 813Column boundaries for edit and validation routines . . . . . . . . . . . . . . . . . . . . 813Null values for edit procedures, field procedures, and validation routines . . . . . . . . . . . . . 813Fixed-length rows for edit and validation routines . . . . . . . . . . . . . . . . . . . . . 814Varying-length rows for edit and validation routines . . . . . . . . . . . . . . . . . . . . 814Varying-length rows with nulls for edit and validation routines . . . . . . . . . . . . . . . . 815EDITPROCs and VALIDPROCs for handling basic and reordered row formats . . . . . . . . . . . 815Converting basic row format table spaces with edit and validation routines to reordered row format . . . . 816Dates, times, and timestamps for edit and validation routines . . . . . . . . . . . . . . . . . 816Parameter list for row format descriptions. . . . . . . . . . . . . . . . . . . . . . . . 817DB2 codes for numeric data in edit and validation routines . . . . . . . . . . . . . . . . . . 818

    RACF access control module . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 820

    Appendix B. Stored procedures for administration . . . . . . . . . . . . . . . . 821DSNACICS stored procedure . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 821

    The DSNACICX user exit routine. . . . . . . . . . . . . . . . . . . . . . . . . . . 826DSNLEUSR stored procedure . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 829DSNAIMS stored procedure . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 832DSNAIMS2 stored procedure . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 836ADMIN_COMMAND_DB2 stored procedure . . . . . . . . . . . . . . . . . . . . . . . . 841ADMIN_COMMAND_DSN stored procedure . . . . . . . . . . . . . . . . . . . . . . . 850ADMIN_COMMAND_UNIX stored procedure . . . . . . . . . . . . . . . . . . . . . . . 852ADMIN_DS_BROWSE stored procedure . . . . . . . . . . . . . . . . . . . . . . . . . 856ADMIN_DS_DELETE stored procedure. . . . . . . . . . . . . . . . . . . . . . . . . . 859ADMIN_DS_LIST stored procedure . . . . . . . . . . . . . . . . . . . . . . . . . . . 862ADMIN_DS_RENAME stored procedure . . . . . . . . . . . . . . . . . . . . . . . . . 868ADMIN_DS_SEARCH stored procedure . . . . . . . . . . . . . . . . . . . . . . . . . 871ADMIN_DS_WRITE stored procedure . . . . . . . . . . . . . . . . . . . . . . . . . . 873

    xiv Administration Guide

    ||

    ||

    ||||

  • ADMIN_INFO_HOST stored procedure . . . . . . . . . . . . . . . . . . . . . . . . . 877ADMIN_INFO_SSID stored procedure . . . . . . . . . . . . . . . . . . . . . . . . . . 881ADMIN_JOB_CANCEL stored procedure . . . . . . . . . . . . . . . . . . . . . . . . . 882ADMIN_JOB_FETCH stored procedure. . . . . . . . . . . . . . . . . . . . . . . . . . 885ADMIN_JOB_QUERY stored procedure . . . . . . . . . . . . . . . . . . . . . . . . . 888ADMIN_JOB_SUBMIT stored procedure . . . . . . . . . . . . . . . . . . . . . . . . . 892ADMIN_UTL_SCHEDULE stored procedure . . . . . . . . . . . . . . . . . . . . . . . . 895ADMIN_UTL_SORT stored procedure . . . . . . . . . . . . . . . . . . . . . . . . . . 904Common SQL API stored procedures . . . . . . . . . . . . . . . . . . . . . . . . . . 911

    GET_CONFIG stored procedure . . . . . . . . . . . . . . . . . . . . . . . . . . . 912GET_MESSAGE stored procedure . . . . . . . . . . . . . . . . . . . . . . . . . . 922GET_SYSTEM_INFO stored procedure . . . . . . . . . . . . . . . . . . . . . . . . . 932XPath expressions for filtering output . . . . . . . . . . . . . . . . . . . . . . . . . 948

    Information resources for DB2 for z/OS and related products . . . . . . . . . . . 949

    How to obtain DB2 information. . . . . . . . . . . . . . . . . . . . . . . . . 955

    How to use the DB2 library . . . . . . . . . . . . . . . . . . . . . . . . . . 959

    Notices . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 963Programming Interface Information . . . . . . . . . . . . . . . . . . . . . . . . . . . 965

    General-use Programming Interface and Associated Guidance Information . . . . . . . . . . . . . 965Product-sensitive Programming Interface and Associated Guidance Information . . . . . . . . . . . 965

    Trademarks . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 965

    Glossary . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 967

    Index . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1011

    Contents xv

    ||

    ||||||||||

  • xvi Administration Guide

  • About this information

    This information provides guidance information that you can use to perform avariety of administrative tasks with DB2® for z/OS® (DB2).

    Information about DB2 concepts, which was present in previous editions of thisbook, is now provided in Introduction to DB2 for z/OS.

    This information assumes that your DB2 subsystem is running in Version 9.1new-function mode. Generally, new functions that are described, including changesto existing functions, statements, and limits, are available only in new-functionmode. Two exceptions to this general statement are new and changed utilities andoptimization enhancements, which are also available in conversion mode unlessstated otherwise.

    Who should read this informationThis information is primarily intended for system and database administrators. Itassumes that the user is familiar with:v The basic concepts and facilities of DB2v Time Sharing Option (TSO) and Interactive System Productivity Facility (ISPF)v The basic concepts of Structured Query Language (SQL)v The basic concepts of Customer Information Control System (CICS®)v The basic concepts of Information Management System (IMS™)v How to define and allocate z/OS data sets using job control language (JCL).

    Certain tasks require additional skills, such as knowledge of Transmission ControlProtocol/Internet Protocol (TCP/IP) or Virtual Telecommunications Access Method(VTAM®) to set up communication between DB2 subsystems, or knowledge of theIBM® System Modification Program (SMP/E) to install IBM licensed programs.

    DB2 Utilities Suite

    Important: In this version of DB2 for z/OS, the DB2 Utilities Suite is available asan optional product. You must separately order and purchase a license to suchutilities, and discussion of those utility functions in this publication is not intendedto otherwise imply that you have a license to them.

    The DB2 Utilities Suite is designed to work with the DFSORT™ program, whichyou are licensed to use in support of the DB2 utilities even if you do not otherwiselicense DFSORT for general use. If your primary sort product is not DFSORT,consider the following informational APARs mandatory reading:v II14047/II14213: USE OF DFSORT BY DB2 UTILITIESv II13495: HOW DFSORT TAKES ADVANTAGE OF 64-BIT REAL

    ARCHITECTURE

    These informational APARs are periodically updated.Related information

    DB2 utilities packaging (Utility Guide)

    © Copyright IBM Corp. 1982, 2008 xvii

    http://publib.boulder.ibm.com/infocenter/dzichelp/v2r2/topic/com.ibm.db29.doc.ugref/db2z_utlpackaging.htm

  • Terminology and citationsIn this information, DB2 Version 9.1 for z/OS is referred to as ″DB2 for z/OS.″ Incases where the context makes the meaning clear, DB2 for z/OS is referred to as″DB2.″ When this information refers to titles of DB2 for z/OS books, a short title isused. (For example, ″See DB2 SQL Reference″ is a citation to IBM DB2 Version 9.1 forz/OS SQL Reference.)

    When referring to a DB2 product other than DB2 for z/OS, this information usesthe product’s full name to avoid ambiguity.

    The following terms are used as indicated:

    DB2 Represents either the DB2 licensed program or a particular DB2 subsystem.

    OMEGAMON®

    Refers to any of the following products:v IBM Tivoli® OMEGAMON XE for DB2 Performance Expert on z/OSv IBM Tivoli OMEGAMON XE for DB2 Performance Monitor on z/OSv IBM DB2 Performance Expert for Multiplatforms and Workgroupsv IBM DB2 Buffer Pool Analyzer for z/OS

    C, C++, and C languageRepresent the C or C++ programming language.

    CICS Represents CICS Transaction Server for z/OS.

    IMS Represents the IMS Database Manager or IMS Transaction Manager.

    MVS™ Represents the MVS element of the z/OS operating system, which isequivalent to the Base Control Program (BCP) component of the z/OSoperating system.

    RACF®

    Represents the functions that are provided by the RACF component of thez/OS Security Server.

    Accessibility features for DB2 Version 9.1 for z/OSAccessibility features help a user who has a physical disability, such as restrictedmobility or limited vision, to use information technology products successfully.

    Accessibility features

    The following list includes the major accessibility features in z/OS products,including DB2 Version 9.1 for z/OS. These features support:v Keyboard-only operation.v Interfaces that are commonly used by screen readers and screen magnifiers.v Customization of display attributes such as color, contrast, and font size

    Tip: The Information Management Software for z/OS Solutions InformationCenter (which includes information for DB2 Version 9.1 for z/OS) and its relatedpublications are accessibility-enabled for the IBM Home Page Reader. You canoperate all features using the keyboard instead of the mouse.

    Keyboard navigation

    You can access DB2 Version 9.1 for z/OS ISPF panel functions by using a keyboardor keyboard shortcut keys.

    xviii Administration Guide

    |

  • For information about navigating the DB2 Version 9.1 for z/OS ISPF panels usingTSO/E or ISPF, refer to the z/OS TSO/E Primer, the z/OS TSO/E User’s Guide, andthe z/OS ISPF User’s Guide. These guides describe how to navigate each interface,including the use of keyboard shortcuts or function keys (PF keys). Each guideincludes the default settings for the PF keys and explains how to modify theirfunctions.

    Related accessibility information

    Online documentation for DB2 Version 9.1 for z/OS is available in the InformationManagement Software for z/OS Solutions Information Center, which is available atthe following Web site: http://publib.boulder.ibm.com/infocenter/dzichelp

    IBM and accessibility

    See the IBM Accessibility Center at http://www.ibm.com/able for more informationabout the commitment that IBM has to accessibility.

    How to send your commentsYour feedback helps IBM to provide quality information. Please send anycomments that you have about this book or other DB2 for z/OS documentation.You can use the following methods to provide comments:v Send your comments by e-mail to [email protected] and include the name

    of the product, the version number of the product, and the number of the book.If you are commenting on specific text, please list the location of the text (forexample, a chapter and section title or a help topic title).

    v You can send comments from the Web. Visit the DB2 for z/OS - TechnicalResources Web site at:

    http://www.ibm.com/support/docview.wss?&uid=swg27011656

    This Web site has an online reader comment form that you can use to sendcomments.

    v You can also send comments by using the feedback link at the footer of eachpage in the Information Management Software for z/OS Solutions InformationCenter at http://publib.boulder.ibm.com/infocenter/db2zhelp.

    How to read syntax diagramsCertain conventions apply to the syntax diagrams that are used in IBMdocumentation.

    Apply the following rules when reading the syntax diagrams that are used in DB2for z/OS documentation:v Read the syntax diagrams from left to right, from top to bottom, following the

    path of the line.The ��─── symbol indicates the beginning of a statement.The ───� symbol indicates that the statement syntax is continued on the nextline.The �─── symbol indicates that a statement is continued from the previous line.The ───�� symbol indicates the end of a statement.

    v Required items appear on the horizontal line (the main path).

    About this information xix

  • �� required_item ��

    v Optional items appear below the main path.

    �� required_itemoptional_item

    ��

    If an optional item appears above the main path, that item has no effect on theexecution of the statement and is used only for readability.

    ��optional_item

    required_item ��

    v If you can choose from two or more items, they appear vertically, in a stack.If you must choose one of the items, one item of the stack appears on the mainpath.

    �� required_item required_choice1required_choice2

    ��

    If choosing one of the items is optional, the entire stack appears below the mainpath.

    �� required_itemoptional_choice1optional_choice2

    ��

    If one of the items is the default, it appears above the main path and theremaining choices are shown below.

    �� required_itemdefault_choice

    optional_choiceoptional_choice

    ��

    v An arrow returning to the left, above the main line, indicates an item that can berepeated.

    �� required_item � repeatable_item ��

    If the repeat arrow contains a comma, you must separate repeated items with acomma.

    �� required_item �

    ,

    repeatable_item ��

    A repeat arrow above a stack indicates that you can repeat the items in thestack.

    v Sometimes a diagram must be split into fragments. The syntax fragment isshown separately from the main syntax diagram, but the contents of thefragment should be read as if they are on the main path of the diagram.

    xx Administration Guide

    |||

  • �� required_item fragment-name ��

    fragment-name:

    required_itemoptional_name

    v With the exception of XPath keywords, keywords appear in uppercase (forexample, FROM). Keywords must be spelled exactly as shown. XPath keywordsare defined as lowercase names, and must be spelled exactly as shown. Variablesappear in all lowercase letters (for example, column-name). They representuser-supplied names or values.

    v If punctuation marks, parentheses, arithmetic operators, or other such symbolsare shown, you must enter them as part of the syntax.

    About this information xxi

    ||||||||||||||

    |

    ||||||||||||||||

    |

    |||

  • xxii Administration Guide

  • Part 1. Designing a database

    © Copyright IBM Corp. 1982, 2008 1

  • 2 Administration Guide

  • Chapter 1. Database objects and relationships

    The two general tasks necessary to design a database are logical data modelingand physical data modeling.

    In logical data modeling, you design a model of the data without paying attentionto specific functions and capabilities of the DBMS that will store the data. In fact,you could even build a logical data model without knowing which DBMS you willuse.

    Physical data modeling begins when you move closer to a physicalimplementation. The primary purpose of the physical design stage is to optimizeperformance while ensuring the integrity of the data.

    Logical database design with the entity-relationship modelBefore you implement a database, you should plan or design the database so thatit satisfies all requirements.

    Designing and implementing a successful database, one that satisfies the needs ofan organization, requires a logical data model. Logical data modeling is the processof documenting the comprehensive business information requirements in anaccurate and consistent format. Analysts who do data modeling define the dataitems and the business rules that affect those data items. The process of datamodeling acknowledges that business data is a vital asset that the organizationneeds to understand and carefully manage. This section contains information thatwas adapted from Handbook of Relational Database Design.

    Consider the following business facts that a manufacturing company needs torepresent in its data model:v Customers purchase productsv Products consist of partsv Suppliers manufacture partsv Warehouses store partsv Transportation vehicles move the parts from suppliers to warehouses and then

    to manufacturers

    These are all business facts that a manufacturing company’s logical data modelneeds to include. Many people inside and outside the company rely oninformation that is based on these facts. Many reports include data about thesefacts.

    Any business, not just manufacturing companies, can benefit from the task of datamodeling. Database systems that supply information to decision makers,customers, suppliers, and others are more successful if their foundation is a sounddata model.

    Modeling your dataData analysts can perform the task of data modeling in a variety of ways.

    Many data analysts follow these steps:

    © Copyright IBM Corp. 1982, 2008 3

  • 1. Build critical user views.a. Carefully examining a single business activity or function.b. Develop a user view, which is the model or representation of critical

    information that the business activity requires.This initial stage of the data modeling process is highly interactive. Becausedata analysts cannot fully understand all areas of the business that they aremodeling, they work closely with the actual users. Working together,analysts and users define the major entities (significant objects of interest)and determine the general relationships between these entities.In a later stage, the analyst combines each individual user view with all theother user views into a consolidated logical data model.

    2. Add keys to user viewsKey business rules affect insert, update, and delete operations on the data. Forexample, a business rule might require that each customer entity have at leastone unique identifier. Any attempt to insert or update a customer identifier thatmatches another customer identifier is not valid. In a data model, a uniqueidentifier is called a primary key.

    3. Add detail to user views and validate them.a. Add other descriptive details that are less vital.b. Associate these descriptive details, called attributes, to the entities.

    For example, a customer entity probably has an associated phone number.The phone number is a non-key attribute of the customer entity.

    c. Validate all the user viewsTo validate the views, analysts use the normalization process and processmodels. Process models document the details of how the business will usethe data.

    4. Determine additional business rules that affect attributes.a. Clarify the data-driven business rules.

    Data-driven business rules are constraints on particular data values. Theseconstraints need to be true, regardless of any particular processingrequirements.The advantage to defining data-driven business rules during the datadesign stage, rather than during application design is that programmers ofmany applications don’t need to write code to enforce these business rules.For example, Assume that a business rule requires that a customer entityhave a phone number, an address, or both. If this rule doesn’t apply to thedata itself, programmers must develop, test, and maintain applications thatverify the existence of one of these attributes. Data-driven businessrequirements have a direct relationship with the data, thereby relievingprogrammers from extra work.

    5. Integrate user views.a. Combine into a consolidated logical data model the newly created different

    user views.b. Integrate other data models that already exist in the organization with the

    new consolidated logical data model.At this stage, analysts also strive to make their data model flexible so that itcan support the current business environment and possible future changes. Forexample, assume that a retail company operates in a single country and thatbusiness plans include expansion to other countries. Armed with knowledge ofthese plans, analysts can build the model so that it is flexible enough tosupport expansion into other countries.

    4 Administration Guide

  • Recommendations for logical data modelingTo build sound data models, analysts follow a well-planned methodology.

    Follow these recommendation for building quality data models:v Work interactively with the users as much as possible.v Use diagrams to represent as much of the logical data model as possible.v Build a data dictionary to supplement the logical data model diagrams.

    A data dictionary is a repository of information about an organization’sapplication programs, databases, logical data models, users, and authorizations.A data dictionary can be manual or automated.

    Practical examples of data modelingUse this scenario of real-life data modeling to better understand the key activitiesnecessary for creating sound data models.

    You begin by defining your entities, the significant objects of interest. Entities arethe things about which you want to store information. For example, you mightwant to define an entity, called EMPLOYEE, for employees because you need tostore information about everyone who works for your organization. You might alsodefine an entity, called DEPARTMENT, for departments.

    Next, you define primary keys for your entities. A primary key is a uniqueidentifier for an entity. In the case of the EMPLOYEE entity, you probably need tostore a large amount of information. However, most of this information (such asgender, birth date, address, and hire date) would not be a good choice for theprimary key. In this case, you could choose a unique employee ID or number(EMPLOYEE_NUMBER) as the primary key. In the case of the DEPARTMENTentity, you could use a unique department number (DEPARTMENT_NUMBER) asthe primary key.

    After you have decided on the entities and their primary keys, you can define therelationships that exist between the entities. The relationships are based on theprimary keys. If you have an entity for EMPLOYEE and another entity forDEPARTMENT, the relationship that exists is that employees are assigned todepartments. You can read more about this topic in the next section.

    After defining the entities, their primary keys, and their relationships, you candefine additional attributes for the entities. In the case of the EMPLOYEE entity,you might define the following additional attributes:v Birth datev Hire datev Home addressv Office phone numberv Genderv Resume

    Lastly, you normalize the data.

    Entities for different types of relationshipsIn a relational database, you can express several types of relationships.

    Chapter 1. Database objects and relationships 5

  • Consider the possible relationships between employees and departments. If a givenemployee can work in only one department, this relationship is one-to-one foremployees. One department usually has many employees; this relationship isone-to-many for departments. Relationships can be one-to-many, many-to-one,one-to-one, or many-to- many.

    Subsections:v “One-to-one relationships”v “One-to-many and many-to-one relationships”v “Many-to-many relationships” on page 7v “Business rules for relationships” on page 7

    The type of a given relationship can vary, depending on the specific environment.If employees of a company belong to several departments, the relationshipbetween employees and departments is many-to-many.

    You need to define separate entities for different types of relationships. Whenmodeling relationships, you can use diagram conventions to depict relationshipsby using different styles of lines to connect the entities.

    One-to-one relationships

    When you are doing logical database design, one-to-one relationships arebidirectional relationships, which means that they are single-valued in bothdirections. For example, an employee has a single resume; each resume belongs toonly one person. The previous figure illustrates that a one-to-one relationship existsbetween the two entities. In this case, the relationship reflects the rules that anemployee can have only one resume and that a resume can belong to only oneemployee.

    One-to-many and many-to-one relationships

    A one-to-many relationship occurs when one entity has a multivalued relationshipwith another entity. In the following figure, you see that a one-to-manyrelationship exists between the two entities—employee and department. This figurereinforces the business rules that a department can have many employees, but thateach individual employee can work for only one department.

    Employee ResumeA resume is owned

    by an employee

    An employeehas a resume

    Figure 1. Assigning one-to-one facts to an entity

    Employee DepartmentOne department can

    have many employees

    Many employees workfor one department

    Figure 2. Assigning many-to-one facts to an entity

    6 Administration Guide

  • Many-to-many relationships

    A many-to-many relationship is a relationship that is multivalued in bothdirections. The following figure illustrates this kind of relationship. An employeecan work on more than one project, and a project can have more than oneemployee assigned.

    Business rules for relationships

    Whether a given relationship is one-to-one, one-to-many, many-to-one, ormany-to-many, your relationships need to make good business sense. Therefore,database designers and data analysts can be more effective when they have a goodunderstanding of the business. If they understand the data, the applications, andthe business rules, they can succeed in building a sound database design.

    When you define relationships, you have a big influence on how smoothly yourbusiness runs. If you don’t do a good job at this task, your database and associatedapplications are likely to have many problems, some of which may not manifestthemselves for years.

    Entity attributesWhen you define attributes for the entities, you generally work with the dataadministrato