Sei sulla pagina 1di 17

Db2 12 for z/OS

Administration Guide

IBM

SC27-8844-02
Db2 12 for z/OS

Administration Guide

IBM

SC27-8844-02
Notes
Before using this information and the product it supports, be sure to read the general information under “Notices” at the
end of this information.

Subsequent editions of this PDF will not be delivered in IBM Publications Center. Always download the latest edition from
Db2 12 for z/OS Product Documentation.

September 13, 2019 edition


This edition applies to Db2 12 for z/OS (product number 5650-DB2), Db2 12 for z/OS Value Unit Edition (product
number 5770-AF3), 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 IBM Corporation 1982, 2017.
US Government Users Restricted Rights – Use, duplication or disclosure restricted by GSA ADP Schedule Contract
with IBM Corp.
Contents
About this information. . . . . . . . . . . . . . . . . . . . . . . . . . . . . xiii
Who should read this information . . . . . . . . . . . xiv . . . . . . . . . . . . . . . .
Db2 Utilities Suite for z/OS . . . . . . . . . . . . . xiv . . . . . . . . . . . . . . . .
Terminology and citations . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . xv
Accessibility features for Db2 12 for z/OS . . . . . . . . . . . . . . . . . . . . . . . . . xv
How to send your comments . . . . . . . . . . . . . . . . . . . . . . . . . . . . . xvi
How to read syntax diagrams . . . . . . . . . . . . . . . . . . . . . . . . . . . . . xvi

Part 1. Designing and implementing Db2 databases . . . . . . . . . . . . . . 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 . . . . . . . . . . . . . . . . . . . . . . . . 6
Entity attributes . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 7
Entity normalization . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 9
Logical database design with Unified Modeling Language . . . . . . . . . . . . . . . . . . . . 14
Physical database design . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 15
Denormalization of tables . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 16
Views to customize what data users see . . . . . . . . . . . . . . . . . . . . . . . . . 18
Indexes on table columns . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 19
Hash access on tables . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 19
Maintaining archive data . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 20

Chapter 2. Implementing your database design . . . . . . . . . . . . . . . . . . 21


Implementing Db2 databases . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 21
Creating Db2 databases . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 21
Dropping Db2 databases . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 22
Implementing Db2 storage groups . . . . . . . . . . . . . . . . . . . . . . . . . . . . 22
Advantages of storage groups . . . . . . . . . . . . . . . . . . . . . . . . . . . . 23
Creating Db2 storage groups . . . . . . . . . . . . . . . . . . . . . . . . . . . . 24
Enabling SMS to control Db2 storage groups . . . . . . . . . . . . . . . . . . . . . . . 25
Deferring allocation of Db2-managed data sets . . . . . . . . . . . . . . . . . . . . . . 25
How Db2 extends data sets . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 26
Db2 space allocation . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 27
Managing Db2 data sets with DFSMShsm . . . . . . . . . . . . . . . . . . . . . . . . 31
Managing your own data sets . . . . . . . . . . . . . . . . . . . . . . . . . . . . 35
Defining index space storage . . . . . . . . . . . . . . . . . . . . . . . . . . . . 39
Creating EA-enabled table spaces and index spaces . . . . . . . . . . . . . . . . . . . . . 40
Implementing Db2 table spaces . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 41
Table space types and characteristics in Db2 for z/OS . . . . . . . . . . . . . . . . . . . . 42
Implicitly defined table spaces . . . . . . . . . . . . . . . . . . . . . . . . . . . . 51
Creating table spaces explicitly . . . . . . . . . . . . . . . . . . . . . . . . . . . . 53
| Creating partition-by-range table spaces . . . . . . . . . . . . . . . . . . . . . . . . . 57
| Creating partition-by-growth table spaces . . . . . . . . . . . . . . . . . . . . . . . . 59
EA-enabled table spaces and index spaces . . . . . . . . . . . . . . . . . . . . . . . . 60
Implementing Db2 tables . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 61
Creating base tables . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 61
Guidelines for table names . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 61
Creating temporary tables . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 62
Creating temporal tables . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 67
Creating materialized query tables. . . . . . . . . . . . . . . . . . . . . . . . . . . 79

© Copyright IBM Corp. 1982, 2017 iii


| Creating tables partitioned by data value ranges . . . . . . . . . . . . . . . . . . . . . . 80
Nullable partitioning columns . . . . . . . . . . . . . . . . . . . . . . . . . . . . 81
Creating a clone table . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 82
Creating an archive table . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 85
Implementing Db2 views . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 85
Creating Db2 views. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 85
Guidelines for view names . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 87
Querying views that reference temporal tables. . . . . . . . . . . . . . . . . . . . . . . 87
How Db2 inserts and updates data through views . . . . . . . . . . . . . . . . . . . . . 88
Dropping Db2 views . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 89
Implementing Db2 indexes . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 89
Creating Db2 indexes . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 90
Guidelines for defining indexes. . . . . . . . . . . . . . . . . . . . . . . . . . . . 90
How Db2 implicitly creates an index . . . . . . . . . . . . . . . . . . . . . . . . . . 92
Implementing Db2 schemas . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 93
Creating a schema by using the schema processor . . . . . . . . . . . . . . . . . . . . . 93
Processing schema definitions . . . . . . . . . . . . . . . . . . . . . . . . . . . . 94
Loading data into Db2 tables . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 94
Loading data with the LOAD utility . . . . . . . . . . . . . . . . . . . . . . . . . . 95
Loading data by using the INSERT statement . . . . . . . . . . . . . . . . . . . . . . . 97
Loading data from DL/I . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 100
Implementing Db2 stored procedures . . . . . . . . . . . . . . . . . . . . . . . . . . 100
Creating stored procedures . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 101
Dropping stored procedures . . . . . . . . . . . . . . . . . . . . . . . . . . . . 102
Implementing Db2 user-defined functions . . . . . . . . . . . . . . . . . . . . . . . . . 102
Creating user-defined functions . . . . . . . . . . . . . . . . . . . . . . . . . . . 102
Deleting user-defined functions . . . . . . . . . . . . . . . . . . . . . . . . . . . 103
| Obfuscating source code of SQL procedures, SQL functions, and triggers . . . . . . . . . . . . . . 103
Estimating disk storage for user data . . . . . . . . . . . . . . . . . . . . . . . . . . 105
General approach to estimating storage. . . . . . . . . . . . . . . . . . . . . . . . . 106
Calculating the space required for a table . . . . . . . . . . . . . . . . . . . . . . . . 108
Calculating the space required for an index . . . . . . . . . . . . . . . . . . . . . . . 112

Chapter 3. Altering your database design . . . . . . . . . . . . . . . . . . . . 119


Using the catalog in database design . . . . . . . . . . . . . . . . . . . . . . . . . . 119
Retrieving catalog information about Db2 storage groups. . . . . . . . . . . . . . . . . . . 120
Retrieving catalog information about a table . . . . . . . . . . . . . . . . . . . . . . . 120
Retrieving catalog information about partition order . . . . . . . . . . . . . . . . . . . . 121
Retrieving catalog information about aliases . . . . . . . . . . . . . . . . . . . . . . . 121
Retrieving catalog information about columns . . . . . . . . . . . . . . . . . . . . . . 122
Retrieving catalog information about indexes . . . . . . . . . . . . . . . . . . . . . . . 123
Retrieving catalog information about views . . . . . . . . . . . . . . . . . . . . . . . 123
Retrieving catalog information about authorizations . . . . . . . . . . . . . . . . . . . . 124
Retrieving catalog information about primary keys . . . . . . . . . . . . . . . . . . . . . 125
Retrieving catalog information about foreign keys . . . . . . . . . . . . . . . . . . . . . 125
Retrieving catalog information about check pending . . . . . . . . . . . . . . . . . . . . 126
Retrieving catalog information about check constraints . . . . . . . . . . . . . . . . . . . 127
Retrieving catalog information about LOBs . . . . . . . . . . . . . . . . . . . . . . . 128
Retrieving catalog information about user-defined functions and stored procedures . . . . . . . . . . 128
Retrieving catalog information about triggers. . . . . . . . . . . . . . . . . . . . . . . 129
Retrieving catalog information about sequences . . . . . . . . . . . . . . . . . . . . . . 129
Adding and retrieving comments. . . . . . . . . . . . . . . . . . . . . . . . . . . 130
Verifying the accuracy of the database definition . . . . . . . . . . . . . . . . . . . . . 131
Altering Db2 databases . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 131
Altering Db2 storage groups . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 132
Letting SMS manage your Db2 storage groups . . . . . . . . . . . . . . . . . . . . . . 132
Adding or removing volumes from a Db2 storage group . . . . . . . . . . . . . . . . . . . 133
Migrating existing data sets to a solid-state drive . . . . . . . . . . . . . . . . . . . . . 134
Altering table spaces . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 134
Changing the logging attribute . . . . . . . . . . . . . . . . . . . . . . . . . . . 136
Changing the space allocation for user-managed data sets . . . . . . . . . . . . . . . . . . 138

iv Administration Guide
Dropping and re-creating a table space to change its attributes . . . . . . . . . . . . . . . . . 138
Redistributing data in partitioned table spaces . . . . . . . . . . . . . . . . . . . . . . 140
Increasing partition size . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 141
Altering a page set to contain Db2-defined extents . . . . . . . . . . . . . . . . . . . . . 143
| Converting partitioned (non-UTS) table spaces to partition-by-range universal table spaces . . . . . . . 143
| Converting table spaces to use table-controlled partitioning . . . . . . . . . . . . . . . . . . 144
Altering Db2 tables . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 148
Adding a column to a table . . . . . . . . . . . . . . . . . . . . . . . . . . . . 149
Specifying a default value when altering a column . . . . . . . . . . . . . . . . . . . . . 151
Altering the data type of a column . . . . . . . . . . . . . . . . . . . . . . . . . . 151
Altering a table for referential integrity . . . . . . . . . . . . . . . . . . . . . . . . . 160
Adding or dropping table check constraints . . . . . . . . . . . . . . . . . . . . . . . 164
Adding partitions . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 165
Altering partitions . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 169
Adding XML columns . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 177
Altering the size of your hash spaces . . . . . . . . . . . . . . . . . . . . . . . . . 178
Adding a system period and system-period data versioning to an existing table . . . . . . . . . . . 180
Adding an application period to a table . . . . . . . . . . . . . . . . . . . . . . . . 182
Manipulating data in a system-period temporal table . . . . . . . . . . . . . . . . . . . . 182
Altering materialized query tables . . . . . . . . . . . . . . . . . . . . . . . . . . 183
Altering the assignment of a validation routine . . . . . . . . . . . . . . . . . . . . . . 185
Altering a table to capture changed data . . . . . . . . . . . . . . . . . . . . . . . . 186
Changing an edit procedure or a field procedure . . . . . . . . . . . . . . . . . . . . . 186
Altering the subtype of a string column . . . . . . . . . . . . . . . . . . . . . . . . 187
Altering the attributes of an identity column . . . . . . . . . . . . . . . . . . . . . . . 187
Changing data types by dropping and re-creating the table . . . . . . . . . . . . . . . . . . 188
Moving a table to a table space of a different page size . . . . . . . . . . . . . . . . . . . 192
Altering Db2 views . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 192
Altering views by using the INSTEAD OF trigger . . . . . . . . . . . . . . . . . . . . . 193
Changing data by using views that reference temporal tables . . . . . . . . . . . . . . . . . 193
Altering Db2 indexes . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 194
Alternative method for altering an index . . . . . . . . . . . . . . . . . . . . . . . . 195
Adding columns to an index . . . . . . . . . . . . . . . . . . . . . . . . . . . . 195
Altering how varying-length index columns are stored . . . . . . . . . . . . . . . . . . . 197
Altering the clustering of an index . . . . . . . . . . . . . . . . . . . . . . . . . . 198
Dropping and redefining a Db2 index . . . . . . . . . . . . . . . . . . . . . . . . . 199
Reorganizing indexes . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 199
Pending data definition changes . . . . . . . . . . . . . . . . . . . . . . . . . . . . 200
Materializing pending definition changes . . . . . . . . . . . . . . . . . . . . . . . . 203
Restrictions for changes to objects that have pending data definition changes . . . . . . . . . . . . 208
| Pending column alterations. . . . . . . . . . . . . . . . . . . . . . . . . . . . . 211
Altering stored procedures . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 213
Altering user-defined functions . . . . . . . . . . . . . . . . . . . . . . . . . . . . 215
Altering implicitly created XML objects. . . . . . . . . . . . . . . . . . . . . . . . . . 216
Changing the high-level qualifier for Db2 data sets . . . . . . . . . . . . . . . . . . . . . . 216
Defining a new integrated catalog alias. . . . . . . . . . . . . . . . . . . . . . . . . 217
Changing the qualifier for system data sets . . . . . . . . . . . . . . . . . . . . . . . 217
Changing qualifiers for other databases and user data sets . . . . . . . . . . . . . . . . . . 221
Tools for moving Db2 data . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 225
Moving Db2 data . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 227
Moving a Db2 data set . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 228

Part 2. Operation and recovery . . . . . . . . . . . . . . . . . . . . . . . 231

Chapter 4. Controlling Db2 operations by using commands . . . . . . . . . . . . 233


Issuing commands from the z/OS console. . . . . . . . . . . . . . . . . . . . . . . . . 235
Issuing commands from TSO terminals . . . . . . . . . . . . . . . . . . . . . . . . . . 235
Issuing commands from CICS terminals . . . . . . . . . . . . . . . . . . . . . . . . . 237
Issuing commands from IMS terminals . . . . . . . . . . . . . . . . . . . . . . . . . . 238
Issuing commands from application programs . . . . . . . . . . . . . . . . . . . . . . . 238

Contents v
Destinations for command output messages . . . . . . . . . . . . . . . . . . . . . . . . 240
Unsolicited Db2 messages . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 240

Chapter 5. Starting and stopping Db2 . . . . . . . . . . . . . . . . . . . . . . 243


Starting Db2. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 243
Messages at start . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 244
Subsystem parameters at start . . . . . . . . . . . . . . . . . . . . . . . . . . . . 244
Application defaults module name at start . . . . . . . . . . . . . . . . . . . . . . . 245
Restricting access to data . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 245
Ending the wait state at startup . . . . . . . . . . . . . . . . . . . . . . . . . . . 245
Restart options after an abend . . . . . . . . . . . . . . . . . . . . . . . . . . . . 246
Stopping Db2 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 246

Chapter 6. Submitting work to Db2 . . . . . . . . . . . . . . . . . . . . . . . 249


Submitting work by using DB2I . . . . . . . . . . . . . . . . . . . . . . . . . . . . 249
Running TSO application programs . . . . . . . . . . . . . . . . . . . . . . . . . . . 249
Sources that Db2 checks to find authorization access for an application program . . . . . . . . . . . 250
Running IMS application programs . . . . . . . . . . . . . . . . . . . . . . . . . . . 250
Running CICS application programs. . . . . . . . . . . . . . . . . . . . . . . . . . . 251
Running batch application programs . . . . . . . . . . . . . . . . . . . . . . . . . . 252
Running application programs using CAF . . . . . . . . . . . . . . . . . . . . . . . . . 253
Running application programs using RRSAF . . . . . . . . . . . . . . . . . . . . . . . . 253

Chapter 7. Scheduling administrative tasks . . . . . . . . . . . . . . . . . . . 255


Interacting with the administrative task scheduler . . . . . . . . . . . . . . . . . . . . . . 255
Adding a task . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 255
Listing scheduled tasks . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 261
Listing the status of scheduled tasks. . . . . . . . . . . . . . . . . . . . . . . . . . 261
Updating the schedule for a task . . . . . . . . . . . . . . . . . . . . . . . . . . . 264
Stopping the execution of a task . . . . . . . . . . . . . . . . . . . . . . . . . . . 264
Removing a scheduled task. . . . . . . . . . . . . . . . . . . . . . . . . . . . . 264
Manually starting the administrative task scheduler . . . . . . . . . . . . . . . . . . . . 265
Manually stopping the administrative task scheduler . . . . . . . . . . . . . . . . . . . . 265
Synchronization between administrative task schedulers in a data sharing environment . . . . . . . . 266
Troubleshooting the administrative task scheduler . . . . . . . . . . . . . . . . . . . . . 267
Architecture of the administrative task scheduler . . . . . . . . . . . . . . . . . . . . . . 270
The lifecycle of the administrative task scheduler . . . . . . . . . . . . . . . . . . . . . 271
Task lists of the administrative task scheduler . . . . . . . . . . . . . . . . . . . . . . 273
Architecture of the administrative task scheduler in a data sharing environment . . . . . . . . . . . 273
Accounting information for stored procedure tasks . . . . . . . . . . . . . . . . . . . . . 274
Security guidelines for the administrative task scheduler . . . . . . . . . . . . . . . . . . . . 275
User roles in the administrative task scheduler . . . . . . . . . . . . . . . . . . . . . . 276
Protection of the interface of the administrative task scheduler . . . . . . . . . . . . . . . . . 277
Protection of the resources of the administrative task scheduler . . . . . . . . . . . . . . . . 277
Secure execution of tasks in the administrative task scheduler . . . . . . . . . . . . . . . . . 278
Execution of scheduled tasks in the administrative task scheduler . . . . . . . . . . . . . . . . . 279
Multi-threading in the administrative task scheduler . . . . . . . . . . . . . . . . . . . . 279
Scheduling execution of a stored procedure . . . . . . . . . . . . . . . . . . . . . . . 281
How the administrative task scheduler works with Unicode. . . . . . . . . . . . . . . . . . 282
Scheduled execution of a JCL job . . . . . . . . . . . . . . . . . . . . . . . . . . . 282
Execution of scheduled tasks in a data sharing environment. . . . . . . . . . . . . . . . . . 283
Time zone considerations for the administrative task scheduler. . . . . . . . . . . . . . . . . 284

Chapter 8. Monitoring and controlling Db2 and its connections . . . . . . . . . . . 285


Controlling Db2 databases and buffer pools . . . . . . . . . . . . . . . . . . . . . . . . 285
Starting databases . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 286
Monitoring databases. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 288
Obtaining information about application programs . . . . . . . . . . . . . . . . . . . . . 291
Obtaining information about and handling pages in error . . . . . . . . . . . . . . . . . . 293
Making objects unavailable . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 296

vi Administration Guide
Altering buffer pools . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 298
Monitoring buffer pools . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 299
Controlling user-defined functions . . . . . . . . . . . . . . . . . . . . . . . . . . . 300
Starting user-defined functions . . . . . . . . . . . . . . . . . . . . . . . . . . . 301
Monitoring user-defined functions . . . . . . . . . . . . . . . . . . . . . . . . . . 301
Stopping user-defined functions . . . . . . . . . . . . . . . . . . . . . . . . . . . 302
Controlling Db2 utilities . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 303
Starting online utilities . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 303
Monitoring and changing online utilities . . . . . . . . . . . . . . . . . . . . . . . . 304
Controlling Db2 stand-alone utilities. . . . . . . . . . . . . . . . . . . . . . . . . . 304
Controlling the IRLM. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 306
z/OS commands that operate on IRLM. . . . . . . . . . . . . . . . . . . . . . . . . 307
Starting the IRLM . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 308
Stopping the IRLM . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 308
Monitoring threads . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 309
Types of threads . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 310
Output of the DISPLAY THREAD command . . . . . . . . . . . . . . . . . . . . . . . 311
Displaying information about threads . . . . . . . . . . . . . . . . . . . . . . . . . 311
Monitoring all DBMSs in a transaction . . . . . . . . . . . . . . . . . . . . . . . . . 316
Controlling connections . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 319
Controlling TSO connections . . . . . . . . . . . . . . . . . . . . . . . . . . . . 319
Controlling CICS connections . . . . . . . . . . . . . . . . . . . . . . . . . . . . 322
Controlling IMS connections . . . . . . . . . . . . . . . . . . . . . . . . . . . . 327
Controlling RRS connections . . . . . . . . . . . . . . . . . . . . . . . . . . . . 338
Controlling connections to remote systems . . . . . . . . . . . . . . . . . . . . . . . 342
Controlling traces . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 366
Diagnostic traces for attachment facilities . . . . . . . . . . . . . . . . . . . . . . . . 366
Controlling the Db2 trace . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 367
Diagnostic trace for the IRLM . . . . . . . . . . . . . . . . . . . . . . . . . . . . 368
Setting the priority of stored procedures . . . . . . . . . . . . . . . . . . . . . . . . . 368
Setting special registers with profiles . . . . . . . . . . . . . . . . . . . . . . . . . . 369
| Setting built-in global variables with profiles . . . . . . . . . . . . . . . . . . . . . . . . 371

Chapter 9. Managing the log and the bootstrap data set . . . . . . . . . . . . . . 375
How database changes are made . . . . . . . . . . . . . . . . . . . . . . . . . . . . 375
Units of recovery and points of consistency . . . . . . . . . . . . . . . . . . . . . . . 375
How Db2 rolls back work . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 376
How the initial Db2 logging environment is established . . . . . . . . . . . . . . . . . . . 377
How Db2 creates log records . . . . . . . . . . . . . . . . . . . . . . . . . . . . 378
How Db2 writes the active log . . . . . . . . . . . . . . . . . . . . . . . . . . . 378
How Db2 writes (offloads) the archive log. . . . . . . . . . . . . . . . . . . . . . . . 379
How Db2 retrieves log records . . . . . . . . . . . . . . . . . . . . . . . . . . . . 384
Managing the log . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 384
Quiescing activity before offloading . . . . . . . . . . . . . . . . . . . . . . . . . . 384
Archiving the log . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 386
Adding an active log data set to the active log inventory with the SET LOG command. . . . . . . . . 387
Dynamically changing the checkpoint frequency. . . . . . . . . . . . . . . . . . . . . . 388
Setting limits for archive log tape units . . . . . . . . . . . . . . . . . . . . . . . . . 389
Monitoring the system checkpoint . . . . . . . . . . . . . . . . . . . . . . . . . . 389
Displaying log information . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 390
| What to do before RBA or LRSN limits are reached . . . . . . . . . . . . . . . . . . . . . 390
| Converting page sets to the 10-byte RBA or LRSN format . . . . . . . . . . . . . . . . . . 392
| Resetting the log RBA value in a data sharing environment (6-byte format). . . . . . . . . . . . . 394
| Resetting the log RBA value in a non-data sharing environment (6-byte format) . . . . . . . . . . . 395
Canceling and restarting an offload . . . . . . . . . . . . . . . . . . . . . . . . . . . 398
Displaying the status of an offload . . . . . . . . . . . . . . . . . . . . . . . . . . . 398
Discarding archive log records. . . . . . . . . . . . . . . . . . . . . . . . . . . . . 398
Locating archive log data sets . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 399
Management of the bootstrap data set . . . . . . . . . . . . . . . . . . . . . . . . . . 401
Restoring dual-BSDS mode . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 402
BSDS copies with archive log data sets . . . . . . . . . . . . . . . . . . . . . . . . . 403

Contents vii
Recommendations for changing the BSDS log inventory . . . . . . . . . . . . . . . . . . . 403

Chapter 10. Restarting Db2 after termination . . . . . . . . . . . . . . . . . . . 405


Methods of restarting. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 405
Types of termination . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 405
Normal restart and recovery . . . . . . . . . . . . . . . . . . . . . . . . . . . . 406
Automatic restart . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 411
Restart in a data sharing environment . . . . . . . . . . . . . . . . . . . . . . . . . 412
Restart implications for table spaces that are not logged . . . . . . . . . . . . . . . . . . . 412
Conditional restart . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 413
Terminating Db2 normally . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 413
Restarting automatically . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 414
Deferring restart processing . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 414
Performing conditional restart . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 416
Conditional restart with system-level backups . . . . . . . . . . . . . . . . . . . . . . 416
Options for recovery operations after conditional restart . . . . . . . . . . . . . . . . . . . 417
Conditional restart records . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 417
Resolving postponed units of recovery . . . . . . . . . . . . . . . . . . . . . . . . . . 417
Recovering from an error during RECOVER POSTPONED processing . . . . . . . . . . . . . . . 419

Chapter 11. Maintaining consistency across multiple systems . . . . . . . . . . . 421


Multiple system consistency . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 421
Two-phase commit process . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 421
Commit coordinator and multiple participants . . . . . . . . . . . . . . . . . . . . . . 423
Illustration of multi-site update . . . . . . . . . . . . . . . . . . . . . . . . . . . 424
Termination for multiple systems . . . . . . . . . . . . . . . . . . . . . . . . . . . 425
Consistency after termination or failure. . . . . . . . . . . . . . . . . . . . . . . . . 426
Normal restart and recovery for multiple systems . . . . . . . . . . . . . . . . . . . . . 427
Multiple-system restart with conditions. . . . . . . . . . . . . . . . . . . . . . . . . 428
Heuristic decisions about whether to commit or abort an indoubt thread . . . . . . . . . . . . . 428
Resolving indoubt units of recovery . . . . . . . . . . . . . . . . . . . . . . . . . . . 428
Resolution of IMS indoubt units of recovery . . . . . . . . . . . . . . . . . . . . . . . 429
Resolution of CICS indoubt units of recovery. . . . . . . . . . . . . . . . . . . . . . . 430
Resolution of RRS indoubt units of recovery . . . . . . . . . . . . . . . . . . . . . . . 430
Resolving WebSphere Application Server indoubt units of recovery . . . . . . . . . . . . . . . 431
Resolving remote DBMS indoubt units of recovery . . . . . . . . . . . . . . . . . . . . . 434
Determining the coordinator's commit or abort decision . . . . . . . . . . . . . . . . . . . 434
Recovering indoubt threads . . . . . . . . . . . . . . . . . . . . . . . . . . . . 435
Resetting the status of an indoubt thread . . . . . . . . . . . . . . . . . . . . . . . . 435
Resolving an indoubt unit of recovery during Db2 restart . . . . . . . . . . . . . . . . . . 436

Chapter 12. Backing up and recovering your data. . . . . . . . . . . . . . . . . 437


Plans for recovery of distributed data . . . . . . . . . . . . . . . . . . . . . . . . . . 438
| Plans for recovering the Db2 tables and indexes used to support Db2 query acceleration . . . . . . . . . 438
Plans for extended recovery facility toleration . . . . . . . . . . . . . . . . . . . . . . . 439
Plans for recovery of indexes . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 439
Actions to take when you back up data . . . . . . . . . . . . . . . . . . . . . . . . . 440
Actions to avoid when you back up data . . . . . . . . . . . . . . . . . . . . . . . . . 441
Preparation for recovery: a scenario . . . . . . . . . . . . . . . . . . . . . . . . . . . 442
Events that occur during recovery . . . . . . . . . . . . . . . . . . . . . . . . . . . 443
Complete recovery cycles . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 444
A recovery cycle example when using image copies . . . . . . . . . . . . . . . . . . . . 445
How DFSMShsm affects your recovery environment . . . . . . . . . . . . . . . . . . . . 446
Tips for maximizing data availability during backup and recovery . . . . . . . . . . . . . . . . 447
Where to find recovery information . . . . . . . . . . . . . . . . . . . . . . . . . . . 451
How to report recovery information . . . . . . . . . . . . . . . . . . . . . . . . . . . 452
Discarding SYSCOPY and SYSLGRNX records . . . . . . . . . . . . . . . . . . . . . . . 452
Preparations for disaster recovery . . . . . . . . . . . . . . . . . . . . . . . . . . . 454
System-wide points of consistency . . . . . . . . . . . . . . . . . . . . . . . . . . 455
Recommendations for more effective recovery from inconsistency . . . . . . . . . . . . . . . . . 456

viii Administration Guide


Actions to take to aid in successful recovery of inconsistent data . . . . . . . . . . . . . . . . 456
Actions to avoid in recovery of inconsistent data . . . . . . . . . . . . . . . . . . . . . 458
How to recover multiple objects in parallel . . . . . . . . . . . . . . . . . . . . . . . . 458
Recovery of page sets and data sets . . . . . . . . . . . . . . . . . . . . . . . . . . . 459
Recovery of the work file database . . . . . . . . . . . . . . . . . . . . . . . . . . 461
Page set and data set copies . . . . . . . . . . . . . . . . . . . . . . . . . . . . 461
System-level backups for object-level recoveries . . . . . . . . . . . . . . . . . . . . . . 465
Recovery of data to a prior point in time . . . . . . . . . . . . . . . . . . . . . . . . . 466
Plans for point-in-time recovery . . . . . . . . . . . . . . . . . . . . . . . . . . . 467
Point-in-time recovery with system-level backups . . . . . . . . . . . . . . . . . . . . . 468
Point-in-time recovery using the RECOVER utility . . . . . . . . . . . . . . . . . . . . . 470
Implications of moving data sets after a system-level backup . . . . . . . . . . . . . . . . . 480
Recovery of table spaces. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 481
Recovery of indexes . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 484
Recovery of FlashCopy image copies . . . . . . . . . . . . . . . . . . . . . . . . . 485
Preparing to recover to a prior point of consistency . . . . . . . . . . . . . . . . . . . . 486
Preparing to recover an entire Db2 subsystem to a prior point in time using image copies or object-level backups 488
Creating essential disaster recovery elements . . . . . . . . . . . . . . . . . . . . . . . . 489
Resolving problems with a user-defined work file data set . . . . . . . . . . . . . . . . . . . 491
Resolving problems with Db2-managed work file data sets . . . . . . . . . . . . . . . . . . . 491
Recovering error ranges for a work file table space . . . . . . . . . . . . . . . . . . . . . . 492
Recovery of error ranges for a work file table space . . . . . . . . . . . . . . . . . . . . 492
Recovering after a conditional restart of Db2 . . . . . . . . . . . . . . . . . . . . . . . . 492
Recovery of the catalog and directory . . . . . . . . . . . . . . . . . . . . . . . . . 493
Regenerating missing identity column values. . . . . . . . . . . . . . . . . . . . . . . . 493
Recovery of tables that contain identity columns . . . . . . . . . . . . . . . . . . . . . 494
Recovering a table space and all of its indexes . . . . . . . . . . . . . . . . . . . . . . . 495
Recovery implications for objects that are not logged . . . . . . . . . . . . . . . . . . . . 495
Removing various pending states from LOB and XML table spaces . . . . . . . . . . . . . . . . 499
Restoring data by using DSN1COPY . . . . . . . . . . . . . . . . . . . . . . . . . . 499
Backing up and restoring data with non-Db2 dump and restore . . . . . . . . . . . . . . . . . 500
Recovering accidentally dropped objects . . . . . . . . . . . . . . . . . . . . . . . . . 500
How to avoid accidentally dropping objects . . . . . . . . . . . . . . . . . . . . . . . 501
Recovering an accidentally dropped table . . . . . . . . . . . . . . . . . . . . . . . . 501
Recovering an accidentally dropped table space . . . . . . . . . . . . . . . . . . . . . . 503
Recovering a Db2 system to a given point in time using the RESTORE SYSTEM utility. . . . . . . . . . 507
Recovering by using Db2 restart recovery . . . . . . . . . . . . . . . . . . . . . . . . . 508
Recovering by using FlashCopy volume backups . . . . . . . . . . . . . . . . . . . . . . 509
Making catalog definitions consistent with your data after recovery to a prior point in time . . . . . . . . 509
Recovery of catalog and directory tables . . . . . . . . . . . . . . . . . . . . . . . . 512
Performing remote site recovery from a disaster at a local site . . . . . . . . . . . . . . . . . . 512
Recovering with the BACKUP SYSTEM and RESTORE SYSTEM utilities . . . . . . . . . . . . . 512
Recovering without using the BACKUP SYSTEM utility . . . . . . . . . . . . . . . . . . . 513
Backup and recovery involving clone tables . . . . . . . . . . . . . . . . . . . . . . . . 513
Recovery of temporal tables with system-period data versioning . . . . . . . . . . . . . . . . . 514
Data restore of an entire system . . . . . . . . . . . . . . . . . . . . . . . . . . . . 514

Chapter 13. Recovering from different Db2 for z/OS problems . . . . . . . . . . . 515
Recovering from IRLM failure . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 515
Recovering from z/OS or power failure . . . . . . . . . . . . . . . . . . . . . . . . . 515
Recovering from disk failure . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 516
Recovering from application errors . . . . . . . . . . . . . . . . . . . . . . . . . . . 518
Backing out incorrect application changes (with a quiesce point) . . . . . . . . . . . . . . . . 518
Backing out incorrect application changes (without a quiesce point) . . . . . . . . . . . . . . . 519
Recovering from IMS-related failures . . . . . . . . . . . . . . . . . . . . . . . . . . 519
Recovering from IMS control region failure . . . . . . . . . . . . . . . . . . . . . . . 520
Recovering from IMS indoubt units of recovery . . . . . . . . . . . . . . . . . . . . . . 520
Recovering from IMS application failure . . . . . . . . . . . . . . . . . . . . . . . . 522
Recovering from a Db2 failure in an IMS environment . . . . . . . . . . . . . . . . . . . 523
Recovering from CICS-related failure . . . . . . . . . . . . . . . . . . . . . . . . . . 523
Recovering from CICS application failures. . . . . . . . . . . . . . . . . . . . . . . . 524

Contents ix
Recovering Db2 when CICS is not operational . . . . . . . . . . . . . . . . . . . . . . 524
Recovering Db2 when the CICS attachment facility cannot connect to Db2 . . . . . . . . . . . . . 525
Recovering CICS indoubt units of recovery . . . . . . . . . . . . . . . . . . . . . . . 526
Recovering from CICS attachment facility failure . . . . . . . . . . . . . . . . . . . . . 529
Recovering from a QMF query failure . . . . . . . . . . . . . . . . . . . . . . . . . . 529
Recovering from subsystem termination . . . . . . . . . . . . . . . . . . . . . . . . . 530
Recovering from temporary resource failure . . . . . . . . . . . . . . . . . . . . . . . . 531
Recovering from active log failures . . . . . . . . . . . . . . . . . . . . . . . . . . . 532
Recovering from being out of space in active logs . . . . . . . . . . . . . . . . . . . . . 532
Recovering from a write I/O error on an active log data set . . . . . . . . . . . . . . . . . . 533
Recovering from a loss of dual active logging . . . . . . . . . . . . . . . . . . . . . . 534
Recovering from I/O errors while reading the active log . . . . . . . . . . . . . . . . . . . 534
Recovering from archive log failures. . . . . . . . . . . . . . . . . . . . . . . . . . . 536
Recovering from allocation problems with the archive log . . . . . . . . . . . . . . . . . . 536
Recovering from write I/O errors during archive log offload . . . . . . . . . . . . . . . . . 537
Recovering from read I/O errors on an archive data set during recovery . . . . . . . . . . . . . 537
Recovering from insufficient disk space for offload processing . . . . . . . . . . . . . . . . . 538
Recovering from BSDS failures . . . . . . . . . . . . . . . . . . . . . . . . . . . . 539
Recovering from an I/O error on the BSDS . . . . . . . . . . . . . . . . . . . . . . . 539
Recovering from an error that occurs while opening the BSDS . . . . . . . . . . . . . . . . . 540
Recovering from unequal timestamps on BSDSs . . . . . . . . . . . . . . . . . . . . . . 540
Recovering the BSDS from a backup copy . . . . . . . . . . . . . . . . . . . . . . . . 541
Recovering from BSDS or log failures during restart . . . . . . . . . . . . . . . . . . . . . 543
Recovering from failure during log initialization or current status rebuild . . . . . . . . . . . . . 546
Recovering from a failure during forward log recovery . . . . . . . . . . . . . . . . . . . 558
Recovering from a failure during backward log recovery . . . . . . . . . . . . . . . . . . . 563
Recovering from a failure during a log RBA read request. . . . . . . . . . . . . . . . . . . 566
Recovering from unresolvable BSDS or log data set problem during restart. . . . . . . . . . . . . 567
Recovering from a failure resulting from total or excessive loss of log data . . . . . . . . . . . . . 569
Resolving inconsistencies resulting from a conditional restart . . . . . . . . . . . . . . . . . 573
Recovering from Db2 database failure . . . . . . . . . . . . . . . . . . . . . . . . . . 579
Recovering a Db2 subsystem to a prior point in time . . . . . . . . . . . . . . . . . . . . . 580
Recovering from a down-level page set problem. . . . . . . . . . . . . . . . . . . . . . . 581
Recovering from a problem with invalid LOBs . . . . . . . . . . . . . . . . . . . . . . . 583
Recovering from table space I/O errors. . . . . . . . . . . . . . . . . . . . . . . . . . 584
Recovering from Db2 catalog or directory I/O errors . . . . . . . . . . . . . . . . . . . . . 585
Recovering from integrated catalog facility failure . . . . . . . . . . . . . . . . . . . . . . 586
Recovering VSAM volume data sets that are out of space or destroyed . . . . . . . . . . . . . . 586
Recovering from out-of-disk-space or extent limit problems . . . . . . . . . . . . . . . . . . 587
Recovering from referential constraint violation . . . . . . . . . . . . . . . . . . . . . . . 591
Recovering from distributed data facility failure . . . . . . . . . . . . . . . . . . . . . . . 592
Recovering from conversation failure . . . . . . . . . . . . . . . . . . . . . . . . . 592
Recovering from communications database failure . . . . . . . . . . . . . . . . . . . . . 593
Recovering from database access thread failure . . . . . . . . . . . . . . . . . . . . . . 594
Recovering from VTAM failure . . . . . . . . . . . . . . . . . . . . . . . . . . . 595
| Recovering from VTAM ACB OPEN problems . . . . . . . . . . . . . . . . . . . . . . 595
Recovering from TCP/IP failure . . . . . . . . . . . . . . . . . . . . . . . . . . . 596
Recovering from remote logical unit failure . . . . . . . . . . . . . . . . . . . . . . . 597
Recovering from an indefinite wait condition . . . . . . . . . . . . . . . . . . . . . . . 597
Recovering database access threads after security failure . . . . . . . . . . . . . . . . . . . 598
Performing remote-site disaster recovery . . . . . . . . . . . . . . . . . . . . . . . . . 599
Recovering from a disaster by using system-level backups . . . . . . . . . . . . . . . . . . 599
Restoring data from image copies and archive logs . . . . . . . . . . . . . . . . . . . . . 599
Recovering from disasters by using a tracker site . . . . . . . . . . . . . . . . . . . . . 614
Using data mirroring for disaster recovery . . . . . . . . . . . . . . . . . . . . . . . 623
Scenarios for resolving problems with indoubt threads . . . . . . . . . . . . . . . . . . . . 630
Scenario: Recovering from communication failure . . . . . . . . . . . . . . . . . . . . . 631
Scenario: Making a heuristic decision about whether to commit or abort an indoubt thread . . . . . . . 633
Scenario: Recovering from an IMS outage that results in an IMS cold start . . . . . . . . . . . . . 635
Scenario: Recovering from a Db2 outage at a requester that results in a Db2 cold start . . . . . . . . . 636
Scenario: What happens when the wrong Db2 subsystem is cold started . . . . . . . . . . . . . 640

x Administration Guide
Scenario: Correcting damage from an incorrect heuristic decision about an indoubt thread . . . . . . . 642

Chapter 14. Reading log records . . . . . . . . . . . . . . . . . . . . . . . . 645


Contents of the log . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 645
Unit of recovery log records . . . . . . . . . . . . . . . . . . . . . . . . . . . . 646
Checkpoint log records . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 650
Database page set control records . . . . . . . . . . . . . . . . . . . . . . . . . . 651
Other exception information . . . . . . . . . . . . . . . . . . . . . . . . . . . . 651
The physical structure of the log . . . . . . . . . . . . . . . . . . . . . . . . . . . . 651
Physical and logical log records . . . . . . . . . . . . . . . . . . . . . . . . . . . 652
The log record header . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 653
The log control interval definition (LCID) . . . . . . . . . . . . . . . . . . . . . . . . 654
Log record type codes . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 658
Log record subtype codes . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 659
Interpreting data change log records. . . . . . . . . . . . . . . . . . . . . . . . . . 661
Reading log records with IFI . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 661
Gathering active log records into a buffer . . . . . . . . . . . . . . . . . . . . . . . . 662
Reading specific log records (IFCID 0129) . . . . . . . . . . . . . . . . . . . . . . . . 662
Reading complete log data (IFCID 0306) . . . . . . . . . . . . . . . . . . . . . . . . 663
| Reading complete log data for the GDPS Continuous Availability with zero data loss solution . . . . . . . 668
| Modifying Db2 for the GDPS Continuous Availability with zero data loss solution . . . . . . . . . . 668
| Upgrading a Db2 11 GDPS Continuous Availability with zero data loss environment to a Db2 12 environment 671
| Modifying IFI READS calls for the GDPS Continuous Availability with zero data loss environment . . . . 672
| Recovering the compression dictionary data set without bringing down a Db2 data sharing group . . . . . 673
Reading log records with OPEN, GET, and CLOSE . . . . . . . . . . . . . . . . . . . . . . 674
JCL DD statements for Db2 stand-alone log services . . . . . . . . . . . . . . . . . . . . 675
Data sharing members that participate in a read. . . . . . . . . . . . . . . . . . . . . . 678
Registers and return codes . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 678
Stand-alone log OPEN request. . . . . . . . . . . . . . . . . . . . . . . . . . . . 679
Stand-alone log GET request . . . . . . . . . . . . . . . . . . . . . . . . . . . . 681
Stand-alone log CLOSE request . . . . . . . . . . . . . . . . . . . . . . . . . . . 682
Sample application that uses stand-alone log services . . . . . . . . . . . . . . . . . . . . 683
Reading log records with the log capture exit routine . . . . . . . . . . . . . . . . . . . . . 684
How RBA and LRSN values are displayed . . . . . . . . . . . . . . . . . . . . . . . . 685

Part 3. Appendixes . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 687

Appendix A. Exit routines . . . . . . . . . . . . . . . . . . . . . . . . . . . 689


Edit procedures . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 689
Specifying edit procedures . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 690
When edit routines are taken . . . . . . . . . . . . . . . . . . . . . . . . . . . . 690
Parameter list for edit procedures . . . . . . . . . . . . . . . . . . . . . . . . . . 691
Incomplete rows and edit routines . . . . . . . . . . . . . . . . . . . . . . . . . . 691
Expected output for edit routines. . . . . . . . . . . . . . . . . . . . . . . . . . . 692
Validation routines . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 693
Specifying validation routines . . . . . . . . . . . . . . . . . . . . . . . . . . . . 694
When validation routines are taken . . . . . . . . . . . . . . . . . . . . . . . . . . 694
Parameter list for validation routines . . . . . . . . . . . . . . . . . . . . . . . . . 695
Incomplete rows and validation routines . . . . . . . . . . . . . . . . . . . . . . . . 696
Expected output for validation routines . . . . . . . . . . . . . . . . . . . . . . . . 696
Date and time routines . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 697
Specifying date and time routines . . . . . . . . . . . . . . . . . . . . . . . . . . 697
When date and time routines are taken . . . . . . . . . . . . . . . . . . . . . . . . . 698
Parameter list for date and time routines . . . . . . . . . . . . . . . . . . . . . . . . 699
Expected output for date and time routines . . . . . . . . . . . . . . . . . . . . . . . 700
Conversion procedures . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 701
Specifying conversion procedures . . . . . . . . . . . . . . . . . . . . . . . . . . 701
When conversion procedures are taken . . . . . . . . . . . . . . . . . . . . . . . . . 702
Parameter list for conversion procedures . . . . . . . . . . . . . . . . . . . . . . . . 702
Expected output for conversion procedures . . . . . . . . . . . . . . . . . . . . . . . 703

Contents xi
Field procedures . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 704
Field-definition for field procedures . . . . . . . . . . . . . . . . . . . . . . . . . . 705
Specifying field procedures . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 705
When field procedures are taken . . . . . . . . . . . . . . . . . . . . . . . . . . . 706
Control blocks for execution of field procedures . . . . . . . . . . . . . . . . . . . . . . 707
Field-definition (function code 8) . . . . . . . . . . . . . . . . . . . . . . . . . . . 711
Field-encoding (function code 0) . . . . . . . . . . . . . . . . . . . . . . . . . . . 713
Field-decoding (function code 4) . . . . . . . . . . . . . . . . . . . . . . . . . . . 715
Log capture routines . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 717
Specifying log capture routines . . . . . . . . . . . . . . . . . . . . . . . . . . . 718
When log capture routines are invoked . . . . . . . . . . . . . . . . . . . . . . . . . 718
Parameter list for log capture routines . . . . . . . . . . . . . . . . . . . . . . . . . 719
Routines for dynamic plan selection in CICS . . . . . . . . . . . . . . . . . . . . . . . . 720
General guidelines for writing exit routines . . . . . . . . . . . . . . . . . . . . . . . . 721
Coding rules for exit routines . . . . . . . . . . . . . . . . . . . . . . . . . . . . 721
Modifying exit routines . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 722
Execution environment for exit routines . . . . . . . . . . . . . . . . . . . . . . . . 722
Registers at invocation for exit routines. . . . . . . . . . . . . . . . . . . . . . . . . 722
Parameter list for exit routines. . . . . . . . . . . . . . . . . . . . . . . . . . . . 723
Row formats for edit and validation routines . . . . . . . . . . . . . . . . . . . . . . . . 724
Column boundaries for edit and validation procedures . . . . . . . . . . . . . . . . . . . 724
Null values for edit procedures, field procedures, and validation routines . . . . . . . . . . . . . 725
Fixed-length rows for edit and validation routines . . . . . . . . . . . . . . . . . . . . . 725
Varying-length rows for edit and validation routines . . . . . . . . . . . . . . . . . . . . 725
Varying-length rows with nulls for edit and validation routines . . . . . . . . . . . . . . . . 726
EDITPROCs and VALIDPROCs for handling basic and reordered row formats . . . . . . . . . . . 727
Converting basic row format table spaces with edit and validation routines to reordered row format . . . . 727
Dates, times, and timestamps for edit and validation routines . . . . . . . . . . . . . . . . . 729
Parameter list for row format descriptions . . . . . . . . . . . . . . . . . . . . . . . . 729
Db2 codes for numeric data in edit and validation routines . . . . . . . . . . . . . . . . . . 731

Appendix B. Stored procedures for administration . . . . . . . . . . . . . . . . 733


Common SQL API stored procedures . . . . . . . . . . . . . . . . . . . . . . . . . . 733
Versioning of XML documents. . . . . . . . . . . . . . . . . . . . . . . . . . . . 734
XML input documents . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 735
XML output documents . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 736
XML message documents . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 737
Troubleshooting Db2 stored procedure problems . . . . . . . . . . . . . . . . . . . . . . 738

Information resources for Db2 12 for z/OS and related products . . . . . . . . . . 739

Notices . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 741
Programming interface information . . . . . . . . . . . . . . . . . . . . . . . . . . . 742
Trademarks . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 743
Terms and conditions for product documentation . . . . . . . . . . . . . . . . . . . . . . 744
Privacy policy considerations . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 744

Glossary . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 747

Index . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 749

xii Administration Guide


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).

Throughout this information, “Db2” means “Db2 12 for z/OS”. References to other
Db2 products use complete names or specific abbreviations.

Important: To find the most up to date content, always use IBM® Knowledge
Center, which is continually updated as soon as changes are ready. PDF manuals
are updated only when new editions are published, on an infrequent basis.

How Db2 function levels are documented:

| Generally, this information assumes that the highest available function level is
| activated , and that your applications run with the equivalent application
| compatibility value. However, changes for function levels are marked in the
| documentation. For more information, see How Db2 function levels are
| documented (Db2 for z/OS What's New?).
Overview of Db2 12 new function availability
The availability of new function depends on the type of enhancement, the
activated function level, and the application compatibility levels of
applications. In the initial Db2 12 release, most new capabilities are
enabled only after the activation of function level 500 or higher.
Virtual storage enhancements
Virtual storage enhancements become available at the activation of
the function level that introduces them or higher. Activation of
function level 100 introduces all virtual storage enhancements in
the initial Db2 12 release. That is, activation of function level 500
introduces no virtual storage enhancements.
Subsystem parameters
New subsystem parameter settings are in effect only when the
function level that introduced them or a higher function level is
activated. Most subsystem parameter changes in the initial Db2 12
release take effect in function level 500. For a list of these changes,
see Subsystem parameter changes in Db2 12 (Db2 for z/OS What's
New?).
Optimization enhancements
Optimization enhancements become available after the activation
of the function level that introduces them or higher, and full
prepare of the SQL statements. When a full prepare occurs
depends on the statement type:
v For static SQL statements, after bind or rebind of the package
v For non-stabilized dynamic SQL statements, immediately, unless
the statement is in the dynamic statement cache
v For stabilized dynamic SQL statements, after invalidation, free,
or changed application compatibility level
Activation of function level 100 introduces all optimization
enhancements in the initial Db2 12 release. That is, function level
500 introduces no optimization enhancements.

© Copyright IBM Corp. 1982, 2017 xiii


SQL capabilities
New SQL capabilities become available after the activation of the
function level that introduces them or higher, for applications that
run at the equivalent application compatibility level or higher. New
SQL capabilities in the initial Db2 12 release become available in
function level 500 for applications that run at the equivalent
application compatibility level or higher. You can continue to run
SQL statements compatibly with lower function levels, or previous
Db2 releases, including Db2 11 and DB2® 10. For details, see
Application compatibility levels in Db2 (Db2 Application
programming and SQL)

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 for z/OS


Important: In this Db2 12, Db2 Utilities Suite for z/OS 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.

Db2 12 utilities can use the DFSORT program regardless of whether you purchased
a license for DFSORT on your system. For more information, see the following
informational APARs:
v II14047
v II14213
v II13495

Db2 utilities can use IBM Db2 Sort for z/OS (5655-W42) as an alternative to
DFSORT for utility SORT and MERGE functions. Use of Db2 Sort for z/OS
requires the purchase of a Db2 Sort for z/OS license. For more information about
Db2 Sort for z/OS, see Db2 Sort for z/OS.
Related concepts:
Db2 utilities packaging (Db2 Utilities)

xiv Administration Guide


Terminology and citations
When referring to a Db2 product other than Db2 for z/OS, this information uses
the product's full name to avoid ambiguity.

| About the Db2 brand change: IBM is rebranding DB2 to Db2. As such, there will
| be changes to all the Db2 offerings. For example, “DB2 for z/OS” is now referred
| to as “Db2 for z/OS,” beginning with Db2 11. While IBM implements the change
| across the Db2 family of products, you might see references to the original name
| “DB2 for z/OS” or “DB2” in different IBM web pages and documents. “DB2 for
| z/OS” and “Db2 for z/OS” refer to the same product, when the PID, Entitlement
| Entity, version, modification, and release information match. For more information,
| see Revised naming for IBM Db2 family products.

The following terms are used as indicated:


Db2 Represents either the Db2 licensed program or a particular Db2 subsystem.
Tivoli® OMEGAMON® XE for Db2 Performance Expert on z/OS
Refers to any of the following products:
v IBM Tivoli OMEGAMON XE for Db2 Performance Expert on z/OS
v IBM 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 12 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 12 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 IBM Knowledge Center (which includes information for Db2 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.

About this information xv

Potrebbero piacerti anche