db2db2-zos

View Record Lock Details in DB2 for z/OS


An overnight job encountered a locking error on updating a record in DB2 10 for z/OS. I've been asked to inspect the DB2 logs to hopefully find more information on what was locking the table. Since I have the timestamp of the failure, how can I look at the DB2 log for a specific time-period?

Thanks for your help!

Dave


Solution

  • If you look in SDSF DA, there should be an entry for *MSTR (e.g., if your DB2 subsystem name is DB2P for your production DB2, then you'd look at DB2PMSTR). If you look at the JESMSGLG of that task, the DB2 logs you are interested will be in there. There should be a DSNT375I (deadlock) or DSNT376I (timeout) entry that will look something like the below (the format is slightly different between the two).

    The two error messages will also have a DSNT501I error associated with it that will tell you what the "fight" was over.

    12.48.05 STC30099  DSNT376I  -DB2P PLAN=DISTSERV WITH  798                      
       798                     CORRELATION-ID=program.exe                              
       798                     CONNECTION-ID=SERVER                                 
       798                     LUW-ID=GA5D2A01.CE00.200429174636=79816              
       798                                                                          
       798             THREAD-INFO=logon_username:server_name:logon_username:program.exe:DYNAMIC:7522055:*:<10
       798             .93.42.1.52736.200429174636>                                 
       798                     IS TIMED OUT. ONE HOLDER OF THE RESOURCE IS PLAN=plan WITH
       798                     CORRELATION-ID=ENTRabcdefgh                          
       798                     CONNECTION-ID=CICSzyxw                               
       798                     LUW-ID=USDTCN00.ALDB2P00.D7D81AEAB200=43579          
       798                     THREAD-INFO=CICSzyxw:*:*:ENTRabcd:STATIC:9507687:*:* 
       798                     ON MEMBER DB2P                                       
    12.48.05 STC30099  DSNT501I  -DB2P DSNILMCL RESOURCE UNAVAILABLE  799           
       799                        CORRELATION-ID=program.exe                           
       799                        CONNECTION-ID=SERVER                              
       799                        LUW-ID=GA5D2A01.CE00.200429174636=79816           
       799                        REASON 00C9008E                                   
       799                        TYPE 00000304                                     
       799                        NAME DBNAME .TBSPACE  .X'abcdefg12'.X'11'          
    

    In my example, program.exe (logged on as user logon_username from client server_name) was trying to access a page (Identified by X'abcdefg12'.X'11') in database DBNAME, tablespace TBSPACE (the format is determined by the resource type listed in the 501 error code). The page was being held by a CICS task, identified by ENTRabcdefgh in region CICSzyxw.

    Hopefully that gets you the information you're looking for.