Db2

 View Only
  • 1.  snapshot timestamp

    Posted Tue May 14, 2024 09:56 AM

    in db2 you can use the get snapshot command/view

    is there a field that indicates since when these values are active

    I presume since last activate timestamp

    and is there a possibility to reset these counters without deactivate/db2stop ?

    eg I want to know how many deadlocks we had ? but since when ?    Deadlocks detected                         = xxx



    ------------------------------
    Thanks for all answers
    Best Regards,
    Guy Przytula
    ------------------------------


  • 2.  RE: snapshot timestamp

    Posted Tue May 14, 2024 10:40 AM

    Would be interesting to learn the answer to the main query for me as well.
    Is there a way to reset all counters.

    But I can answer the subquery related to deadlocks.
    Lock event monitor is now more powerful than ever before(Perhaps watched too many Apple advertisements :D)

    LOCK_EVENT table will give detailed info about how many deadlocks occurred and when (EVENT_TYPE='DEADLOCK').



    ------------------------------
    Bujji Phanikiran V
    ------------------------------



  • 3.  RE: snapshot timestamp
    Best Answer

    IBM Champion
    Posted Tue May 14, 2024 05:35 PM

    MON_GET_xxx are recommended functions instead of snapshots.

    Please check and try DB2 RESET MONITOR DATA ALL.

    FYI:
    https://www.ibm.com/docs/en/db2/11.5?topic=commands-reset-monitor



    ------------------------------
    Jan Nelken
    ------------------------------



  • 4.  RE: snapshot timestamp

    Posted Wed May 15, 2024 02:41 AM

    Hi,
    in database snapshot check:
    "First database connect timestamp" and "Last reset timestamp" , the higher value is starting timestamp.

    Example:
    First database connect timestamp           = 05/14/2024 23:27:27.592933
    Last reset timestamp                       =
    After calling "db2 reset monitor all", now it is "Last reset timestamp":
    First database connect timestamp           = 05/14/2024 23:27:27.592933
    Last reset timestamp                       = 05/14/2024 23:28:26.521517
    This statement retrieves the duration in minutes considering LAST_RESET and DB_CONN_TIME:
    SELECT timestampdiff(4, TIMESTAMP_FORMAT(a.SNAPSHOT_TIMESTAMP,'YYYY-MM-DD-HH24-MI.SS.NNNNNN') -
        CASE WHEN a.LAST_RESET > a.DB_CONN_TIME THEN  TIMESTAMP_FORMAT(a.LAST_RESET,'YYYY-MM-DD-HH24-MI.SS.NNNNNN') ELSE  TIMESTAMP_FORMAT(a.DB_CONN_TIME,'YYYY-MM-DD-HH24-MI.SS.NNNNNN') end  )
        FROM TABLE(SNAP_GET_DB('', -2)) AS a;



    ------------------------------
    Peter Schurr
    ------------------------------