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

Db2 v9 admin guide z os

Embed Size (px)

Citation preview

  1. 1. DB2 Version 9.1 for z/OS Administration Guide SC18-9840-03
  2. 2. DB2 Version 9.1 for z/OS Administration Guide SC18-9840-03
  3. 3. Note Before using this information and the product it supports, be sure to read the general information under Notices at the end 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 any subsequent releases until otherwise indicated in new editions. Make sure you are using the correct edition for the level 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 caption indicates 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 Contract with IBM Corp.
  4. 4. Contents About this information . . . . . . . . . . . . . . . . . . . . . . . . . . . . xvii Who should read this information . . . . . . . . . . . . . . . . . . . . . . . . . . . xvii DB2 Utilities Suite . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . xvii Terminology and citations . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . xviii Accessibility features for DB2 Version 9.1 for z/OS . . . . . . . . . . . . . . . . . . . . . xviii How to send your comments . . . . . . . . . . . . . . . . . . . . . . . . . . . . . xix How to read syntax diagrams . . . . . . . . . . . . . . . . . . . . . . . . . . . . . xix Part 1. Designing a database . . . . . . . . . . . . . . . . . . . . . . . . . 1 Chapter 1. Database objects and relationships . . . . . . . . . . . . . . . . . . . 3 Logical database design with the entity-relationship model . . . . . . . . . . . . . . . . . . . . 3 Modeling your data . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 3 Recommendations for logical data modeling. . . . . . . . . . . . . . . . . . . . . . . . 5 Practical examples of data modeling . . . . . . . . . . . . . . . . . . . . . . . . . . 5 Entities for different types of relationships . . . . . . . . . . . . . . . . . . . . . . . . 5 Entity attributes . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 7 Entity normalization . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 9 Logical database design with Unified Modeling Language. . . . . . . . . . . . . . . . . . . . 13 Physical database design . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 15 Denormalization of tables . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 15 Views as a way to customize what data users see . . . . . . . . . . . . . . . . . . . . . 17 Indexes on table columns. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 18 Chapter 2. Implementing your database design . . . . . . . . . . . . . . . . . . 19 Implementing DB2 databases . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 19 Creating DB2 databases . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 19 Dropping DB2 databases . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 20 Implementing DB2 storage groups. . . . . . . . . . . . . . . . . . . . . . . . . . . . 20 Advantages of storage groups . . . . . . . . . . . . . . . . . . . . . . . . . . . . 20 Creating DB2 storage groups . . . . . . . . . . . . . . . . . . . . . . . . . . . . 22 Enabling SMS to control DB2 storage groups . . . . . . . . . . . . . . . . . . . . . . . 22 Deferring allocation of DB2-managed data sets . . . . . . . . . . . . . . . . . . . . . . 22 How DB2 extends data sets . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 23 DB2 space allocation . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 24 Managing DB2 data sets with DFSMShsm . . . . . . . . . . . . . . . . . . . . . . . . 28 Managing your own data sets . . . . . . . . . . . . . . . . . . . . . . . . . . . . 32 Defining index space storage . . . . . . . . . . . . . . . . . . . . . . . . . . . . 35 Creating EA-enabled table spaces and index spaces . . . . . . . . . . . . . . . . . . . . . 36 Implementing DB2 table spaces. . . . . . . . . . . . . . . . . . . . . . . . . . . . . 37 Creating a table space explicitly . . . . . . . . . . . . . . . . . . . . . . . . . . . 37 Guidelines and recommendations for table spaces . . . . . . . . . . . . . . . . . . . . . 38 Examples of table space definitions . . . . . . . . . . . . . . . . . . . . . . . . . . 45 Implementing DB2 tables . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 47 Creating base tables . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 47 Guidelines for table names . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 48 Creating temporary tables . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 48 Creating materialized query tables. . . . . . . . . . . . . . . . . . . . . . . . . . . 52 Creating tables that use table-controlled partitioning. . . . . . . . . . . . . . . . . . . . . 53 Creating tables that use index-controlled partitioning . . . . . . . . . . . . . . . . . . . . 56 Creating a clone table . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 56 Implementing DB2 views . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 57 Creating DB2 views . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 57 Guidelines for view names . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 59 Copyright IBM Corp. 1982, 2008 iii ||
  5. 5. How DB2 inserts and updates data through views . . . . . . . . . . . . . . . . . . . . . 59 Dropping DB2 views . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 60 Implementing DB2 indexes . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 60 Creating DB2 indexes . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 60 Guidelines for defining indexes. . . . . . . . . . . . . . . . . . . . . . . . . . . . 60 How DB2 implicitly creates an index . . . . . . . . . . . . . . . . . . . . . . . . . . 62 Recommendations for index page size . . . . . . . . . . . . . . . . . . . . . . . . . 62 Index versions . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 63 Compressing indexes . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 64 Implementing DB2 schemas . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 65 Creating a schema by using the schema processor . . . . . . . . . . . . . . . . . . . . . 65 Processing schema definitions . . . . . . . . . . . . . . . . . . . . . . . . . . . . 66 Loading data into DB2 tables . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 66 Loading data with the LOAD utility . . . . . . . . . . . . . . . . . . . . . . . . . . 67 Loading data by using the INSERT SQL statement . . . . . . . . . . . . . . . . . . . . . 70 Loading data from DL/I . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 72 Implementing DB2 stored procedures. . . . . . . . . . . . . . . . . . . . . . . . . . . 72 Creating stored procedures . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 72 Deleting stored procedures . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 72 Implementing DB2 user-defined functions . . . . . . . . . . . . . . . . . . . . . . . . . 72 Creating user-defined functions. . . . . . . . . . . . . . . . . . . . . . . . . . . . 73 Deleting user-defined functions. . . . . . . . . . . . . . . . . . . . . . . . . . . . 73 Estimating disk storage for user data . . . . . . . . . . . . . . . . . . . . . . . . . . . 73 General approach to estimating storage . . . . . . . . . . . . . . . . . . . . . . . . . 73 Calculating the space required for a table . . . . . . . . . . . . . . . . . . . . . . . . 75 Calculating the space required for an index. . . . . . . . . . . . . . . . . . . . . . . . 78 Saving space with data compression . . . . . . . . . . . . . . . . . . . . . . . . . . . 83 Compressing data . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 83 Calculating the space that is required for a dictionary . . . . . . . . . . . . . . . . . . . . 83 Chapter 3. Altering your database design . . . . . . . . . . . . . . . . . . . . . 87 Altering DB2 databases . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 87 ALTER DATABASE options . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 87 Altering DB2 storage groups. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 88 Letting SMS manage your DB2 storage groups . . . . . . . . . . . . . . . . . . . . . . 88 Adding or removing volumes from a DB2 storage group . . . . . . . . . . . . . . . . . . . 88 Altering table spaces . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 89 Changing the logging attribute . . . . . . . . . . . . . . . . . . . . . . . . . . . . 90 Changing the space allocation for user-managed data sets . . . . . . . . . . . . . . . . . . . 91 Dropping, recreating, or converting a table space . . . . . . . . . . . . . . . . . . . . . . 92 Rebalancing data in partitioned table spaces . . . . . . . . . . . . . . . . . . . . . . . 93 Altering a page set to contain DB2-defined extents . . . . . . . . . . . . . . . . . . . . . 94 Altering DB2 tables. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 94 Adding a new column to a table . . . . . . . . . . . . . . . . . . . . . . . . . . . 95 Specifying a default value when altering a column . . . . . . . . . . . . . . . . . . . . . 96 Altering the data type of a column . . . . . . . . . . . . . . . . . . . . . . . . . . 97 Altering a table for referential integrity . . . . . . . . . . . . . . . . . . . . . . . . . 102 Adding or dropping table check constraints . . . . . . . . . . . . . . . . . . . . . . . 105 Adding a partition . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 106 Altering partitions. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 108 Adding XML columns . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 114 Altering materialized query tables . . . . . . . . . . . . . . . . . . . . . . . . . . 115 Altering the assignment of a validation routine . . . . . . . . . . . . . . . . . . . . . . 117 Altering a table for capture of changed data . . . . . . . . . . . . . . . . . . . . . . . 118 Changing an edit procedure or a field procedure . . . . . . . . . . . . . . . . . . . . . 119 Altering the subtype of a string column . . . . . . . . . . . . . . . . . . . . . . . . 119 Altering the attributes of an identity column . . . . . . . . . . . . . . . . . . . . . . . 119 Changing data types by dropping and re-creating the table . . . . . . . . . . . . . . . . . . 120 Moving a table to a table space of a different page size . . . . . . . . . . . . . . . . . . . 123 Altering DB2 views . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 124 Altering views by using the INSTEAD OF trigger . . . . . . . . . . . . . . . . . . . . . 124 iv Administration Guide || || || || || ||
  6. 6. Altering DB2 indexes. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 125 Adding a column to an index when you add the column to a table . . . . . . . . . . . . . . . 126 Altering how varying-length index columns are stored . . . . . . . . . . . . . . . . . . . 126 Altering the clustering of an index . . . . . . . . . . . . . . . . . . . . . . . . . . 127 Dropping and redefining a DB2 index . . . . . . . . . . . . . . . . . . . . . . . . . 128 Reorganizing indexes. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 128 Recycling index version numbers. . . . . . . . . . . . . . . . . . . . . . . . . . . 128 Altering stored procedures . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 129 Altering user-defined functions . . . . . . . . . . . . . . . . . . . . . . . . . . . . 130 Altering implicitly created XML objects. . . . . . . . . . . . . . . . . . . . . . . . . . 130 Changing the high-level qualifier for DB2 data sets. . . . . . . . . . . . . . . . . . . . . . 131 Defining a new integrated catalog alias. . . . . . . . . . . . . . . . . . . . . . . . . 132 Changing the qualifier for system data sets . . . . . . . . . . . . . . . . . . . . . . . 132 Changing qualifiers for other databases and user data sets . . . . . . . . . . . . . . . . . . 135 Tools for moving DB2 data . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 138 Moving DB2 data . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 140 Moving a DB2 data set . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 141 Scenario: Moving from index-controlled to table-controlled partitioning . . . . . . . . . . . . . . 142 Part 2. Security and auditing . . . . . . . . . . . . . . . . . . . . . . . . 145 Chapter 4. Getting started with DB2 security . . . . . . . . . . . . . . . . . . . 147 DB2 security solutions . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 147 Whats new in DB2 Version 9.1 security? . . . . . . . . . . . . . . . . . . . . . . . . . 147 DB2 data access control . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 148 ID-based privilege control within DB2 . . . . . . . . . . . . . . . . . . . . . . . . . 149 Role-based privilege control within DB2 . . . . . . . . . . . . . . . . . . . . . . . . 150 Privileges and authorities . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 150 Ownership-based privilege control within DB2 . . . . . . . . . . . . . . . . . . . . . . 151 Multilevel security. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 151 Authorization control through exit routines . . . . . . . . . . . . . . . . . . . . . . . 151 DB2 subsystem access control . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 151 Managing access requests from local applications . . . . . . . . . . . . . . . . . . . . . 152 Managing access requests from remote applications . . . . . . . . . . . . . . . . . . . . 152 Data set protection . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 152 RACF for data protection . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 152 Data encryption . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 153 Scenario: Securing data access at Spiffy Computer . . . . . . . . . . . . . . . . . . . . . . 153 Determining security objectives . . . . . . . . . . . . . . . . . . . . . . . . . . . 153 Securing manager access to employee data . . . . . . . . . . . . . . . . . . . . . . . 154 Securing access to payroll operations and management . . . . . . . . . . . . . . . . . . . 157 Managing access privileges of other authorities . . . . . . . . . . . . . . . . . . . . . . 160 Chapter 5. Managing access through authorization IDs or roles. . . . . . . . . . . 165 Authorization IDs and roles . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 166 Authorization IDs . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 166 Roles in a trusted context . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 166 Privileges and authorities . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 167 Explicit privileges . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 167 Implicit privileges through object ownership . . . . . . . . . . . . . . . . . . . . . . . 172 Administrative authorities . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 173 Utility authorities for DB2 catalog and directory. . . . . . . . . . . . . . . . . . . . . . 179 Privileges by authorization ID and authority . . . . . . . . . . . . . . . . . . . . . . . 180 Managing explicit privileges . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 185 Granting privileges to a role . . . . . . . . . . . . . . . . . . . . . . . . . . . . 186 Granting privileges to the PUBLIC ID . . . . . . . . . . . . . . . . . . . . . . . . . 186 Granting privileges to remote users . . . . . . . . . . . . . . . . . . . . . . . . . . 187 Granting privileges through views . . . . . . . . . . . . . . . . . . . . . . . . . . 187 Granting privileges with the GRANT statement . . . . . . . . . . . . . . . . . . . . . . 188 Revoking privileges with the REVOKE statement . . . . . . . . . . . . . . . . . . . . . 193 Contents v || || || || || ||
  7. 7. Managing implicit privileges . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 201 Managing implicit privileges through object ownership . . . . . . . . . . . . . . . . . . . 202 Managing implicit privileges through plan or package ownership . . . . . . . . . . . . . . . . 204 Managing implicit privileges through routines . . . . . . . . . . . . . . . . . . . . . . 211 Retrieving privilege records in the DB2 catalog . . . . . . . . . . . . . . . . . . . . . . . 224 Catalog tables with privilege records . . . . . . . . . . . . . . . . . . . . . . . . . 224 Retrieving all authorization IDs or roles with granted privileges . . . . . . . . . . . . . . . . 225 Retrieving multiple grants of the same privilege. . . . . . . . . . . . . . . . . . . . . . 225 Retrieving all authorization IDs or roles with the DBADM authority . . . . . . . . . . . . . . . 226 Retrieving all IDs or roles with access to the same table . . . . . . . . . . . . . . . . . . . 226 Retrieving all IDs or roles with access to the same routine . . . . . . . . . . . . . . . . . . 227 Retrieving tables or views accessible by an ID . . . . . . . . . . . . . . . . . . . . . . 228 Retrieving plans or packages with access to the same table . . . . . . . . . . . . . . . . . . 228 Retrieving privilege information through views . . . . . . . . . . . . . . . . . . . . . . 229 Implementing multilevel security with DB2 . . . . . . . . . . . . . . . . . . . . . . . . 229 Multilevel security. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 230 Mandatory access checking. . . . . . . . . . . . . . . . . . . . . . . . . . . . . 233 Implementing multilevel security at the object level . . . . . . . . . . . . . . . . . . . . 235 Implementing multilevel security with row-level granularity . . . . . . . . . . . . . . . . . 236 Restricting access to the security label column . . . . . . . . . . . . . . . . . . . . . . 239 Managing data in a multilevel-secure environment . . . . . . . . . . . . . . . . . . . . . 239 Implementing multilevel security in a distributed environment. . . . . . . . . . . . . . . . . 247 Chapter 6. Managing access through RACF . . . . . . . . . . . . . . . . . . . 249 Establishing RACF protection for DB2 . . . . . . . . . . . . . . . . . . . . . . . . . . 249 Defining DB2 resources to RACF . . . . . . . . . . . . . . . . . . . . . . . . . . . 250 Permitting RACF access . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 252 Protecting stored procedures . . . . . . . . . . . . . . . . . . . . . . . . . . . . 259 Protecting connection requests that use the TCP/IP protocol . . . . . . . . . . . . . . . . . 261 Establishing Kerberos authentication through RACF . . . . . . . . . . . . . . . . . . . . 262 Implementing DB2 support for enterprise identity mapping . . . . . . . . . . . . . . . . . . . 263 Configuring the z/OS LDAP server . . . . . . . . . . . . . . . . . . . . . . . . . . 264 Setting up RACF for the z/OS LDAP server . . . . . . . . . . . . . . . . . . . . . . . 265 Setting up the EIM domain controller . . . . . . . . . . . . . . . . . . . . . . . . . 266 Adding the SAF user mapping plug-in data set to LNKLIST . . . . . . . . . . . . . . . . . 267 Managing connection requests from local applications. . . . . . . . . . . . . . . . . . . . . 267 Processing of connection requests . . . . . . . . . . . . . . . . . . . . . . . . . . 268 Using secondary IDs for connection requests . . . . . . . . . . . . . . . . . . . . . . . 269 Processing of sign-on requests . . . . . . . . . . . . . . . . . . . . . . . . . . . . 270 Using secondary IDs for sign-on requests . . . . . . . . . . . . . . . . . . . . . . . . 272 Using sample connection and sign-on exit routines for CICS transactions . . . . . . . . . . . . . 273 Managing connection requests from remote applications . . . . . . . . . . . . . . . . . . . . 273 Security mechanisms for DRDA and SNA . . . . . . . . . . . . . . . . . . . . . . . . 273 Communications database for the server . . . . . . . . . . . . . . . . . . . . . . . . 274 Enabling change of user passwords . . . . . . . . . . . . . . . . . . . . . . . . . . 277 Authorization failure code . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 277 Managing inbound SNA-based connection requests . . . . . . . . . . . . . . . . . . . . 277 Managing inbound TCP/IP-based connection requests . . . . . . . . . . . . . . . . . . . 284 Managing denial-of-service attacks . . . . . . . . . . . . . . . . . . . . . . . . . . 286 Managing outbound connection requests . . . . . . . . . . . . . . . . . . . . . . . . 287 Translating outbound IDs . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 296 Sending passwords . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 298 Chapter 7. Managing access through trusted contexts. . . . . . . . . . . . . . . 301 Trusted contexts . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 301 Trusted connections . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 301 Defining trusted contexts . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 302 Creating local trusted connections . . . . . . . . . . . . . . . . . . . . . . . . . . . 303 Establishing remote trusted connections by DB2 for z/OS requesters . . . . . . . . . . . . . . . . 303 Establishing remote trusted connections to DB2 for z/OS servers . . . . . . . . . . . . . . . . . 304 vi Administration Guide || || || || || || || || || || || ||
  8. 8. Switching users of a trusted connection . . . . . . . . . . . . . . . . . . . . . . . . . 305 Reusing a local trusted connection through the DSN command processor and DB2I . . . . . . . . . . 305 Reusing a remote trusted connection by DB2 for z/OS requesters . . . . . . . . . . . . . . . . 306 Reusing a remote trusted connection through DB2 for z/OS servers . . . . . . . . . . . . . . . 306 Reusing a local trusted connection through RRSAF . . . . . . . . . . . . . . . . . . . . . 306 Reusing a local trusted connection through the SQL CONNECT statement . . . . . . . . . . . . . 307 Defining external security profiles . . . . . . . . . . . . . . . . . . . . . . . . . . . 307 Enabling users to perform actions on behalf of others . . . . . . . . . . . . . . . . . . . . . 308 Performing tasks on objects for other users . . . . . . . . . . . . . . . . . . . . . . . . 308 Chapter 8. Managing access through data definition control . . . . . . . . . . . . 311 Data definition statements . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 311 Data definition control support . . . . . . . . . . . . . . . . . . . . . . . . . . . . 311 Registration tables. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 312 ART columns . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 312 ORT columns . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 313 Installing data definition control support . . . . . . . . . . . . . . . . . . . . . . . . . 314 Enabling data definition control . . . . . . . . . . . . . . . . . . . . . . . . . . . . 314 Controlling data definition by application name . . . . . . . . . . . . . . . . . . . . . . 314 Controlling data definition by application name with exceptions . . . . . . . . . . . . . . . . 315 Controlling data definition by object name . . . . . . . . . . . . . . . . . . . . . . . 317 Controlling data definition by object name with exceptions . . . . . . . . . . . . . . . . . . 318 Registering object sets . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 319 Disabling data definition control . . . . . . . . . . . . . . . . . . . . . . . . . . . . 320 Managing registration tables and indexes . . . . . . . . . . . . . . . . . . . . . . . . . 321 Creating registration tables and indexes . . . . . . . . . . . . . . . . . . . . . . . . 321 Naming registration tables and indexes. . . . . . . . . . . . . . . . . . . . . . . . . 322 Dropping registration tables and indexes . . . . . . . . . . . . . . . . . . . . . . . . 322 Creating table spaces for registration tables . . . . . . . . . . . . . . . . . . . . . . . 322 Adding columns to registration tables . . . . . . . . . . . . . . . . . . . . . . . . . 322 Updating registration tables . . . . . . . . . . . . . . . . . . . . . . . . . . . . 323 Chapter 9. Protecting data through encryption and RACF . . . . . . . . . . . . . 325 Encrypting your data through DB2 built-in functions . . . . . . . . . . . . . . . . . . . . . 325 Defining columns for encrypted data . . . . . . . . . . . . . . . . . . . . . . . . . 325 Defining column-level encryption . . . . . . . . . . . . . . . . . . . . . . . . . . 326 Defining value-level encryption . . . . . . . . . . . . . . . . . . . . . . . . . . . 327 Using predicates for encrypted data . . . . . . . . . . . . . . . . . . . . . . . . . . 329 Optimizing performance of encrypted data . . . . . . . . . . . . . . . . . . . . . . . 329 Encrypting your data with Secure Socket Layer support . . . . . . . . . . . . . . . . . . . . 331 AT-TLS configuration. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 331 Configuring the DB2 server for SSL . . . . . . . . . . . . . . . . . . . . . . . . . . 332 Configuring the DB2 requester for SSL . . . . . . . . . . . . . . . . . . . . . . . . . 333 Protecting data sets through RACF . . . . . . . . . . . . . . . . . . . . . . . . . . . 334 Adding groups to control DB2 data sets . . . . . . . . . . . . . . . . . . . . . . . . 334 Creating generic profiles for data sets . . . . . . . . . . . . . . . . . . . . . . . . . 334 Authorizing DB2 IDs to use data set profiles . . . . . . . . . . . . . . . . . . . . . . . 336 Enabling DB2 IDs to create data sets . . . . . . . . . . . . . . . . . . . . . . . . . 336 Chapter 10. Auditing access to DB2. . . . . . . . . . . . . . . . . . . . . . . 337 DB2 audit trace. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 337 Authorization IDs traced by auditing . . . . . . . . . . . . . . . . . . . . . . . . . 338 Audit classes . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 338 Limitations of the audit trace . . . . . . . . . . . . . . . . . . . . . . . . . . . . 339 Auditing in a distributed data environment . . . . . . . . . . . . . . . . . . . . . . . 340 Audit trace records . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 340 Audit trace reports . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 340 Additional sources of audit information . . . . . . . . . . . . . . . . . . . . . . . . . 341 Determining active security measures . . . . . . . . . . . . . . . . . . . . . . . . . . 342 Using DB2 audit trace and trace records . . . . . . . . . . . . . . . . . . . . . . . . . 342 Contents vii || || || || || || || || || || || ||
  9. 9. Starting the audit trace . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 342 Stopping the audit trace . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 343 Auditing specific tables . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 343 Auditing specific IDs or roles . . . . . . . . . . . . . . . . . . . . . . . . . . . . 344 Determining ID privileges and authorities . . . . . . . . . . . . . . . . . . . . . . . . 345 Collecting audit trace records . . . . . . . . . . . . . . . . . . . . . . . . . . . . 345 Formatting audit trace records. . . . . . . . . . . . . . . . . . . . . . . . . . . . 345 Managing data accuracy and consistency . . . . . . . . . . . . . . . . . . . . . . . . . 345 Ensuring data presence and uniqueness . . . . . . . . . . . . . . . . . . . . . . . . 346 Protecting data integrity . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 346 Tracking data changes . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 347 Checking for lost and incomplete transactions . . . . . . . . . . . . . . . . . . . . . . 347 Ensuring data consistency . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 348 Using referential integrity for data consistency . . . . . . . . . . . . . . . . . . . . . . 348 Using locks for data consistency . . . . . . . . . . . . . . . . . . . . . . . . . . . 348 Checking data consistency . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 349 Part 3. Operation and recovery . . . . . . . . . . . . . . . . . . . . . . . 353 Chapter 11. DB2 basic operational concepts . . . . . . . . . . . . . . . . . . . 355 Recommendations for entering commands. . . . . . . . . . . . . . . . . . . . . . . . . 355 DB2 operator commands . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 355 Where DB2 commands are entered . . . . . . . . . . . . . . . . . . . . . . . . . . . 358 Where command responses go . . . . . . . . . . . . . . . . . . . . . . . . . . . . 360 Authorities for DB2 commands . . . . . . . . . . . . . . . . . . . . . . . . . . . . 361 DB2 message identifiers . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 362 Unsolicited DB2 messages . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 363 Operational control options. . . . . . . . . . . . . . . . . . . . . . . . . . . . . 363 Chapter 12. Starting and stopping DB2 . . . . . . . . . . . . . . . . . . . . . 365 Starting DB2. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 365 Messages at start . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 365 Options at start. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 366 Restricting access to data . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 366 Ending the wait state at start . . . . . . . . . . . . . . . . . . . . . . . . . . . . 367 Restart options after an abend. . . . . . . . . . . . . . . . . . . . . . . . . . . . 367 Stopping DB2 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 368 Chapter 13. Submitting work to DB2 . . . . . . . . . . . . . . . . . . . . . . 369 Submitting work by using DB2I . . . . . . . . . . . . . . . . . . . . . . . . . . . . 369 Running TSO application programs . . . . . . . . . . . . . . . . . . . . . . . . . . . 369 DSN subcommands for TSO environments . . . . . . . . . . . . . . . . . . . . . . . 370 Sources that DB2 uses to find authorization access by the application program . . . . . . . . . . . 371 Running IMS application programs . . . . . . . . . . . . . . . . . . . . . . . . . . . 371 Running CICS application programs. . . . . . . . . . . . . . . . . . . . . . . . . . . 372 Running batch application programs . . . . . . . . . . . . . . . . . . . . . . . . . . 372 Running application programs using CAF. . . . . . . . . . . . . . . . . . . . . . . . . 373 Running application programs using RRSAF . . . . . . . . . . . . . . . . . . . . . . . . 373 Chapter 14. Scheduling administrative tasks . . . . . . . . . . . . . . . . . . . 375 Interacting with the administrative task scheduler . . . . . . . . . . . . . . . . . . . . . . 375 Adding a task . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 375 Listing scheduled tasks . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 387 Listing the last execution status of scheduled tasks . . . . . . . . . . . . . . . . . . . . . 391 Removing a scheduled task. . . . . . . . . . . . . . . . . . . . . . . . . . . . . 395 Manually starting the administrative task scheduler . . . . . . . . . . . . . . . . . . . . 397 Manually stopping the administrative task scheduler . . . . . . . . . . . . . . . . . . . . 398 Synchronization between administrative task schedulers in a data sharing environment . . . . . . . . 398 Troubleshooting the administrative task scheduler . . . . . . . . . . . . . . . . . . . . . 399 viii Administration Guide || || || || || || || || || || || || || ||
  10. 10. Architecture of the administrative task scheduler . . . . . . . . . . . . . . . . . . . . . . 402 The lifecycle of the administrative task scheduler . . . . . . . . . . . . . . . . . . . . . 403 Scheduler task lists . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 404 Architecture of the administrative task scheduler in a data sharing environment . . . . . . . . . . . 405 Security guidelines for the administrative task scheduler . . . . . . . . . . . . . . . . . . . . 406 User roles in the administrative task scheduler . . . . . . . . . . . . . . . . . . . . . . 407 Protection of the interface of the administrative task scheduler . . . . . . . . . . . . . . . . . 407 Protection of the resources of the administrative task scheduler . . . . . . . . . . . . . . . . 408 Secure execution of tasks in the administrative task scheduler . . . . . . . . . . . . . . . . . 408 Execution of scheduled tasks in the administrative task scheduler . . . . . . . . . . . . . . . . . 409 Multi-threading in the administrative task scheduler . . . . . . . . . . . . . . . . . . . . 409 Scheduled execution of a stored procedure . . . . . . . . . . . . . . . . . . . . . . . 410 How the administrative task scheduler works with Unicode. . . . . . . . . . . . . . . . . . 411 Scheduled execution of a JCL job . . . . . . . . . . . . . . . . . . . . . . . . . . . 411 Execution of scheduled tasks in a data sharing environment. . . . . . . . . . . . . . . . . . 412 Chapter 15. Monitoring and controlling DB2 and its connections . . . . . . . . . . 413 Controlling DB2 databases and buffer pools . . . . . . . . . . . . . . . . . . . . . . . . 413 Starting databases . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 413 Monitoring databases. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 415 Obtaining information about application programs . . . . . . . . . . . . . . . . . . . . . 417 Obtaining information about and handling pages in error . . . . . . . . . . . . . . . . . . 419 Using the STOP DATABASE command to make objects available . . . . . . . . . . . . . . . . 422 Altering buffer pools . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 423 Monitoring buffer pools . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 423 Controlling user-defined functions . . . . . . . . . . . . . . . . . . . . . . . . . . . 424 Starting user-defined functions . . . . . . . . . . . . . . . . . . . . . . . . . . . 424 Monitoring user-defined functions . . . . . . . . . . . . . . . . . . . . . . . . . . 425 Stopping user-defined functions . . . . . . . . . . . . . . . . . . . . . . . . . . . 425 Controlling DB2 utilities. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 426 Starting online utilities . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 426 Monitoring and changing online utilities . . . . . . . . . . . . . . . . . . . . . . . . 426 Controlling DB2 stand-alone utilities . . . . . . . . . . . . . . . . . . . . . . . . . 427 Controlling the IRLM. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 428 z/OS commands that operate on IRLM. . . . . . . . . . . . . . . . . . . . . . . . . 429 Starting the IRLM . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 430 Stopping the IRLM . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 430 Monitoring threads . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 431 Types of threads . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 431 Output of the DISPLAY THREAD command . . . . . . . . . . . . . . . . . . . . . . . 432 Displaying information about threads . . . . . . . . . . . . . . . . . . . . . . . . . 432 Monitoring all DBMSs in a transaction . . . . . . . . . . . . . . . . . . . . . . . . . 436 Controlling connections . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 438 Controlling TSO connections . . . . . . . . . . . . . . . . . . . . . . . . . . . . 439 Controlling CICS connections . . . . . . . . . . . . . . . . . . . . . . . . . . . . 442 Controlling IMS connections . . . . . . . . . . . . . . . . . . . . . . . . . . . . 447 Controlling RRS connections . . . . . . . . . . . . . . . . . . . . . . . . . . . . 456 Controlling connections to remote systems . . . . . . . . . . . . . . . . . . . . . . . 460 Controlling traces . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 474 Types of DB2 traces . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 474 Diagnostic traces for attachment facilities . . . . . . . . . . . . . . . . . . . . . . . . 474 Controlling the DB2 trace . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 475 Diagnostic trace for the IRLM . . . . . . . . . . . . . . . . . . . . . . . . . . . . 476 Controlling the resource limit facility (governor). . . . . . . . . . . . . . . . . . . . . . . 476 Changing subsystem parameter values . . . . . . . . . . . . . . . . . . . . . . . . . . 477 Chapter 16. Managing the log and the bootstrap data set . . . . . . . . . . . . . 479 How database changes are made . . . . . . . . . . . . . . . . . . . . . . . . . . . . 479 Units of recovery and points of consistency . . . . . . . . . . . . . . . . . . . . . . . 479 How DB2 rolls back work . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 480 Contents ix || || || || || || || || || || || || || || || || ||
  11. 11. How the initial DB2 logging environment is established . . . . . . . . . . . . . . . . . . . 481 How DB2 creates log records . . . . . . . . . . . . . . . . . . . . . . . . . . . . 481 How DB2 writes the active log . . . . . . . . . . . . . . . . . . . . . . . . . . . 481 How DB2 writes (offloads) the archive log . . . . . . . . . . . . . . . . . . . . . . . 482 How DB2 retrieves log records . . . . . . . . . . . . . . . . . . . . . . . . . . . . 487 Managing the log . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 488 Quiescing activity before offloading . . . . . . . . . . . . . . . . . . . . . . . . . . 488 Archiving the log . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 489 Dynamically changing the checkpoint frequency. . . . . . . . . . . . . . . . . . . . . . 490 Setting limits for archive log tape units. . . . . . . . . . . . . . . . . . . . . . . . . 491 Monitoring the system checkpoint . . . . . . . . . . . . . . . . . . . . . . . . . . 491 Displaying log information . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 491 Resetting the log RBA . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 492 Log RBA range . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 492 Resetting the log RBA value in a data sharing environment . . . . . . . . . . . . . . . . . . 493 Resetting the log RBA value in a non-data sharing environment . . . . . . . . . . . . . . . . 493 Canceling and restarting an offload . . . . . . . . . . . . . . . . . . . . . . . . . . . 494 Displaying the status of an offload . . . . . . . . . . . . . . . . . . . . . . . . . . . 494 Discarding archive log records. . . . . . . . . . . . . . . . . . . . . . . . . . . . . 494 Locating archive log data sets . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 495 Management of the bootstrap data set . . . . . . . . . . . . . . . . . . . . . . . . . . 498 Restoring dual mode BSDS . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 498 BSDS copies with archive log data sets . . . . . . . . . . . . . . . . . . . . . . . . . 499 Recommendations for changing the BSDS log inventory . . . . . . . . . . . . . . . . . . . 499 Chapter 17. Restarting DB2 after termination . . . . . . . . . . . . . . . . . . . 501 Methods of restarting. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 501 Types of termination . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 501 Normal restart and recovery . . . . . . . . . . . . . . . . . . . . . . . . . . . . 502 Automatic restart . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 507 Restart in a data sharing environment . . . . . . . . . . . . . . . . . . . . . . . . . 507 Restart implications for table spaces that are not logged . . . . . . . . . . . . . . . . . . . 507 Conditional restart . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 508 Terminating DB2 normally . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 509 Restarting automatically . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 509 Deferring restart processing . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 510 Deferral of restart . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 511 Performing conditional restart . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 511 Options for recovery operations after conditional restart . . . . . . . . . . . . . . . . . . . 512 Conditional restart records . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 512 Resolving postponed units of recovery . . . . . . . . . . . . . . . . . . . . . . . . . . 512 RECOVER POSTPONED command . . . . . . . . . . . . . . . . . . . . . . . . . . 513 Recovering from an error during RECOVER POSTPONED processing . . . . . . . . . . . . . . 514 Chapter 18. Maintaining consistency across multiple systems . . . . . . . . . . . 515 Multiple system consistency . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 515 Two-phase commit process . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 515 Commit coordinator and multiple participants . . . . . . . . . . . . . . . . . . . . . . 517 Illustration of multi-site update . . . . . . . . . . . . . . . . . . . . . . . . . . . 518 Termination for multiple systems. . . . . . . . . . . . . . . . . . . . . . . . . . . 519 Consistency after termination or failure. . . . . . . . . . . . . . . . . . . . . . . . . 520 Normal restart and recovery for multiple systems . . . . . . . . . . . . . . . . . . . . . 521 Multiple-system restart with conditions. . . . . . . . . . . . . . . . . . . . . . . . . 522 Heuristic decisions about whether to commit or abort an indoubt thread . . . . . . . . . . . . . 522 Resolving indoubt units of recovery . . . . . . . . . . . . . . . . . . . . . . . . . . . 522 Resolution of IMS indoubt units of recovery . . . . . . . . . . . . . . . . . . . . . . . 523 Resolution of CICS indoubt units of recovery. . . . . . . . . . . . . . . . . . . . . . . 524 Resolution of RRS indoubt units of recovery . . . . . . . . . . . . . . . . . . . . . . . 524 Resolving WebSphere Application Server indoubt units of recovery . . . . . . . . . . . . . . . 525 Resolving remote DBMS indoubt units of recovery . . . . . . . . . . . . . . . . . . . . . 527 x Administration Guide || ||
  12. 12. Determining the coordinators commit or abort decision . . . . . . . . . . . . . . . . . . . 528 Recovering indoubt threads . . . . . . . . . . . . . . . . . . . . . . . . . . . . 528 Resetting the status of an indoubt thread . . . . . . . . . . . . . . . . . . . . . . . . 529 Chapter 19. Backing up and recovering your data. . . . . . . . . . . . . . . . . 531 Plans for backup and recovery . . . . . . . . . . . . . . . . . . . . . . . . . . . . 531 Plans for recovery of distributed data . . . . . . . . . . . . . . . . . . . . . . . . . 531 Plans for extended recovery facility toleration . . . . . . . . . . . . . . . . . . . . . . 532 Plans for recovery of indexes . . . . . . . . . . . . . . . . . . . . . . . . . . . . 533 Preparation for recovery: a scenario . . . . . . . . . . . . . . . . . . . . . . . . . . 533 Events that occur during recovery . . . . . . . . . . . . . . . . . . . . . . . . . . 534 Tips for maximizing data availability during backup and recovery . . . . . . . . . . . . . . . 539 Where to find recovery information . . . . . . . . . . . . . . . . . . . . . . . . . . 542 How to report recovery information . . . . . . . . . . . . . . . . . . . . . . . . . . 543 How to discard SYSCOPY and SYSLGRNX records. . . . . . . . . . . . . . . . . . . . . 544 Preparations for disaster recovery . . . . . . . . . . . . . . . . . . . . . . . . . . 545 Recommendations for more effective recovery from inconsistency . . . . . . . . . . . . . . . . 547 How to recover multiple objects in parallel . . . . . . . . . . . . . . . . . . . . . . . 549 Automatic fast log apply during RECOVER . . . . . . . . . . . . . . . . . . . . . . . 550 Recovery of page sets and data sets . . . . . . . . . . . . . . . . . . . . . . . . . . 550 Recovery of data to a prior point of consistency . . . . . . . . . . . . . . . . . . . . . . 556 Preparing to recover an entire DB2 subsystem to a prior point in time using image copies or object-level backups . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 565 Creating essential disaster recovery elements . . . . . . . . . . . . . . . . . . . . . . . 565 Resolving problems with a user-defined work file data set . . . . . . . . . . . . . . . . . . 567 Resolving problems with DB2-managed work file data sets . . . . . . . . . . . . . . . . . . 567 Recovering error ranges for a work file table space . . . . . . . . . . . . . . . . . . . . . 568 Recovering after a conditional restart of DB2 . . . . . . . . . . . . . . . . . . . . . . . 568 Regenerating missing identity column values. . . . . . . . . . . . . . . . . . . . . . . 569 Recovering a table space and all of its indexes . . . . . . . . . . . . . . . . . . . . . . 570 Removing various pending states from LOB and XML table spaces . . . . . . . . . . . . . . . 574 Restoring data by using DSN1COPY . . . . . . . . . . . . . . . . . . . . . . . . . 575 Backing up and restoring data with non-DB2 dump and restore . . . . . . . . . . . . . . . . 575 Recovering accidentally dropped objects . . . . . . . . . . . . . . . . . . . . . . . . 575 Recovering your DB2 system to a given point in time by using the RESTORE SYSTEM utility . . . . . . 581 Recovering by using DB2 restart recovery . . . . . . . . . . . . . . . . . . . . . . . . 590 Recovering by using FlashCopy backups . . . . . . . . . . . . . . . . . . . . . . . . 591 Making catalog definitions consistent with your data after recovery to a prior point in time . . . . . . . 591 Performing remote site recovery from a disaster at a local site . . . . . . . . . . . . . . . . . 594 Backup and recovery involving clone tables . . . . . . . . . . . . . . . . . . . . . . . 595 Data restore of an entire system . . . . . . . . . . . . . . . . . . . . . . . . . . . 595 Chapter 20. Recovering from different DB2 for z/OS problems . . . . . . . . . . . 597 Recovering from IRLM failure . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 597 Recovering from z/OS or power failure . . . . . . . . . . . . . . . . . . . . . . . . . 597 Recovering from disk failure . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 598 Recovering from application errors . . . . . . . . . . . . . . . . . . . . . . . . . . . 600 Backing out incorrect application changes (with a quiesce point) . . . . . . . . . . . . . . . . 600 Backing out incorrect application changes (without a quiesce point) . . . . . . . . . . . . . . . 601 Recovering from IMS-related failures . . . . . . . . . . . . . . . . . . . . . . . . . . 601 Recovering from IMS control region failure . . . . . . . . . . . . . . . . . . . . . . . 602 Recovering from IMS indoubt units of recovery . . . . . . . . . . . . . . . . . . . . . . 602 Recovering from IMS application failure . . . . . . . . . . . . . . . . . . . . . . . . 605 Recovering from a DB2 failure in an IMS environment . . . . . . . . . . . . . . . . . . . 605 Recovering from CICS-related failure . . . . . . . . . . . . . . . . . . . . . . . . . . 606 Recovering from CICS application failures. . . . . . . . . . . . . . . . . . . . . . . . 606 Recovering DB2 when CICS is not operational . . . . . . . . . . . . . . . . . . . . . . 607 Recovering DB2 when the CICS attachment facility cannot connect to DB2 . . . . . . . . . . . . . 608 Recovering CICS indoubt units of recovery . . . . . . . . . . . . . . . . . . . . . . . 608 Recovering from CICS attachment facility failure . . . . . . . . . . . . . . . . . . . . . 611 Contents xi || ||
  13. 13. Recovering from subsystem termination . . . . . . . . . . . . . . . . . . . . . . . . . 611 Recovering from temporary resource failure . . . . . . . . . . . . . . . . . . . . . . . . 612 Recovering from active log failures . . . . . . . . . . . . . . . . . . . . . . . . . . . 613 Recovering from being out of space in active logs . . . . . . . . . . . . . . . . . . . . . 613 Recovering from a write I/O error on an active log data set . . . . . . . . . . . . . . . . . . 614 Recovering from a loss of dual active logging . . . . . . . . . . . . . . . . . . . . . . 615 Recovering from I/O errors while reading the active log . . . . . . . . . . . . . . . . . . . 616 Recovering from archive log failures. . . . . . . . . . . . . . . . . . . . . . . . . . . 618 Recovering from allocation problems with the archive log . . . . . . . . . . . . . . . . . . 618 Recovering from write I/O errors during archive log offload . . . . . . . . . . . . . . . . . 618 Recovering from read I/O errors on an archive data set during recovery . . . . . . . . . . . . . 619 Recovering from insufficient disk space for offload processing . . . . . . . . . . . . . . . . . 620 Recovering from BSDS failures . . . . . . . . . . . . . . . . . . . . . . . . . . . . 621 Recovering from an I/O error on the BSDS . . . . . . . . . . . . . . . . . . . . . . . 621 Recovering from an error that occurs while opening the BSDS . . . . . . . . . . . . . . . . . 622 Recovering from unequal timestamps on BSDSs . . . . . . . . . . . . . . . . . . . . . . 622 Recovering the BSDS from a backup copy . . . . . . . . . . . . . . . . . . . . . . . . 623 Recovering from BSDS or log failures during restart . . . . . . . . . . . . . . . . . . . . . 626 Recovering from failure during log initialization or current status rebuild . . . . . . . . . . . . . 628 Recovering from a failure during forward log recovery . . . . . . . . . . . . . . . . . . . 639 Recovering from a failure during backward log recovery . . . . . . . . . . . . . . . . . . . 645 Recovering from a failure during a log RBA read request. . . . . . . . . . . . . . . . . . . 647 Recovering from unresolvable BSDS or log data set problem during restart. . . . . . . . . . . . . 648 Recovering from a failure resulting from total or excessive loss of log data . . . . . . . . . . . . . 651 Resolving inconsistencies resulting from a conditional restart . . . . . . . . . . . . . . . . . 655 Recovering from DB2 database failure . . . . . . . . . . . . . . . . . . . . . . . . . . 660 Recovering a DB2 subsystem to a prior point in time . . . . . . . . . . . . . . . . . . . . . 661 Recovering from a down-level page set problem. . . . . . . . . . . . . . . . . . . . . . . 662 Recovering from a problem with invalid LOBs . . . . . . . . . . . . . . . . . . . . . . . 664 Recovering from table space input-output errors . . . . . . . . . . . . . . . . . . . . . . 665 Recovering from DB2 catalog or directory I/O errors . . . . . . . . . . . . . . . . . . . . . 666 Recovering from integrated catalog facility failure . . . . . . . . . . . . . . . . . . . . . . 667 Recovering VSAM volume data sets that are out of space or destroyed . . . . . . . . . . . . . . 667 Recovering from out-of-disk-space or extent-limit problems . . . . . . . . . . . . . . . . . . 668 Recovering from referential constraint violation . . . . . . . . . . . . . . . . . . . . . . . 672 Recovering from distributed data facility failure . . . . . . . . . . . . . . . . . . . . . . . 673 Recovering from conversation failure . . . . . . . . . . . . . . . . . . . . . . . . . 673 Recovering from communications database failure . . . . . . . . . . . . . . . . . . . . . 674 Recovering from database access thread failure . . . . . . . . . . . . . . . . . . . . . . 675 Recovering from VTAM failure . . . . . . . . . . . . . . . . . . . . . . . . . . . 676 Recovering from TCP/IP failure . . . . . . . . . . . . . . . . . . . . . . . . . . . 676 Recovering from remote logical unit failure . . . . . . . . . . . . . . . . . . . . . . . 677 Recovering from an indefinite wait condition. . . . . . . . . . . . . . . . . . . . . . . 677 Recovering database access threads after security failure . . . . . . . . . . . . . . . . . . . 678 Performing remote-site disaster recovery . . . . . . . . . . . . . . . . . . . . . . . . . 679 Recovering from a disaster by using system-level backups . . . . . . . . . . . . . . . . . . 679 Restoring data from image copies and archive logs . . . . . . . . . . . . . . . . . . . . . 679 Recovering from disasters by using a tracker site . . . . . . . . . . . . . . . . . . . . . 694 Using data mirroring for disaster recovery . . . . . . . . . . . . . . . . . . . . . . . 702 Scenarios for resolving problems with indoubt threads . . . . . . . . . . . . . . . . . . . . 708 Scenario: Recovering from communication failure . . . . . . . . . . . . . . . . . . . . . 710 Scenario: Making a heuristic decision about whether to commit or abort an indoubt thread . . . . . . . 711 Scenario: Recovering from an IMS outage that results in an IMS cold start . . . . . . . . . . . . . 713 Scenario: Recovering from a DB2 outage at a requester that results in a DB2 cold start . . . . . . . . . 715 Scenario: What happens when the wrong DB2 subsystem is cold started . . . . . . . . . . . . . 719 Scenario: Correcting damage from an incorrect heuristic decision about an indoubt thread . . . . . . . 720 Chapter 21. Reading log records . . . . . . . . . . . . . . . . . . . . . . . . 723 Contents of the log . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 723 Unit of recovery log records . . . . . . . . . . . . . . . . . . . . . . . . . . . . 723 Checkpoint log records . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 727 xii Administration Guide ||
  14. 14. Database page set control records . . . . . . . . . . . . . . . . . . . . . . . . . . 728 Other exception information . . . . . . . . . . . . . . . . . . . . . . . . . . . . 728 The physical structure of the log . . . . . . . . . . . . . . . . . . . . . . . . . . . . 728 Physical and logical log records . . . . . . . . . . . . . . . . . . . . . . . . . . . 728 The log record header . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 729 The log control interval definition (LCID) . . . . . . . . . . . . . . . . . . . . . . . . 730 Log record type codes . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 732 Log record subtype codes . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 733 Interpreting data change log records. . . . . . . . . . . . . . . . . . . . . . . . . . 735 Reading log records with IFI . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 735 Reading log records into a buffer . . . . . . . . . . . . . . . . . . . . . . . . . . . 735 Reading specific log records (IFCID 0129) . . . . . . . . . . . . . . . . . . . . . . . . 736 Reading complete log data (IFCID 0306) . . . . . . . . . . . . . . . . . . . . . . . . 737 Reading log records with OPEN, GET, and CLOSE . . . . . . . . . . . . . . . . . . . . . . 739 JCL DD statements for DB2 stand-alone log services . . . . . . . . . . . . . . . . . . . . 740 Data sharing members that participate in a read. . . . . . . . . . . . . . . . . . . . . . 742 Registers and return codes . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 743 Stand-alone log OPEN request. . . . . . . . . . . . . . . . . . . . . . . . . . . . 744 Stand-alone log GET request . . . . . . . . . . . . . . . . . . . . . . . . . . . . 745 Stand-alone log CLOSE request . . . . . . . . . . . . . . . . . . . . . . . . . . . 747 Sample 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. . . . . . . . . . . . . . . . . . . . . . . . 753 Connection routines and sign-on routines . . . . . . . . . . . . . . . . . . . . . . . . . 753 Specifying connection and sign-on routines . . . . . . . . . . . . . . . . . . . . . . . 754 Sample connection and sign-on routines . . . . . . . . . . . . . . . . . . . . . . . . 754 When connection and sign-on routines are taken . . . . . . . . . . . . . . . . . . . . . 755 EXPL for connection and sign-on routines . . . . . . . . . . . . . . . . . . . . . . . . 756 Exit parameter list for connection and sign-on routines . . . . . . . . . . . . . . . . . . . 756 Authorization ID parameter list for connection and sign-on routines . . . . . . . . . . . . . . . 757 Input values for connection routines. . . . . . . . . . . . . . . . . . . . . . . . . . 758 Input values for sign-on routines . . . . . . . . . . . . . . . . . . . . . . . . . . . 759 Expected output for connection and sign-on routines . . . . . . . . . . . . . . . . . . . . 759 Processing in the sample connection and sign-on routines . . . . . . . . . . . . . . . . . . 760 Performance considerations for connection and sign-on routines . . . . . . . . . . . . . . . . 761 Debugging connection and sign-on routines . . . . . . . . . . . . . . . . . . . . . . . 762 Session variables in connection and sign-on routines . . . . . . . . . . . . . . . . . . . . 763 Access control authorization exit routine . . . . . . . . . . . . . . . . . . . . . . . . . 764 Specifying the access control authorization routine . . . . . . . . . . . . . . . . . . . . . 766 The default access control authorization routine . . . . . . . . . . . . . . . . . . . . . . 766 When the access control authorization routine is taken . . . . . . . . . . . . . . . . . . . 766 Considerations for the access control authorization routine . . . . . . . . . . . . . . . . . . 767 Parameter list for the access control authorization routine . . . . . . . . . . . . . . . . . . 770 Expected output for the access control authorization routine. . . . . . . . . . . . . . . . . . 778 Debugging the access control authorization routine. . . . . . . . . . . . . . . . . . . . . 780 Determining whether the access control authorization routine is active . . . . . . . . . . . . . . 781 Edit routines . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 781 Specifying the edit routine . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 782 When the edit routine is taken . . . . . . . . . . . . . . . . . . . . . . . . . . . 782 Parameter lists for the edit routine . . . . . . . . . . . . . . . . . . . . . . . . . . 782 Processing requirements for edit routines . . . . . . . . . . . . . . . . . . . . . . . . 783 Incomplete rows and edit routines . . . . . . . . . . . . . . . . . . . . . . . . . . 783 Expected output for edit routines. . . . . . . . . . . . . . . . . . . . . . . . . . . 784 Validation routines . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 785 Specifying the validation routine . . . . . . . . . . . . . . . . . . . . . . . . . . . 785 When the validation routine is taken . . . . . . . . . . . . . . . . . . . . . . . . . 785 Parameter lists for the validation routine . . . . . . . . . . . . . . . . . . . . . . . . 786 Contents xiii
  15. 15. Processing requirements for validation routines . . . . . . . . . . . . . . . . . . . . . . 786 Incomplete rows and validation routines . . . . . . . . . . . . . . . . . . . . . . . . 787 Expected output for validation routines . . . . . . . . . . . . . . . . . . . . . . . . 787 Date and time routines . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 788 Specifying the date and time routine . . . . . . . . . . . . . . . . . . . . . . . . . 789 When date and time routines are taken. . . . . . . . . . . . . . . . . . . . . . . . . 789 Parameter lists for date and time routines . . . . . . . . . . . . . . . . . . . . . . . . 790 Expected output for date and time routines . . . . . . . . . . . . . . . . . . . . . . . 791 Conversion procedures . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 792 Specifying a conversion procedure . . . . . . . . . . . . . . . . . . . . . . . . . . 792 When conversion procedures are taken . . . . . . . . . . . . . . . . . . . . . . . . . 793 Parameter lists for conversion procedures . . . . . . . . . . . . . . . . . . . . . . . . 793 Expected output for conversion procedures . . . . . . . . . . . . . . . . . . . . . . . 793 Field procedures . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 795 Field definition for field procedures . . . . . . . . . . . . . . . . . . . . . . . . . . 796 Specifying the field procedure . . . . . . . . . . . . . . . . . . . . . . . . . . . . 796 When field procedures are taken . . . . . . . . . . . . . . . . . . . . . . . . . . . 797 Control blocks for execution of field procedures . . . . . . . . . . . . . . . . . . . . . . 798 Field-definition (function code 8) . . . . . . . . . . . . . . . . . . . . . . . . . . . 801 Field-encoding (function code 0) . . . . . . . . . . . . . . . . . . . . . . . . . . . 803 Field-decoding (function code 4) . . . . . . . . . . . . . . . . . . . . . . . . . . . 805 Log capture routines . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 807 Specifying the log capture routine . . . . . . . . . . . . . . . . . . . . . . . . . . 807 When log capture routines are taken . . . . . . . . . . . . . . . . . . . . . . . . . 808 Parameter lists for log capture routines . . . . . . . . . . . . . . . . . . . . . . . . . 808 Routines for dynamic plan selection in CICS . . . . . . . . . . . . . . . . . . . . . . . . 809 Routine for CICS transaction invocation stored procedure . . . . . . . . . . . . . . . . . . . 810 General guidelines for writing exit routines . . . . . . . . . . . . . . . . . . . . . . . . 810 Coding rules for exit routines . . . . . . . . . . . . . . . . . . . . . . . . . . . . 810 Modifying exit routines . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 811 Execution environment for exit routines . . . . . . . . . . . . . . . . . . . . . . . . 811 Registers at invocation for exit routines. . . . . . . . . . . . . . . . . . . . . . . . . 811 Parameter lists for exit routines . . . . . . . . . . . . . . . . . . . . . . . . . . . 812 Row formats for edit and validation routines . . . . . . . . . . . . . . . . . . . . . . . . 813 Column boundaries for edit and validation routines . . . . . . . . . . . . . . . . . . . . 813 Null values for edit procedures, field procedures, and validation routines . . . . . . . . . . . . . 813 Fixed-length rows for edit and validation routines . . . . . . . . . . . . . . . . . . . . . 814 Varying-length rows for edit and validation routines . . . . . . . . . . . . . . . . . . . . 814 Varying-length rows with nulls for edit and validation routines . . . . . . . . . . . . . . . . 815 EDITPROCs and VALIDPROCs for handling basic and reordered row formats . . . . . . . . . . . 815 Converting basic row format table spaces with edit and validation routines to reordered row format . . . . 816 Dates, times, and timestamps for edit and validation routines . . . . . . . . . . . . . . . . . 816 Parameter list for row format descriptions. . . . . . . . . . . . . . . . . . . . . . . . 817 DB2 codes for numeric data in edit and validation routines . . . . . . . . . . . . . . . . . . 818 RACF access control module . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 820 Appendix B. Stored procedures for administration . . . . . . . . . . . . . . . . 821 DSNACICS stored procedure . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 821 The DSNACICX user exit routine. . . . . . . . . . . . . . . . . . . . . . . . . . . 826 DSNLEUSR stored procedure . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 829 DSNAIMS stored procedure . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 832 DSNAIMS2 stored procedure . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 836 ADMIN_COMMAND_DB2 stored procedure . . . . . . . . . . . . . . . . . . . . . . . . 841 ADMIN_COMMAND_DSN stored procedure . . . . . . . . . . . . . . . . . . . . . . . 850 ADMIN_COMMAND_UNIX stored procedure . . . . . . . . . . . . . . . . . . . . . . . 852 ADMIN_DS_BROWSE stored procedure . . . . . . . . . . . . . . . . . . . . . . . . . 856 ADMIN_DS_DELETE stored procedure. . . . . . . . . . . . . . . . . . . . . . . . . . 859 ADMIN_DS_LIST stored procedure . . . . . . . . . . . . . . . . . . . . . . . . . . . 862 ADMIN_DS_RENAME stored procedure . . . . . . . . . . . . . . . . . . . . . . . . . 868 ADMIN_DS_SEARCH stored procedure . . . . . . . . . . . . . . . . . . . . . . . . . 871 ADMIN_DS_WRITE stored procedure . . . . . . . . . . . . . . . . . . . . . . . . . . 873 xiv Administration Guide || || || ||
  16. 16. ADMIN_INFO_HOST stored procedure . . . . . . . . . . . . . . . . . . . . . . . . . 877 ADMIN_INFO_SSID stored procedure . . . . . . . . . . . . . . . . . . . . . . . . . . 881 ADMIN_JOB_CANCEL stored procedure . . . . . . . . . . . . . . . . . . . . . . . . . 882 ADMIN_JOB_FETCH stored procedure. . . . . . . . . . . . . . . . . . . . . . . . . . 885 ADMIN_JOB_QUERY stored procedure . . . . . . . . . . . . . . . . . . . . . . . . . 888 ADMIN_JOB_SUBMIT stored procedure . . . . . . . . . . . . . . . . . . . . . . . . . 892 ADMIN_UTL_SCHEDULE stored procedure . . . . . . . . . . . . . . . . . . . . . . . . 895 ADMIN_UTL_SORT stored procedure . . . . . . . . . . . . . . . . . . . . . . . . . . 904 Common SQL API stored procedures . . . . . . . . . . . . . . . . . . . . . . . . . . 911 GET_CONFIG stored procedure . . . . . . . . . . . . . . . . . . . . . . . . . . . 912 GET_MESSAGE stored procedure . . . . . . . . . . . . . . . . . . . . . . . . . . 922 GET_SYSTEM_INFO stored procedure . . . . . . . . . . . . . . . . . . . . . . . . . 932 XPath 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 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 963 Programming Interface Information . . . . . . . . . . . . . . . . . . . . . . . . . . . 965 General-use Programming Interface and Associated Guidance Information . . . . . . . . . . . . . 965 Product-sensitive Programming Interface and Associated Guidance Information . . . . . . . . . . . 965 Trademarks . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 965 Glossary . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 967 Index . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1011 Contents xv || || || || || ||
  17. 17. xvi Administration Guide
  18. 18. About this information This information provides guidance information that you can use to perform a variety of administrative tasks with DB2 for z/OS (DB2). Information about DB2 concepts, which was present in previous editions of this book, is now provided in Introduction to DB2 for z/OS. This information assumes that your DB2 subsystem is running in Version 9.1 new-function mode. Generally, new functions that are described, including changes to existing functions, statements, and limits, are available only in new-function mode. Two exceptions to this general statement are new and changed utilities and optimization enhancements, which are also available in conversion mode unless stated otherwise. Who should read this information This information is primarily intended for system and database administrators. It assumes that the user is familiar with: v The basic concepts and facilities of DB2 v 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 Control Protocol/Internet Protocol (TCP/IP) or Virtual Telecommunications Access Method (VTAM ) to set up communication between DB2 subsystems, or knowledge of the IBM 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 as an optional product. You must separately order and purchase a license to such utilities, and discussion of those utility functions in this publication is not intended to otherwise imply that you have a license to them. The DB2 Utilities Suite is designed to work with the DFSORT program, which you are licensed to use in support of the DB2 utilities even if you do not otherwise license 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 UTILITIES v 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
  19. 19. Terminology and citations In this information, DB2 Version 9.1 for z/OS is referred to as DB2 for z/OS. In cases 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 is used. (For example, See DB2 SQL Reference is a citation to IBM DB2 Version 9.1 for z/OS SQL Reference.) When referring to a DB2 product other than DB2 for z/OS, this information uses the products 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/OS v IBM Tivoli OMEGAMON XE for DB2 Performance Monitor on z/OS v IBM DB2 Performance Expert for Multiplatforms and Workgroups v IBM DB2 Buffer Pool Analyzer for z/OS C, C++, and C language Represent 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 is equivalent to the Base Control Program (BCP) component of the z/OS operating system. RACF Represents the functions that are provided by the RACF component of the z/OS Security Server. Accessibility features for DB2 Version 9.1 for z/OS Accessibility features help a user who has a physical disability, such as restricted mobility 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 Information Center (which includes information for DB2 Version 9.1 for z/OS) and its related publications are accessibility-enabled for the IBM Home Page Reader. You can operate 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 keyboard or keyboard shortcut keys. xviii Administration Guide |
  20. 20. For information about navigating the DB2 Version 9.1 for z/OS ISPF panels using TSO/E or ISPF, refer to the z/OS TSO/E Primer, the z/OS TSO/E Users Guide, and the z/OS ISPF Users Guide. These guides describe how to navigate each interface, including the use of keyboard shortcuts or function keys (PF keys). Each guide includes the default settings for the PF keys and explains how to modify their functions. Related accessibility information Online documentation for DB2 Version 9.1 for z/OS is available in the Information Management Software for z/OS Solutions Information Center, which is available at the 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 information about the commitment that IBM has to accessibility. How to send your comments Your feedback helps IBM to provide quality information. Please send any comments 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 (for example, a chapter and section title or a help topic title). v You can send comments from the Web. Visit the DB2 for z/OS - Technical Resources 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 send comments. v You can also send comments by using the feedback link at the footer of each page in the Information Management Software for z/OS Solutions Information Center at http://publib.boulder.ibm.com/infocenter/db2zhelp. How to read syntax diagrams Certain conventions apply to the syntax diagrams that are used in IBM documentation. Apply the following rules when reading the syntax diagrams that are used in DB2 for 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 next line. 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
  21. 21. required_item v Optional items appear below the main path. required_item optional_item If an optional item appears above the main path, that item has no effect on the execution 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 main path. required_item required_choice1 required_choice2 If choosing one of the items is optional, the entire stack appears below the main path. required_item optional_choice1 optional_choice2 If one of the items is the default, it appears above the main path and the remaining choices are shown below. required_item default_choice optional_choice optional_choice v An arrow returning to the left, above the main line, indicates an item that can be repeated. required_item repeatable_item If the repeat arrow contains a comma, you must separate repeated items with a comma. required_item , repeatable_item A repeat arrow above a stack indicates that you can repeat the items in the stack. v Sometimes a diagram must be split into fragments. The syntax fragment is shown separately from the main syntax diagram, but the contents of the fragment should be read as if they are on the main path of the diagram. xx Administration Guide | | |
  22. 22. required_item fragment-name fragment-name: required_item optional_name v With the exception of XPath keywords, keywords appear in uppercase (for example, FROM). Keywords must be spelled exactly as shown. XPath keywords are defined as lowercase names, and must be spelled exactly as shown. Variables appear in all lowercase letters (for example, column-name). They represent user-supplied names or values. v If punctuation marks, parentheses, arithmetic operators, or other such symbols are shown, you must enter them as part of the syntax. About this information xxi ||||||||||||| | | |||||||||||||||| | | | |
  23. 23. xxii Administration Guide
  24. 24. Part 1. Designing a database Copyright IBM Corp. 1982, 2008 1
  25. 25. 2 Administration Guide
  26. 26. Chapter 1. Database objects and relationships The two general tasks necessary to design a database are logical data modeling and physical data modeling. In logical data modeling, you design a model of the data without paying attention to 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 will use. Physical data modeling begins when you move closer to a physical implementation. The primary purpose of the physical design stage is to optimize performance while ensuring the integrity of the data. Logical database design with the entity-relationship model Before you implement a database, you should plan or design the database so that it satisfies all requirements. Designing and implementing a successful database, one that satisfies the needs of an organization, requires a logical data model. Logical data modeling is the process of documenting the comprehensive business information requirements in an accurate and consistent format. Analysts who do data modeling define the data items and the business rules that affect those data items. The process of data modeling acknowledges that business data is a vital asset that the organization needs to understand and carefully manage. This section contains information that was adapted from Handbook of Relational Database Design. Consider the following business facts that a manufacturing company needs to represent in its data model: v Customers purchase products v Products consist of parts v Suppliers manufacture parts v Warehouses store parts v Transportation vehicles move the parts from suppliers to warehouses and then to manufacturers These are all business facts that a manufacturing companys logical data model needs to include. Many people inside and outside the company rely on information that is based on these facts. Many reports include data about these facts. Any business, not just manufacturing companies, can benefit from the task of data modeling. Database systems that supply information to decision makers, customers, suppliers, and others are more successful if their foundation is a sound data model. Modeling your data Data 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
  27. 27. 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. Because data analysts cannot fully understand all areas of the business that they are modeling, 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 the other user views into a consolidated logical data model. 2. Add keys to user views Key business rules affect insert, update, and delete operations on the data. For example, a business rule might require that each customer entity have at least one unique identifier. Any attempt to insert or update a customer identifier that matches another customer identifier is not valid. In a data model, a unique identifier 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 views To validate the views, analysts use the normalization process and process models. Process models document the details of how the business will use the 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. These constraints need to be true, regardless of any particular processing requirements. The advantage to defining data-driven business rules during the data design stage, rather than during application design is that programmers of many applications dont need to write code to enforce these business rules. For example, Assume that a business rule requires that a customer entity have a phone number, an address, or both. If this rule doesnt apply to the data itself, programmers must develop, test, and maintain applications that verify the existence of one of these attributes. Data-driven business requirements have a direct relationship with the data, thereby relieving programmers 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 it can support the current business environment and possible future changes. For example, assume that a retail company operates in a single country and that business plans include expansion to other countries. Armed with knowledge of these plans, analysts can build the model so that it is flexible enough to support expansion into other countries. 4 Administration Guide
  28. 28. Recommendations for logical data modeling To 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 organizations application programs, databases, logical data models, users, and authorizations. A data dictionary can be manual or automated. Practical examples of data modeling Use this scenario of real-life data modeling to better understand the key activities necessary for creating sound data models. You begin by defining your entities, the significant objects of interest. Entities are the things about which you want to store information. For example, you might want to define an entity, called EMPLOYEE, for employees because you need to store information about everyone who works for your organization. You might also define an entity, called DEPARTMENT, for departments. Next, you define primary keys for your entities. A primary key is a unique identifier for an entity. In the case of the EMPLOYEE entity, you probably need to store a large amount of information. However, most of this information (such as gender, birth date, address, and hire date) would not be a good choice for the primary key. In this case, you could choose a unique employee ID or number (EMPLOYEE_NUMBER) as the primary key. In the case of the DEPARTMENT entity, you could use a unique department number (DEPARTMENT_NUMBER) as the primary key. After you have decided on the entities and their primary keys, you can define the relationships that exist between the entities. The relationships are based on the primary keys. If you have an entity for EMPLOYEE and another entity for DEPARTMENT, the relationship that exists is that employees are assigned to departments. You can read more about this topic in the next section. After defining the entities, their primary keys, and their relationships, you can define additional attributes for the entities. In the case of the EMPLOYEE entity, you might define the following additional attributes: v Birth date v Hire date v Home address v Office phone number v Gender v Resume Lastly, you normalize the data. Entities for different types of relationships In a relational database, you can express several types of relationships. Chapter 1. Database objects and relationships 5
  29. 29. Consider the possible relationships between employees and departments. If a given employee can work in only one department, this relationship is one-to-one for employees. One department usually has many employees; this relationship is one-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 7 v 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 relationship between employees and departments is many-to-many. You need to define separate entities for different types of relationships. When modeling relationships, you can use diagram conventions to depict relationships by using different styles of lines to connect the entities. One-to-one relationships When you are doing logical database design, one-to-one relationships are bidirectional relationships, which means that they are single-valued in both directions. For example, an employee has a single resume; each resume belongs to only one person. The previous figure illustrates that a one-to-one relationship exists between the two entities. In this case, the relationship reflects the rules that an employee can have only one resume and that a resume can belong to only one employee. One-to-many and many-to-one relationships A one-to-many relationship occurs when one entity has a multivalued relationship with another entity. In the following figure, you see that a one-to-many relationship exists between the two entitiesemployee and department. This figure reinforces the business rules that a department can have many employees, but that each individual employee can work for only one department. Employee Resume A resume is owned by an employee An employee has a resume Figure 1. Assigning one-to-one facts to an entity Employee Department One department can have many employees Many employees work for one department Figure 2. Assigning many-to-one facts to an entity 6 Administration Guide
  30. 30. Many-to-many relationships A many-to-many relationship is a relationship that is multivalued in both directions. The following figure illustrates this kind of relationship. An employee can work on more than one project, and a project can have more than one employee assigned. Business rules for relationships Whether a given relationship is one-to-one, one-to-many, many-to-one, or many-to-many, your relationships need to make good business sense. Therefore, database designers and data analysts can be more effective when they have a good understanding of the business. If they understand the data, the applications, and the business rules, they can succeed in building a sound database design. When you define relationships, you have a big influence on how smoothly your business runs. If you dont do a good job at this task, your database and associated applications are likely to have many problems, some of which may not manifest themselves for years. Entity attributes When you define attributes for the entities, you generally work with the data administrator (DA) to decide on names, data types, and appropriate values for the attributes. Attribute names Most organizations have naming conventions. In addition to following these conventions, Data analysts also base attribute definitions on class words. A class word is a single word that indicates the nature of the data that the attribute represents. The class word NUMBER indicates an attribute that identifies the number of an entity. Attribute names that identify the numbers of entities should therefore include the class word of NUMBER. Some examples are EMPLOYEE_NUMBER, PROJECT_NUMBER, and DEPARTMENT_NUMBER. When an organization does not have well-defined guidelines for attribute names, the DAs try to determine how the database designers have historically named attributes. Problems occur when multiple individuals are inventing their own naming schemes without consulting one another. Data types of attributes You must specify a data type for each attribute. Most organizations have well-defined guidelines for using the different data types. Example: You might use the following data types for attributes of the EMPLOYEE entity: Employee Projects Projects are worked on by many employees Employees work on many projects Figure 3. Assigning many-to-many facts to an entity Chapter 1. Database objects and relationships 7
  31. 31. v EMPLOYEE_NUMBER: CHAR(6) v EMPLOYEE_LAST_NAME: VARCHAR(15) v EMPLOYEE_HIRE_DATE: DATE v EMPLOYEE_SALARY_AMOUNT: DECIMAL(9,2) The data types that you choose are business definitions of the data type. During physical database design you might need to change data type definitions or use a subset of these data types. The database or the host language might not support all of these definitions, or you might make a different choice for p