db2 12 for z/os: administration guide - ibm...contents about this information.....xv who should read...

784
Db2 12 for z/OS Administration Guide IBM SC27-8844-02

Upload: others

Post on 03-Feb-2021

2 views

Category:

Documents


0 download

TRANSCRIPT

  • 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 thelatest edition from PDF format manuals for Db2 12 for z/OS (Db2 for z/OS in IBM Documentation).

    2021-06-15 edition

    This edition applies to Db2® 12 for z/OS® (product number 5650-DB2), Db2 12 for z/OS Value Unit Edition (productnumber 5770-AF3), and to any subsequent releases until otherwise indicated in new editions. Make sure you are usingthe 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 captionindicates that the figure has changed. Editorial changes that have no technical significance are not noted.© Copyright International Business Machines Corporation 1982, 2021.US Government Users Restricted Rights – Use, duplication or disclosure restricted by GSA ADP Schedule Contract withIBM Corp.

    https://www.ibm.com/docs/en/SSEPEK_12.0.0/home/src/tpc/db2z_pdfmanuals.html

  • Contents

    About this information......................................................................................... xvWho should read this information............................................................................................................. xviDb2 Utilities Suite for z/OS........................................................................................................................xviTerminology and citations......................................................................................................................... xviAccessibility features for Db2 12 for z/OS............................................................................................... xviiHow to send your comments about Db2 for z/OS documentation..........................................................xviiHow to read syntax diagrams.................................................................................................................. xviii

    Part 1. Designing and implementing Db2 databases............................................... 1

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

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

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

    Denormalization of tables...............................................................................................................14Views to customize what data users see....................................................................................... 15Indexes on table columns.............................................................................................................. 16Hash access on tables.................................................................................................................... 16Maintaining archive data.................................................................................................................17

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

    Creating Db2 databases................................................................................................................. 19Dropping Db2 databases................................................................................................................ 20

    Implementing Db2 storage groups......................................................................................................20Advantages of storage groups........................................................................................................ 20Creating Db2 storage groups..........................................................................................................22Enabling SMS to control Db2 storage groups.................................................................................22Deferring allocation of Db2-managed data sets............................................................................ 23How Db2 extends data sets............................................................................................................24Db2 space allocation...................................................................................................................... 25Managing Db2 data sets with DFSMShsm......................................................................................28Managing your own data sets......................................................................................................... 33Assignment of table spaces and index spaces to physical storage.............................................. 37Defining index space storage..........................................................................................................40Creating EA-enabled table spaces and index spaces....................................................................40

    Implementing Db2 table spaces..........................................................................................................41Table space types and characteristics in Db2 for z/OS..................................................................42Implicitly defined table spaces...................................................................................................... 51Creating table spaces explicitly......................................................................................................53Creating partition-by-range table spaces...................................................................................... 57Creating partition-by-growth table spaces.................................................................................... 58EA-enabled table spaces and index spaces...................................................................................59

    Implementing Db2 tables.................................................................................................................... 60

    iii

  • Types of tables................................................................................................................................61Guidelines for table names.............................................................................................................63Creating base tables....................................................................................................................... 64Partitioning data in Db2 tables....................................................................................................... 65Nullable partitioning columns........................................................................................................ 67Creating temporary tables..............................................................................................................68Creating temporal tables................................................................................................................ 73Creating materialized query tables................................................................................................ 86Creating a clone table .................................................................................................................... 87Creating an archive table................................................................................................................ 89

    Implementing Db2 views..................................................................................................................... 90Creating Db2 views......................................................................................................................... 90Guidelines for view names............................................................................................................. 91Querying views that reference temporal tables.............................................................................92How Db2 inserts and updates data through views........................................................................ 92Dropping Db2 views........................................................................................................................93

    Implementing Db2 indexes..................................................................................................................93Creating Db2 indexes......................................................................................................................94Index names and guidelines...........................................................................................................94How Db2 implicitly creates an index..............................................................................................96

    Implementing Db2 schemas................................................................................................................96Creating a schema by using the schema processor.......................................................................96Processing schema definitions.......................................................................................................97

    Loading data into Db2 tables............................................................................................................... 98Loading data with the LOAD utility................................................................................................. 98Loading data by using the INSERT statement............................................................................. 100Loading data with DRDA fast load (zLoad)...................................................................................103Loading data from DL/I.................................................................................................................106

    Implementing Db2 stored procedures.............................................................................................. 106Creating stored procedures..........................................................................................................107Dropping stored procedures........................................................................................................ 108

    Implementing Db2 user-defined functions.......................................................................................109Creating user-defined functions...................................................................................................109Deleting user-defined functions...................................................................................................110

    Obfuscating source code of SQL procedures, SQL functions, and triggers...................................... 111Estimating disk storage for user data................................................................................................ 112

    General approach to estimating storage......................................................................................113Calculating the space required for a table .................................................................................. 114Calculating the space required for an index................................................................................ 118

    Identifying databases that might exceed the OBID limit..................................................................124

    Chapter 3. Altering your database design...............................................................................................127Using the catalog in database design................................................................................................127

    Retrieving catalog information about Db2 storage groups..........................................................127Retrieving catalog information about a table...............................................................................128Retrieving catalog information about partition order.................................................................. 128Retrieving catalog information about aliases.............................................................................. 129Retrieving catalog information about columns............................................................................129Retrieving catalog information about indexes............................................................................. 130Retrieving catalog information about views................................................................................ 131Retrieving catalog information about authorizations.................................................................. 131Retrieving catalog information about primary keys.....................................................................132Retrieving catalog information about foreign keys......................................................................132Retrieving catalog information about check pending..................................................................133Retrieving catalog information about check constraints.............................................................133Retrieving catalog information about LOBs................................................................................. 134Retrieving catalog information about user-defined functions and stored procedures.............. 135Retrieving catalog information about triggers............................................................................. 135

    iv

  • Retrieving catalog information about sequences........................................................................ 136Adding and retrieving comments................................................................................................. 136Verifying the accuracy of the database definition....................................................................... 137

    Altering Db2 databases......................................................................................................................137Altering Db2 storage groups.............................................................................................................. 137

    Letting SMS manage your Db2 storage groups............................................................................138Adding or removing volumes from a Db2 storage group............................................................. 139Migrating existing data sets to a solid-state drive....................................................................... 140

    Altering table spaces..........................................................................................................................140Changing the logging attribute for a table space......................................................................... 142Changing the space allocation for user-managed data sets....................................................... 143Dropping and re-creating a table space to change its attributes................................................144Redistributing data in partitioned table spaces...........................................................................146Increasing partition size............................................................................................................... 147Altering a page set to contain Db2-defined extents....................................................................148Converting deprecated table spaces to fully supported types................................................... 148Moving tables from multi-table table spaces to partition-by-growth table spaces................... 149Converting partitioned (non-UTS) table spaces to partition-by-range universal table spaces..154Converting table spaces to use table-controlled partitioning.....................................................155

    Altering Db2 tables............................................................................................................................ 158Adding a column to a table...........................................................................................................159Specifying a default value when altering a column..................................................................... 160Altering the data type of a column............................................................................................... 161Altering a table for referential integrity........................................................................................171Adding or dropping table check constraints................................................................................ 174Adding partitions.......................................................................................................................... 175Altering partitions......................................................................................................................... 180Adding XML columns.................................................................................................................... 189Altering the size of your hash spaces ..........................................................................................190Adding a system period and system-period data versioning to an existing table...................... 191Adding an application period to a table....................................................................................... 192Manipulating data in a system-period temporal table................................................................ 193Altering materialized query tables............................................................................................... 194Altering the assignment of a validation routine...........................................................................195Altering a table to capture changed data.....................................................................................196Changing an edit procedure or a field procedure........................................................................ 197Altering the subtype of a string column....................................................................................... 197Altering the attributes of an identity column............................................................................... 198Changing data types by dropping and re-creating the table....................................................... 198Moving a table to a table space of a different page size..............................................................202

    Altering Db2 views............................................................................................................................. 202Altering views by using the INSTEAD OF trigger......................................................................... 203Changing data by using views that reference temporal tables................................................... 203

    Altering Db2 indexes..........................................................................................................................204Alternative method for altering an index..................................................................................... 205Adding columns to an index......................................................................................................... 205Altering how varying-length index columns are stored...............................................................207Altering the clustering of an index............................................................................................... 208Dropping and redefining a Db2 index...........................................................................................209Reorganizing indexes....................................................................................................................210

    Pending data definition changes........................................................................................................211Materializing pending definition changes.................................................................................... 215Restrictions for pending data definition changes........................................................................ 219Pending column alterations..........................................................................................................224

    Altering stored procedures................................................................................................................ 226Altering user-defined functions......................................................................................................... 227Altering implicitly created XML objects............................................................................................. 228Changing the high-level qualifier for Db2 data sets..........................................................................229

    v

  • Defining a new integrated catalog alias....................................................................................... 229Changing the qualifier for system data sets................................................................................ 229Changing qualifiers for other databases and user data sets.......................................................233

    Tools for moving Db2 data................................................................................................................. 237Moving Db2 data........................................................................................................................... 239Moving a Db2 data set.................................................................................................................. 240

    Part 2. Operation and recovery...........................................................................243

    Chapter 4. Controlling Db2 operations by using commands..................................................................365Issuing commands from the z/OS console........................................................................................367Issuing commands from TSO terminals............................................................................................ 367Issuing commands from CICS terminals...........................................................................................369Issuing commands from IMS terminals............................................................................................ 369Issuing commands from application programs................................................................................ 370Destinations for command output messages................................................................................... 371Unsolicited Db2 messages.................................................................................................................371

    Chapter 5. Starting and stopping Db2.....................................................................................................373Starting Db2....................................................................................................................................... 373

    Messages at start..........................................................................................................................374Subsystem parameters at start....................................................................................................374Application defaults module name at start................................................................................. 375Restricting access to data............................................................................................................ 375Ending the wait state at startup................................................................................................... 375Restart options after an abend.....................................................................................................375

    Stopping Db2......................................................................................................................................376

    Chapter 6. Submitting work to Db2.........................................................................................................377Submitting work by using DB2I......................................................................................................... 377Running TSO application programs................................................................................................... 378

    Sources that Db2 checks to find authorization access for an application program................... 378Running IMS application programs................................................................................................... 378Running CICS application programs..................................................................................................379Running batch application programs.................................................................................................380Running application programs using CAF......................................................................................... 380Running application programs using RRSAF.....................................................................................381

    Chapter 7. Scheduling administrative tasks........................................................................................... 383Interacting with the administrative task scheduler.......................................................................... 383

    Adding a task................................................................................................................................ 383Listing scheduled tasks................................................................................................................ 388Listing the status of scheduled tasks...........................................................................................389Updating the schedule for a task................................................................................................. 391Stopping the execution of a task..................................................................................................391Removing a scheduled task..........................................................................................................392Manually starting the administrative task scheduler ..................................................................392Manually stopping the administrative task scheduler ................................................................393Synchronization between administrative task schedulers in a data sharing environment........ 393Troubleshooting the administrative task scheduler.................................................................... 394

    Architecture of the administrative task scheduler............................................................................397The lifecycle of the administrative task scheduler...................................................................... 398Task lists of the administrative task scheduler............................................................................399Architecture of the administrative task scheduler in a data sharing environment.....................399Accounting information for stored procedure tasks....................................................................400

    Security guidelines for the administrative task scheduler................................................................401User roles in the administrative task scheduler.......................................................................... 402

    vi

  • Protection of the interface of the administrative task scheduler................................................402Protection of the resources of the administrative task scheduler.............................................. 402Secure execution of tasks in the administrative task scheduler.................................................403

    Execution of scheduled tasks in the administrative task scheduler.................................................404Multi-threading in the administrative task scheduler................................................................. 404Scheduling execution of a stored procedure............................................................................... 406How the administrative task scheduler works with Unicode...................................................... 407Scheduled execution of a JCL job................................................................................................ 407Execution of scheduled tasks in a data sharing environment..................................................... 408Time zone considerations for the administrative task scheduler............................................... 408

    Chapter 8. Monitoring and controlling Db2 and its connections............................................................411Controlling Db2 databases and buffer pools.....................................................................................411

    Starting databases........................................................................................................................412Monitoring databases................................................................................................................... 414Obtaining information about application programs.................................................................... 416Obtaining information about and handling pages in error...........................................................418Making objects unavailable.......................................................................................................... 421Altering buffer pools..................................................................................................................... 422Monitoring buffer pools................................................................................................................ 423

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

    Monitoring and controlling stored procedures..................................................................................426Displaying information about stored procedures with Db2 commands..................................... 427Determining the status of an application environment............................................................... 429Refreshing WLM application environments for stored procedures.............................................430Refreshing WLM environments for stored procedures automatically.........................................431Obtaining diagnostic information and debugging stored procedures.........................................432Migrating stored procedures from test to production................................................................. 433

    Setting the priority of stored procedures.......................................................................................... 436Controlling autonomous procedures.................................................................................................436Controlling Db2 utilities..................................................................................................................... 437

    Starting online utilities................................................................................................................. 437Monitoring and changing online utilities...................................................................................... 437Controlling Db2 stand-alone utilities........................................................................................... 438

    Controlling the IRLM.......................................................................................................................... 439z/OS commands that operate on IRLM........................................................................................ 440Starting the IRLM..........................................................................................................................441Stopping the IRLM........................................................................................................................ 441

    Monitoring threads............................................................................................................................. 442Monitoring threads with DISPLAY THREAD commands.............................................................. 443Monitoring threads with profile tables.........................................................................................450Monitoring idle threads with profile tables.................................................................................. 455

    Controlling connections..................................................................................................................... 459Controlling TSO connections........................................................................................................ 459Controlling CICS connections.......................................................................................................462Controlling IMS connections........................................................................................................ 467Controlling RRS connections........................................................................................................477Controlling connections to remote systems................................................................................ 481

    Monitoring and controlling Db2 with profile tables...........................................................................496Starting and stopping profiles...................................................................................................... 498Modifying existing profiles............................................................................................................499How Db2 applies multiple matching profiles for threads and connections................................499Examples for profiles that monitor and control threads and connections................................. 503

    Controlling traces............................................................................................................................... 506Diagnostic traces for attachment facilities.................................................................................. 506

    vii

  • Controlling Db2 trace data collection.......................................................................................... 507Diagnostic trace for the IRLM.......................................................................................................508

    Setting special registers with profile tables...................................................................................... 508Setting built-in global variables with profile tables...........................................................................512

    Chapter 9. Managing the log and the bootstrap data set....................................................................... 517How database changes are made......................................................................................................517

    Units of recovery and points of consistency................................................................................ 517How Db2 rolls back work..............................................................................................................518How the initial Db2 logging environment is established............................................................. 519How Db2 creates log records....................................................................................................... 519How Db2 writes the active log......................................................................................................519How Db2 writes (offloads) the archive log...................................................................................520

    How Db2 retrieves log records.......................................................................................................... 524Managing the log................................................................................................................................ 525

    Quiescing activity before offloading.............................................................................................525Archiving the log........................................................................................................................... 526Adding an active log data set to the active log inventory with the SET LOG command............. 527Dynamically changing the checkpoint frequency........................................................................ 528Setting limits for archive log tape units........................................................................................528Monitoring the system checkpoint...............................................................................................529Displaying log information............................................................................................................529

    What to do before RBA or LRSN limits are reached.......................................................................... 530Converting page sets to the 10-byte RBA or LRSN format..........................................................532Resetting the log RBA value in a data sharing environment (6-byte format)............................. 533Resetting the log RBA value in a non-data sharing environment (6-byte format)......................534

    Canceling and restarting an offload...................................................................................................536Displaying the status of an offload.................................................................................................... 536Discarding archive log records...........................................................................................................537Locating archive log data sets............................................................................................................537Management of the bootstrap data set............................................................................................. 539

    Restoring dual-BSDS mode.......................................................................................................... 540BSDS copies with archive log data sets....................................................................................... 540Recommendations for changing the BSDS log inventory............................................................ 541

    Chapter 10. Restarting Db2 after termination........................................................................................ 543Methods of restarting.........................................................................................................................543

    Types of termination.....................................................................................................................543Normal restart and recovery........................................................................................................ 544Automatic restart..........................................................................................................................549Restart in a data sharing environment.........................................................................................549Restart implications for table spaces that are not logged...........................................................549Conditional restart........................................................................................................................550

    Terminating Db2 normally................................................................................................................. 550Restarting automatically.................................................................................................................... 551Deferring restart processing.............................................................................................................. 551Performing conditional restart...........................................................................................................552

    Conditional restart with system-level backups........................................................................... 553Options for recovery operations after conditional restart...........................................................553Conditional restart records...........................................................................................................553

    Resolving postponed units of recovery............................................................................................. 554Recovering from an error during RECOVER POSTPONED processing.............................................. 555

    Chapter 11. Maintaining consistency across multiple systems............................................................. 557Multiple system consistency..............................................................................................................557

    Two-phase commit process......................................................................................................... 557Commit coordinator and multiple participants............................................................................559Illustration of multi-site update................................................................................................... 560

    viii

  • Termination for multiple systems................................................................................................ 561Consistency after termination or failure...................................................................................... 561Normal restart and recovery for multiple systems...................................................................... 563Multiple-system restart with conditions...................................................................................... 563Heuristic decisions about whether to commit or abort an indoubt thread.................................564

    Resolving indoubt units of recovery.................................................................................................. 564Resolution of IMS indoubt units of recovery................................................................................564Resolution of CICS indoubt units of recovery.............................................................................. 565Resolution of RRS indoubt units of recovery............................................................................... 566Resolving WebSphere Application Server indoubt units of recovery..........................................566Resolving remote DBMS indoubt units of recovery..................................................................... 568Determining the coordinator's commit or abort decision........................................................... 569Recovering indoubt threads......................................................................................................... 569Resetting the status of an indoubt thread................................................................................... 570Resolving an indoubt unit of recovery during Db2 restart...........................................................570

    Chapter 12. Backing up and recovering your data..................................................................................573Plans for recovery of distributed data............................................................................................... 574Plans for recovering the Db2 tables and indexes used to support Db2 query acceleration............574Plans for extended recovery facility toleration................................................................................. 574Plans for recovery of indexes.............................................................................................................575Actions to take when you back up data.............................................................................................575Actions to avoid when you back up data........................................................................................... 576Preparation for recovery: a scenario................................................................................................. 577Events that occur during recovery..................................................................................................... 578

    Complete recovery cycles............................................................................................................ 579A recovery cycle example when using image copies...................................................................580How DFSMShsm affects your recovery environment.................................................................. 581

    Tips for maximizing data availability during backup and recovery...................................................581Where to find recovery information...................................................................................................585How to report recovery information.................................................................................................. 586Discarding SYSCOPY and SYSLGRNX records................................................................................... 586Preparations for disaster recovery.................................................................................................... 587

    System-wide points of consistency............................................................................................. 589Recommendations for more effective recovery from inconsistency................................................ 589

    Actions to take to aid in successful recovery of inconsistent data............................................. 589Actions to avoid in recovery of inconsistent data........................................................................ 591

    How to recover multiple objects in parallel.......................................................................................591Recovery of page sets and data sets................................................................................................. 592

    Recovery of the work file database.............................................................................................. 593Page set and data set copies........................................................................................................594System-level backups for object-level recoveries.......................................................................597

    Recovery of data to a prior point in time........................................................................................... 598Plans for point-in-time recovery.................................................................................................. 598Point-in-time recovery with system-level backups..................................................................... 599Point-in-time recovery using the RECOVER utility.......................................................................601Implications of moving data sets after a system-level backup...................................................610Recovery of table spaces..............................................................................................................611Recovery of indexes......................................................................................................................613Recovery of FlashCopy image copies...........................................................................................614Preparing to recover to a prior point of consistency....................................................................615

    Preparing to recover an entire Db2 subsystem to a prior point in time using image copies orobject-level backups.....................................................................................................................617

    Creating essential disaster recovery elements................................................................................. 617Resolving problems with a user-defined work file data set..............................................................619Resolving problems with Db2-managed work file data sets............................................................ 620Recovering error ranges for a work file table space..........................................................................620

    Recovery of error ranges for a work file table space................................................................... 620

    ix

  • Recovering after a conditional restart of Db2................................................................................... 621Recovery of the catalog and directory......................................................................................... 621

    Regenerating missing identity column values...................................................................................622Recovery of tables that contain identity columns....................................................................... 622

    Recovering a table space and all of its indexes.................................................................................623Recovery implications for objects that are not logged................................................................ 623

    Removing various pending states from LOB and XML table spaces.................................................627Restoring data by using DSN1COPY.................................................................................................. 627Backing up and restoring data with non-Db2 dump and restore......................................................627Recovering accidentally dropped objects......................................................................................... 628

    Recovering an accidentally dropped table...................................................................................628Recovering an accidentally dropped table space........................................................................ 630

    Recovering a Db2 system to a given point in time using the RESTORE SYSTEM utility................... 634Recovering by using Db2 restart recovery.........................................................................................636Recovering by using FlashCopy volume backups..............................................................................636Making catalog definitions consistent with your data after recovery to a prior point in time..........637

    Recovery of catalog and directory tables.....................................................................................639Performing remote site recovery from a disaster at a local site....................................................... 639

    Recovering with the BACKUP SYSTEM and RESTORE SYSTEM utilities......................................639Recovering without using the BACKUP SYSTEM utility............................................................... 640

    Backup and recovery involving clone tables..................................................................................... 640Recovery of temporal tables with system-period data versioning................................................... 641Data restore of an entire system........................................................................................................641Accessing historical data from moved tables by using image copies...............................................642

    Recovering from different Db2 for z/OS problems................................................................................. 243Recovering from IRLM failure............................................................................................................ 243Recovering from z/OS or power failure..............................................................................................244Recovering from disk failure.............................................................................................................. 244Recovering from application errors................................................................................................... 246

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

    Recovering from IMS-related failures .............................................................................................. 248Recovering from IMS control region failure ................................................................................ 248Recovering from IMS indoubt units of recovery.......................................................................... 249Recovering from IMS application failure......................................................................................251Recovering from a Db2 failure in an IMS environment................................................................251

    Recovering from CICS-related failure ...............................................................................................252Recovering from CICS application failures.................................................................................. 252Recovering Db2 when CICS is not operational ........................................................................... 253Recovering Db2 when the CICS attachment facility cannot connect to Db2 .............................254Recovering CICS indoubt units of recovery..................................................................................254Recovering from CICS attachment facility failure .......................................................................257

    Recovering from a QMF query failure................................................................................................ 257Recovering from subsystem termination ..........................................................................................258Recovering from temporary resource failure ....................................................................................259Recovering from active log failures ...................................................................................................259

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

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

    Recovering from BSDS failures.......................................................................................................... 266Recovering from an I/O error on the BSDS ................................................................................. 267Recovering from an error that occurs while opening the BSDS ................................................. 267

    x

  • Recovering from unequal timestamps on BSDSs ....................................................................... 268Recovering the BSDS from a backup copy................................................................................... 269

    Recovering from BSDS or log failures during restart.........................................................................271Recovering from failure during log initialization or current status rebuild................................. 273Recovering from a failure during forward log recovery............................................................... 284Recovering from a failure during backward log recovery............................................................ 289Recovering from a failure during a log RBA read request............................................................292Recovering from unresolvable BSDS or log data set problem during restart............................. 293Recovering from a failure resulting from total or excessive loss of log data.............................. 295Resolving inconsistencies resulting from a conditional restart...................................................299

    Recovering from Db2 database failure ............................................................................................. 304Recovering a Db2 subsystem to a prior point in time....................................................................... 305Recovering from a down-level page set problem .............................................................................306Recovering from a problem with invalid LOBs...................................................................................308Recovering from table space I/O errors ........................................................................................... 308Recovering from Db2 catalog or directory I/O errors .......................................................................309Recovering from integrated catalog facility failure .......................................................................... 310

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

    Recovering from referential constraint violation ..............................................................................316Recovering from distributed data facility failure .............................................................................. 316

    Recovering from conversation failure ......................................................................................... 317Recovering from communications database failure.................................................................... 317Recovering from database access thread failure ........................................................................318Recovering from VTAM failure ..................................................................................................... 319Recovering from VTAM ACB OPEN problems...............................................................................319Recovering from TCP/IP failure ................................................................................................... 320Recovering from remote logical unit failure ................................................................................321Recovering from an indefinite wait condition.............................................................................. 321Recovering database access threads after security failure ........................................................322

    Performing remote-site disaster recovery ........................................................................................322Recovering from a disaster by using system-level backups........................................................323Restoring data from image copies and archive logs.................................................................... 323Recovering from disasters by using a tracker site....................................................................... 337Using data mirroring for disaster recovery.................................................................................. 346

    Scenarios for resolving problems with indoubt threads................................................................... 352Scenario: Recovering from communication failure .....................................................................353Scenario: Making a heuristic decision about whether to commit or abort an indoubt thread... 355Scenario: Recovering from an IMS outage that results in an IMS cold start.............................. 356Scenario: Recovering from a Db2 outage at a requester that results in a Db2 cold start.......... 358Scenario: What happens when the wrong Db2 subsystem is cold started.................................361Scenario: Correcting damage from an incorrect heuristic decision about an indoubt thread....363

    Chapter 13. Reading log records.............................................................................................................645Contents of the log............................................................................................................................. 645

    Unit of recovery log records......................................................................................................... 646Checkpoint log records.................................................................................................................649Database page set control records.............................................................................................. 650Other exception information........................................................................................................ 650

    The physical structure of the log....................................................................................................... 651Physical and logical log records................................................................................................... 651The log record header...................................................................................................................652The log control interval definition (LCID)..................................................................................... 653Log record type codes.................................................................................................................. 657Log record subtype codes............................................................................................................ 658Interpreting data change log records.......................................................................................... 660

    Reading log records with IFI..............................................................................................................660Gathering active log records into a buffer....................................................................................661

    xi

  • Reading specific log records (IFCID 0129)..................................................................................661Reading complete log data (IFCID 0306).................................................................................... 662

    Reading complete log data for the GDPS Continuous Availability with zero data loss solution...... 666Modifying Db2 for the GDPS Continuous Availability with zero data loss solution.....................666Upgrading a Db2 11 GDPS Continuous Availability with zero data loss environment to a Db2

    12 environment....................................................................................................................... 669Modifying IFI READS calls for the GDPS Continuous Availability with zero data loss

    environment.............................................................................................................................670Recovering the compression dictionary data set without bringing down a Db2 data sharing

    group........................................................................................................................................671Reading log records with OPEN, GET, and CLOSE.............................................................................672

    JCL DD statements for Db2 stand-alone log services................................................................. 672Data sharing members that participate in a read........................................................................ 674Registers and return codes.......................................................................................................... 675Stand-alone log OPEN request.....................................................................................................675Stand-alone log GET request....................................................................................................... 677Stand-alone log CLOSE request................................................................................................... 679Sample application that uses stand-alone log services..............................................................679

    Reading log records with the log capture exit routine...................................................................... 680How RBA and LRSN values are displayed .........................................................................................681

    Appendix A. Exit routines...................................................................................683Edit procedures........................................................................................................................................683

    Specifying edit procedures................................................................................................................ 684When edit routines are taken.............................................................................................................684Parameter list for edit procedures.....................................................................................................684Incomplete rows and edit routines................................................................................................... 685Expected output for edit routines......................................................................................................686

    Validation routines...................................................................................................................................687Specifying validation routines............................................................................................................687When validation routines are taken................................................................................................... 688Parameter list for validation routines................................................................................................ 688Incomplete rows and validation routines..........................................................................................689Expected output for validation routines............................................................................................ 689

    Date and time routines............................................................................................................................ 690Specifying date and time routines..................................................................................................... 690When date and time routines are taken............................................................................................ 691Parameter list for date and time routines......................................................................................... 691Expected output for date and time routines..................................................................................... 692

    Conversion procedures............................................................................................................................693Specifying conversion procedures.....................................................................................................693When conversion procedures are taken............................................................................................ 694Parameter list for conversion procedures......................................................................................... 694Expected output for conversion procedures..................................................................................... 695

    Field procedures......................................................................................................................................696Field-definition for field procedures..................................................................................................697Specifying field procedures............................................................................................................... 697When field procedures are taken.......................................................................................................698Control blocks for execution of field procedures.............................................................................. 699Field-definition (function code 8)...................................................................................................... 702Field-encoding (function code 0).......................................................................................................705Field-decoding (function code 4)...................................................................................................... 706

    Log capture routines................................................................................................................................708Specifying log capture routines......................................................................................................... 708When log capture routines are invoked.............................................................................................708Parameter list for log capture routines..............................................................................................709

    Routines for dynamic plan selection in CICS..........................................................................................710

    xii

  • General guidelines for writing exit routines............................................................................................711Coding rules for exit routines.............................................................................................................711Modifying exit routines.......................................................................................................................712Execution environment for exit routines........................................................................................... 712Registers at invocation for exit routines............................................................................................ 712Parameter list for exit routines.......................................................................................................... 712

    Row formats for edit and validation routines..........................................................................................714Column boundaries for edit and validation procedures....................................................................714Null values for edit procedures, field procedures, and validation routines......................................714Fixed-length rows for edit and validation routines........................................................................... 714Varying-length rows for edit and validation routines........................................................................ 715Varying-length rows with nulls for edit and validation routines....................................................... 715EDITPROCs and VALIDPROCs for handling basic and reordered row formats................................ 716Converting basic row format table spaces with edit and validation routines to reordered row

    format............................................................................................................................................716Dates, times, and timestamps for edit and validation routines........................................................718Parameter list for row format descriptions....................................................................................... 718Db2 decoding for numeric data in edit and validation routines........................................................720

    Appendix B. Stored procedures for administration..............................................723Common SQL API stored procedures..................................................................................................... 723

    Versioning of XML documents........................................................................................................... 724XML input documents........................................................................................................................ 724XML output documents......................................................................................................................726XML message documents.................................................................................................................. 727

    Troubleshooting Db2 stored procedure problems................................................................................. 728

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

    Notices..............................................................................................................731Programming interface information........................................................................................................732Trademarks.............................................................................................................................................. 733Terms and conditions for product documentation................................................................................. 733Privacy policy considerations.................................................................................................................. 733

    Glossary............................................................................................................ 735

    Index................................................................................................................ 737

    xiii

  • xiv

  • About this information

    This information provides guidance information that you can use to perform a variety of administrativetasks with Db2 for z/OS (Db2).

    Throughout this information, "Db2" means "Db2 12 for z/OS". References to other Db2 products usecomplete names or specific abbreviations.

    Important: To find the most up to date content for Db2 12 for z/OS, always use IBM® Documentation ordownload the latest PDF file from PDF format manuals for Db2 12 for z/OS (Db2 for z/OS in IBMDocumentation).

    Most documentation topics for Db2 12 for z/OS assume that the highest available function level isactivated and that your applications are running with the highest available application compatibility level,except for the following section that describe the migration process and how to activate new function:

    • Migrating to Db2 12 (Db2 Installation and Migration)• What's new in Db2 12 (Db2 for z/OS What's New?)• Adopting new capabilities in Db2 12 continuous delivery (Db2 for z/OS What's New?)

    The availability of new function depends on the type of enhancement, the activated function level, and theapplication compatibility levels of applications. In the initial Db2 12 release, most new capabilities areenabled 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 introducesthem or higher. Activation of function level 100 introduces all virtual storage enhancements in theinitial Db2 12 release. That is, activation of function level 500 introduces no virtual storageenhancements.

    Subsystem parametersNew subsystem parameter settings are in effect only when the function level that introduced them ora higher function level is activated. Many subsystem parameter changes in the initial Db2 12 releasetake effect in function level 500. For more information about subsystem parameter changes in Db212, see Subsystem parameter changes in Db2 12 (Db2 for z/OS What's New?).

    Optimization enhancementsOptimization enhancements become available after the activation of the function level that introducesthem or higher, and full prepare of the SQL statements. When a full prepare occurs depends on thestatement type:

    • For static SQL statements, after bind or rebind of the package• For non-stabilized dynamic SQL statements, immediately, unless the statement is in the dynamic

    statement cache• 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 12release. That is, function level 500 introduces no optimization enhancements.

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

    © Copyright IBM Corp. 1982, 2021 xv

    https://www.ibm.com/support/knowledgecenter/en/SSEPEK_12.0.0/home/src/tpc/db2z_12_prodhome.htmlhttps://www.ibm.com/docs/en/SSEPEK_12.0.0/home/src/tpc/db2z_pdfmanuals.htmlhttps://www.ibm.com/docs/en/SSEPEK_12.0.0/home/src/tpc/db2z_pdfmanuals.htmlhttps://www.ibm.com/docs/en/SSEPEK_12.0.0/inst/src/tpc/db2z_migrdb2.htmlhttps://www.ibm.com/docs/en/SSEPEK_12.0.0/wnew/src/tpc/db2z_12_wnew.htmlhttps://www.ibm.com/docs/en/SSEPEK_12.0.0/wnew/src/tpc/db2z_managenewcapability.htmlhttps://www.ibm.com/docs/en/SSEPEK_12.0.0/wnew/src/tpc/db2z_12_subsysparmchanges.htmlhttps://www.ibm.com/docs/en/SSEPEK_12.0.0/apsg/src/tpc/db2z_applicationcompatibility.html

  • Who should read this informationThis information is primarily intended for system and database administrators. It assumes that the user isfamiliar with:

    • The basic concepts and facilities of Db2• Time Sharing Option (TSO) and Interactive System Productivity Facility (ISPF)• The basic concepts of Structured Query Language (SQL)• The basic concepts of Customer Information Control System (CICS®)• The basic concepts of Information Management System (IMS)• 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/InternetProtocol (TCP/IP) or Virtual Telecommunications Access Method (VTAM®) to set up communicationbetween Db2 subsystems, or knowledge of the IBM System Modification Program (SMP/E) to install IBMlicensed programs.

    Db2 Utilities Suite for z/OSImportant: In this Db2 12, Db2 Utilities Suite for z/OS is available as an optional product. You mustseparately order and purchase a license to such utilities, and discussion of those utility functions in thispublication 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 DFSORTon your system. For more information, see the following informational APARs:

    • II14047• II14213• II13495

    Db2 utilities can use IBM Db2 Sort for z/OS (5655-W42) as an alternative to DFSORT for utility SORT andMERGE functions. Use of Db2 Sort for z/OS requires the purchase of a Db2 Sort for z/OS license. For moreinformation about Db2 Sort for z/OS, see Db2 Sort for z/OS.

    Related conceptsDb2 utilities packaging (Db2 Utilities)

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

    The following terms are used as indicated:

    Db2Represents either the Db2 licensed program or a particular Db2 subsystem.

    IBM re-branded DB2 to Db2, and Db2 for z/OS is the new name of the offering previously know as"DB2 for z/OS". For more information, see Revised naming for IBM Db2 family products on IBM z/OSplatform. As a result, you might sometimes still see references to the original names, such as "DB2 forz/OS" and "DB2", in different IBM web pages and documents. If the PID, Entitlement Entity, version,modification, and release information match, assume that they refer to the same product.

    Tivoli® OMEGAMON® XE for Db2 Performance Expert on z/OSRefers to any of the following products:

    • IBM Tivoli OMEGAMON XE for Db2 Performance Expert on z/OS• IBM Db2 Performance Monitor on z/OS• IBM Db2 Performance Expert for Multiplatforms and Workgroups

    xvi About this information

    http://www.ibm.com/software/data/db2imstools/db2tools/db2-sort/https://www.ibm.com/docs/en/SSEPEK_12.0.0/ugref/src/tpc/db2z_utlpackaging.htmlhttps://www-01.ibm.com/common/ssi/ShowDoc.wss?docURL=/common/ssi/rep_ca/7/899/ENUSLP18-0047/index.htmlhttps://www-01.ibm.com/common/ssi/ShowDoc.wss?docURL=/common/ssi/rep_ca/7/899/ENUSLP18-0047/index.html

  • • IBM Db2 Buffer Pool Analyzer for z/OS

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

    CICSRepresents CICS Transaction Server for z/OS.

    IMSRepresents 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 ControlProgram (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/OSAccessibility features help a user who has a physical disability, such as restricted mobility or limitedvision, to use information technology products successfully.

    Accessibility featuresThe following list includes the major accessibility features in z/OS products, including Db2 12 for z/OS.These features support:

    • Keyboard-only operation.• Interfaces that are commonly used by screen readers and screen magnifiers.• Customization of display attributes such as color, contrast, and font size

    Tip: IBM Documentation (which includes information for Db2 for z/OS) and its related publications areaccessibility-enabled for the IBM Home Page Reader. You can operate all features using the keyboardinstead of the mouse.

    Keyboard navigationFor information about navigating the Db2 for z/OS ISPF panels using TSO/E or ISPF, refer to the z/OSTSO/E Primer, the z/OS TSO/E User's Guide, and the z/OS ISPF User's Guide. These guides describe how tonavigate each interface, including the use of keyboard shortcuts or function keys (PF keys). Each guideincludes the default settings for the PF keys and explains how to modify their functions.

    Related accessibility information

    IBM and accessibilitySee the IBM Accessibility Center at http://www.ibm.com/able for more information about the commitmentthat IBM has to accessibility.

    How to send your comments about Db2 for z/OS documentationYour feedback helps IBM to provide quality documentation.

    Send any comments about Db2 for z/OS and related product documentation by email [email protected].

    To help us respond to your comment, include the following information in your email:

    • The product name and version• The address (URL) of the page, for comments about online documentation

    About this information xvii

    https://www.ibm.com/support/knowledgecenter/en/SSEPEK_12.0.0/home/src/tpc/db2z_12_prodhome.htmlhttp://www.ibm.com/ablemailto:[email protected]

  • • The book name and publication date, for comments about PDF manuals• The topic or section title• The specific text that you are commenting about and your comment

    Related conceptsAbout this information (Db2 for z/OS in IBM Documentation)Related referencePDF format manuals for Db2 12 for z/OS (Db2 for z/OS in IBM Documentation)

    How to read syntax diagramsCertain 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:

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

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

    • 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 thestatement and is used only for readability.

    required_item

    optional_item

    • 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 shownbelow.

    xviii About this information