Db2 for z/OS & Db2ZAI

IBM Db2 for z/OS and its ecosystem

Connect with Db2, Informix, Netezza, open source, and other data experts to gain value from your data, share insights, and solve problems.

 View Only
Expand all | Collapse all

Deletes on the SYSIBM.SYSOBJEVENTS, when? Why?

  • 1.  Deletes on the SYSIBM.SYSOBJEVENTS, when? Why?

    Posted 08/23/26 11:40 AM

    Hello colleagues, 

    I am checking the Utility History Tables and found that the SYSOBJEVENTS has DELETEs. For example REORGDELETES=6 at the SYSIBM.SYSTABLESPACESTATS table.

    Seems that there's none for the SYSUTILITIES, at least not the systems that I checked.

    I am wondering when or why some row can be deleted. I know that rows in this table can be updated, inserted, and deleted by authorized users, but I don't think that be the case, I think it was the utility flow somehow.

    Thanks!



    ------------------------------
    Soledad Martinez
    Db2 z/OS System Programmer
    Volkswagen Group Services
    Salinas - Asturias
    ------------------------------


  • 2.  RE: Deletes on the SYSIBM.SYSOBJEVENTS, when? Why?

    Posted 08/24/26 05:42 AM

    Hi Sole, I hope you're doing well. That's a very interesting point. I've also noticed that there are deleted rows in SYSTABLESPACESTATS from SYSOBJEVENTS. I'm pretty sure I haven't manually deleted any files.

    As my sandbox is at FL508, I've taken advantage of the new Admin Tool functionality (Apar PH57761) to check that AdminTool simulates a "cascade deleting" rows from SYSOBJEVENTS  when deleting rows from SYSUTILITIES (there is no defined referential integrity between the two tables).

    Also checked several ways to increase REORGDELETES counter on SYSOBJEVENTS (e.g.dropping the tablespace) but I didn't succeed.

    To try to figure out what's happening here maybe you have a tool to easily extract from Db2 log which process deleted the rows.

     

    Best regards,

    Ramon Palmé

    DB2 system administration and Database support

    T-Systems Iberia

    Barcelona



    ------------------------------
    Ramon Palmé
    Db2 for z/OS IT Specialist
    T-Systems
    Barcelona - Catalonia
    ------------------------------



  • 3.  RE: Deletes on the SYSIBM.SYSOBJEVENTS, when? Why?

    Posted 08/24/26 12:00 PM

    Hello Ramón,

    Yes I have the tool for reading the log, but I should execute it for such a long period that I cannot do that. Anyway, I will keep and eye on the REORGDELETE to see if it increases and I can narrow the log to be searched.

    Good point trying to generate a delete dropping tablespaces or other objects, I hadn't tested that! 

    Thanks!

    P.D. Sí, muy bien gracias, todo bien. Espero que tú también, y a ver si nos vemos algún día :-)

    Gracias!



    ------------------------------
    Soledad Martinez
    Db2 z/OS System Programmer
    Volkswagen Group Services
    Salinas - Asturias
    ------------------------------



  • 4.  RE: Deletes on the SYSIBM.SYSOBJEVENTS, when? Why?

    Posted 08/24/26 02:08 PM

    Hello Ramón, 

    I found it! This is taken from a presentation by Patric Becker (Rocket Sotfware)

    Online REORG table space type conversion
    ❑ Initialization (UTILINIT phase)
    ❑ SYSOBJEVENTS rows inserted for original table space type
    ❑ Termination (UTILTERM phase)
    ❑ SYSOBJEVENTS rows for original table space type are deleted
    ❑ New rows inserted for new table space type

    Now our deletes make sense, right?

    Thanks!



    ------------------------------
    Soledad Martinez
    Db2 z/OS System Programmer
    Volkswagen Group Services
    Salinas - Asturias
    ------------------------------



  • 5.  RE: Deletes on the SYSIBM.SYSOBJEVENTS, when? Why?

    Posted 08/24/26 04:39 PM

    Hello Soledad and Ramón,

    This is an accurate explanation of the process when REORG is converting to UTS and explains the REORGDELETES value.

    Thank you.

    -------------------------
    Patrick Malone
    Db2 for z/OS Utility Development
    Rocket Software
    -------------------------



    ------------------------------
    Patrick Malone
    ------------------------------



  • 6.  RE: Deletes on the SYSIBM.SYSOBJEVENTS, when? Why?

    Posted 08/25/26 08:39 AM

    Hi Sole,

    That's cool. I tested it and perfectly matches. I converted a tablespace to UTS and after executing the materializating REORG, 3 records where added to SYSOBJEVENTS and also REORGDELETES counter on SYSTABLESPACESTATS increased in 3. 

    A curiosity that surprised me, the creation of temporal mapping table is also recorded in SYSOBJEVENTS (1 for TS, 1 for IX and 1 for mapping T in my case).

    Thanks to you and all other contributors here.

    Saludos!



    ------------------------------
    Ramon Palmé
    Db2 for z/OS IT Specialist
    T-Systems
    Barcelona - Catalonia
    ------------------------------



  • 7.  RE: Deletes on the SYSIBM.SYSOBJEVENTS, when? Why?

    Posted 08/25/26 02:05 AM

    Hi,

    A small comment on Ramon's post. As far as I know from being Sponsor User for utilities history a drop of a tablespace will not remove any rows from SYSOBJEVENTS.

    Regards Martin



    ------------------------------
    Martin Ålund
    ------------------------------



  • 8.  RE: Deletes on the SYSIBM.SYSOBJEVENTS, when? Why?

    Posted 08/25/26 09:37 AM

    Hi Soledad

    Have you converted in this system already Catalog/Directory Tablespaces to UTS? It seems that this process uses SYSIBM.SYSOBJEVENTS as a temporary storage, what is ok. What astonishes you and me is that this information is later deleted.

    Peter



    ------------------------------
    Peter Hartmann
    ------------------------------



  • 9.  RE: Deletes on the SYSIBM.SYSOBJEVENTS, when? Why?

    Posted 08/25/26 10:02 AM

    Hello Peter,

    no I haven't yet started with the conversion of the catalog and directory. But we had done it for some business tables, and that also explains to me why I had no deletes at my sandbox, because there's years since last time I needed to convert any. 

    Yes, it was really shocking. I was not able to find any explanation to it by myself :-)

    Thanks!



    ------------------------------
    Soledad Martinez
    Db2 z/OS System Programmer
    Volkswagen Group Services
    Salinas - Asturias
    ------------------------------



  • 10.  RE: Deletes on the SYSIBM.SYSOBJEVENTS, when? Why?

    Posted 08/25/26 09:37 AM

    Hi Soledad

    Have you converted in this systems Catalog/Directory Tablespaces to UTS? It seems that this process uses SYSIBM.SYSOBJEVENTS as a temporary store, what is ok. What astonishes you and me  is the fat, that this information is later deleted.

    Peter



    ------------------------------
    Peter Hartmann
    ------------------------------



  • 11.  RE: Deletes on the SYSIBM.SYSOBJEVENTS, when? Why?

    Posted 08/25/26 09:37 AM

    Hi Soledad

    Does the REORG statement contain a DISCARD keyword?

    Regards

    Michael Lowe

    Db2 z/OS Instructor, Manchester UK 



    ------------------------------
    Michael Lowe
    ------------------------------



  • 12.  RE: Deletes on the SYSIBM.SYSOBJEVENTS, when? Why?

    Posted 08/25/26 10:20 AM

    Hello Michael, 

    I did several testing with reorg discard, because I am tring to identify them from the SYSOBJEVENTS, but there are too many casuistics thatn I started to think that is not possible. I am preparing a session for IDUG and I thought this could be cool.

    For example, this below are the counters from a REORG DISCARD. It's easy to identify that one row was discarded because the count for IM5D33FD (mapping-index) is bigger than the counter of the indexes and also bigger than the sum of the count rows of the 5 partitions:

    But this doesn't work when the REORG DISCARD was done at Partition Level, because in that case the mapping table and the NPSI counter is always bigger that the sum of the count of the partition being reorged.

    Anyway, as REORG DISCARD is updating the REORG* counters at the RTS table, I assume that it will always be reset to 0 just after the REORG DISCARD be done. Don't you think so?

    Thanks!



    ------------------------------
    Soledad Martinez
    Db2 z/OS System Programmer
    Volkswagen Group Services
    Salinas - Asturias
    ------------------------------



  • 13.  RE: Deletes on the SYSIBM.SYSOBJEVENTS, when? Why?

    Posted 08/25/26 10:48 AM
    Hi Soledad

    Thank you for this. The use of DISCARD was just a guess but you have proved it was wrong!
    All the bes
    Regards
    Michael







  • 14.  RE: Deletes on the SYSIBM.SYSOBJEVENTS, when? Why?

    Posted 08/26/26 08:08 AM

    Hi Soledad. Just an update to capturing discard from objevents. I have written SQL that will capture the discarded row counts and insert into a table containing the counts, table name and job name for each reorg. It seems to work well on all reorg levels. Happy to share it. From this though I have raised an AHA to have the discarded row count added to the objevents table. This can be done from the message in the reorg job. This aha does have some interest from the labs.



    ------------------------------
    CRAIG MCKELLAR
    ------------------------------



  • 15.  RE: Deletes on the SYSIBM.SYSOBJEVENTS, when? Why?

    Posted 08/26/26 08:42 AM

    Hello Craig, 

    oh, yes please, it would be great if you could share the way you have to identify them. I agree with you that it will be very helpful for audit trail. 

    I tried to catch the REORG DISCARDS just with a query, started with the DSN8D13* tables, then move to bigger tables and also worked as expected. But ... when I tested it in a real environment with REORGS by PARTITION ... all gone down the drain :-)

    I had seen your idea at the AHA before and thought it was a must. You already had my vote days ago!!! 

    I opened one for the DSNUTIL unloads, I think it should be great to have them also at these tables.

    Thank you very much!!



    ------------------------------
    Soledad Martinez
    Db2 z/OS System Programmer
    Volkswagen Group Services
    Salinas - Asturias
    ------------------------------



  • 16.  RE: Deletes on the SYSIBM.SYSOBJEVENTS, when? Why?

    Posted 08/27/26 07:05 AM

    Hi Soledad

    While I won't be able to attend IDUG, I would be interested in what you present on this topic.

    This is my SQL that I use to extract the discarded rows and then insert the results into a table holding the table name, job name, time and discarded rows. With regards to partition discards it still appears to work, I sum the Type=T (tablespaces) counts and subtract that from the mapping table (type=I) rows unloaded. There are some events where there small number discrepancies and  do not have a DISCARD in the reorg which I can't explain but choose to ignore.

    This SQL is also built so it can be rerun and pick up from where the last run finished hence setting the global variable at the beginning.  See what you think. 

    Ultimately I would like the AHA to be accepted and have DISCARD count included but this will work for now.  

    I would also put a plug here for another AHA I have just raised but relevant to this thread.  

    https://ibm-data-and-ai.ideas.ibm.com/ideas/DB24ZOS-I-1926 Enable Compression for Selected DSNDB06 Tables  This one is to be able to use compression on the utility and RTS history tables.

    and the DISCARD 

    https://ibm-data-and-ai.ideas.ibm.com/ideas/DB2UTILSTZ-I-106 Add DISCARD row count from Reorg to Utility history SYSOBJEVENTS table

    The SQL:

     -- ============================================================          
     -- REORG DISCARD COUNT: TYPE='I' (DBARMAP%) MINUS TYPE='T'              
     -- USES: SYSIBM.SYSOBJEVENTS                                            
     --       SYSIBM.SYSUTILITIES  (JOINED ON EVENTID FOR JOBNAME, UTILID)    
     --                                                                      
     -- FOR EACH EVENTID THAT HAS A TYPE='I' ROW WITH DBNAME LIKE 'DBARMAP%'  
     -- WITHIN THE LAST 7 DAYS, JOINS TO THE CORRESPONDING TYPE='T' ROW AND  
     -- TO SYSUTILITIES TO ENRICH THE RESULT WITH JOBNAME AND UTILID.        
     --                                                                      
     --   DISCARD = COUNT(OBJTYPE='I', DBARMAP%) â?? COUNT(OBJTYPE='T')      
     --                                                                      
     -- A POSITIVE DISCARD VALUE REPRESENTS ROWS COUNTED IN THE INDEX PHASE  
     -- THAT WERE NOT PRESENT AT TERMINATION (I.E. DISCARDED BY THE REORG).  
     --                                                                      
     -- REFERENCE: HTTPS://WWW.IBM.COM/DOCS/EN/DB2-FOR-ZOS/13                
     --            ?TOPIC=TABLES-SYSOBJEVENTS                                
     ---            ?TOPIC=TABLES-SYSUTILITIES                                
     -- ============================================================          
     --  SET GV TO LAST INSERTED ROW FOR DISCARDRG                            
     --  THIS ALLOWS CONTINUOUS RUNNING OF THIS QUERY                        
     SET                                                                      
      DBA.LASTEVENT_TS =                                                      
        COALESCE((SELECT DISTINCT(MAX(EVENT_TS ))                            
       FROM DBA.DISCARDRG), CURRENT TIMESTAMP - 7 DAYS);                      
                                                                             
      SELECT DBA.LASTEVENT_TS FROM SYSIBM.SYSDUMMY1;                          
     --                                                                      
       INSERT INTO "DBA"."DISCARDRG"                                          
       (EVENTID,TBNAME,DBNAME_T,OBJNAME_T,                                    
       EVENT_TS,JOBNAME,                                                      
       UTILID,ROWS_UNLOADED,ROW_RELOADED,                                    
       DISCARD)                                                              
     WITH                                                                    
                                                                             
     -- OBJTYPE='I' ROWS ANCHORED TO THE DBARMAP% DATABASE PATTERN            
     -- WITHIN THE LAST 7 DAYS.                                              
     EVT_I AS (                                                              
     SELECT                                                                  
     EVENTID,                                                                
     DBNAME AS DBNAME_I,                                                      
     SPACENAME,                                                              
     COUNT AS COUNT_I,                                                        
     EVENTTS AS EVENT_TS                                                      
     FROM                                                                    
     SYSIBM.SYSOBJEVENTS                                                      
     WHERE                                                                    
     OBJTYPE = 'I'                                                            
     AND DBNAME LIKE 'DBARMAP%'                                              
     AND EVENTID IN (                                                        
     SELECT EVENTID FROM                                                      
     SYSIBM.SYSUTILITIES                                                      
     WHERE                                                                    
     NAME='REORG'                                                            
     AND EVENTID NOT IN                                                      
    ( SELECT EVENTID FROM                                                
      DBA.DISCARDRG )                                                    
    AND ENDTS > DBA.LASTEVENT_TS)                                        
    ),                                                                    
    -- OBJTYPE='T' (TERMINATION) ROWS FOR EVERY EVENTID FOUND ABOVE.      
    -- NO DBNAME FILTER THE TERMINATION ROW MAY CARRY A DIFFERENT DBNAME.
    EVT_T AS (                                                            
    SELECT                                                                
    -- NAME,                                                              
    EVENTID,                                                              
    DBNAME AS DBNAME_T,                                                  
    SPACENAME AS OBJNAME_T,                                              
    SUM(COUNT) AS COUNT_T,                                                
    EVENTTS AS TS_T                                                      
    FROM                                                                  
    SYSIBM.SYSOBJEVENTS                                                  
    WHERE                                                                
    OBJTYPE = 'T'                                                        
    AND EVENTID IN (                                                      
    SELECT EVENTID FROM                                                  
    SYSIBM.SYSUTILITIES                                                  
    WHERE                                                                
    NAME='REORG'                                                          
    AND EVENTID NOT IN                                                    
    ( SELECT EVENTID FROM                                                
      DBA.DISCARDRG )                                                    
    AND ENDTS > DBA.LASTEVENT_TS)                                        
    GROUP BY EVENTID,DBNAME,SPACENAME,EVENTTS                            
    ),                                                                    
    -- SYSUTILITIES: ONE CONTROL ROW PER UTILITY INSTANCE (1=1).          
    -- PROVIDES JOBNAME AND UTILID KEYED ON EVENTID.                      
    UTILS AS (                                                            
    SELECT                                                                
    EVENTID,                                                              
    UTILID,                                                              
    JOBNAME                                                              
    FROM                                                                  
    SYSIBM.SYSUTILITIES                                                  
    WHERE                                                                
    1 = 1 -- TOP-LEVEL CONTROL ROW ONLY                                  
    ),                                                                    
    -- SYSTABLES: LOOK UP TABLE NAME BY DATABASE + TABLESPACE NAME.      
    TBLS AS (                                                            
    SELECT                                                                
    DBNAME,                                                              
    TSNAME,                                                              
    NAME AS TBNAME                                                        
    FROM                                                                  
    SYSIBM.SYSTABLES                                                      
     WHERE TYPE='T'                                                      
    )                                                                    
    SELECT                                                                
    I.EVENTID,                                                            
    TB.TBNAME,                                                            
    T.DBNAME_T,                                                          
    T.OBJNAME_T,                                                          
    I.EVENT_TS,                              
    U.JOBNAME,                              
    U.UTILID,                                
    I.COUNT_I AS ROWS_UNLOADED,              
    T.COUNT_T AS ROWS_RELOADED,              
    I.COUNT_I - T.COUNT_T AS DISCARD        
    FROM                                    
    EVT_I I                                  
    INNER JOIN                              
    EVT_T T                                  
    ON T.EVENTID = I.EVENTID                
    INNER JOIN                              
    UTILS U                                  
    ON U.EVENTID = I.EVENTID                
    LEFT JOIN                                
    TBLS TB                                  
    ON TB.DBNAME = T.DBNAME_T                
    AND TB.TSNAME = T.OBJNAME_T              
    WHERE                                    
    I.COUNT_I - T.COUNT_T > 0                
    ORDER BY                                
    I.EVENT_TS,                              
    U.JOBNAME,                              
    I.EVENTID,                              
    T.OBJNAME_T;                             



    ------------------------------
    CRAIG MCKELLAR
    ------------------------------



  • 17.  RE: Deletes on the SYSIBM.SYSOBJEVENTS, when? Why?

    Posted 08/27/26 03:09 PM

    Hello Craig

    thank you very much for sharing!! I was following a similar approach based of the COUNT of the mapping table, but I had an error on my solution, and thanks to you I was able to fix it! 

    It is not as powerful as yours, as I am not storing the data, just wanted to identify the REORG DISCARD. I am pasting it below.

    Now for identifying the mapping index I assume that it will never be in the same database that the tablespace to be reorged as not always there is a dedicated database for it for the whole system.

    It's a pity we cannot meet at IDUG, but we can keep in touch, I can share with you what I have in mind. My idea is to present something practical or useful, that's why I was playing on how to identify this or other things via the history tables. 

    Thank you very much you really made my day! :-)



    ------------------------------
    Soledad Martinez
    Db2 z/OS System Programmer
    Volkswagen Group Services
    Salinas - Asturias
    ------------------------------



  • 18.  RE: Deletes on the SYSIBM.SYSOBJEVENTS, when? Why?

    Posted 08/27/26 03:14 PM
      |   view attached

    Sorry, but I had to upload it here as a file, I don't know if it's due to the length but I am not able to paste it, if I do it I receive an error.



    ------------------------------
    Soledad Martinez
    Db2 z/OS System Programmer
    Volkswagen Group Services
    Salinas - Asturias
    ------------------------------

    Attachment(s)

    txt
    Reorg_discards_script.txt   3 KB 1 version


  • 19.  RE: Deletes on the SYSIBM.SYSOBJEVENTS, when? Why?

    Posted 09/03/26 02:15 AM

    I am glad it was useful.  We have found that we need to be accountable for where data is discarded and not logged hence storing it separately. If the AHA is accepted then this requirement would be mostly met. The AHA for compression of these tables will help us to keep the data for longer too.

    With the mapping table we define the Default database in the zparm so that is consistent for us and only used for this purpose.

    I would love to hear what you have in mind with the presentation and happy to share some of the stuff we are trying.  Feel free to use my email craigmc@au1.ibm.com

     



    ------------------------------
    CRAIG MCKELLAR
    ------------------------------



  • 20.  RE: Deletes on the SYSIBM.SYSOBJEVENTS, when? Why?

    Posted 09/06/26 12:01 PM

    Hi Craig,

    How much data do you need to store?

    DSSIZE for util history is 256GB which should be 300M+ util executions.

    The issue for RTS is the temporal history written every 30mins. I have a prototype temporal history cleanup/compression program - ping me on IBM slack if you're interested :)

    Finally, the utilities history should not be used for "auditing" use cases a the utilities prioritize the utility over writing the history. 



    ------------------------------
    Jørn Thyssen
    Principal Solutions Advisor
    Rocket Software
    Randers SV
    ------------------------------