Link to home
Start Free TrialLog in
Avatar of harsha_james
harsha_james

asked on

db2 snapshot timestamp explanation

Hi All,

If i scheduled snapshot through crontab at every 15 minutes as ,
db2 get snapshot for all on  <dbname> |
gzip -9 > $DIR/snapshot_all_<dbname>_$(date +%Y_%m_%d_%H_%M).out.gz

then as output i got following files,
snapshot_PRDDB_2010_08_16_14_15.out
snapshot_PRDDB_2010_08_16_14_30.out
snapshot_PRDDB_2010_08_16_14_45.out

If I open 2nd file i.e. snapshot_PRDDB_2010_08_16_14_30.out then I got following value
Snapshot timestamp                         = 08/16/2010 14:30:02.182330
What does this timestamp mean,
SQL's logged in this snapshot executed from 14:15 to 14:30  OR  14:30 to 14:45 ?
If anyone has Idea please help me on this.
ASKER CERTIFIED SOLUTION
Avatar of momi_sabag
momi_sabag
Flag of United States of America image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of gmarino
gmarino

DB2 Snapshots are cumulative aggregations showing the activity starting from either:
"First database connect timestamp" OR "Last reset timestamp" whichever is later.

If you wanted a snapshot to show you the activity for a 15 minute interval, you would need to do the following (using an id with appropriate rights):

db2 reset monitor all
sleep 900    ## 900 seconds = 15 minutes
db2 get snapshot for all on db_name

You can still use your snapshots that you took using the script you showed us in your question.  You would just have to open 2 snapshot files and do some subtraction to get just what happened in the last 15 minutes.  

Keep in mind that SOME of the monitor elements are NOT cumulative - instead they represent the value at the time the snapshot was taken - for example: "Locks held currently".


Let me show you 2 examples of snapshots.  Look at the entries I marked with "<<---" and do the time math.

This one shows a snapshot containing over 3 days of collected data:

First database connect timestamp           = 08/26/2010 17:45:23.268096 <<---
Last reset timestamp                       =
Last backup timestamp                      = 08/29/2010 21:14:02.000000
Snapshot timestamp                         = 08/30/2010 09:42:09.309278  <<---


This shows a snapshot containing 4 minutes and 32 seconds of collected data:

First database connect timestamp           = 08/26/2010 17:45:23.268096
Last reset timestamp                       = 08/30/2010 09:43:20.237385 <<---
Last backup timestamp                      = 08/29/2010 21:14:02.000000
Snapshot timestamp                         = 08/30/2010 09:47:52.899658 <<---


Hope that helps.  Too bad you already gave out the points (but I'm a nice guy)...

- Greg
Avatar of harsha_james

ASKER

Hi Greg,
Wonderful Explanation on Snapshots, Thank you very much for your efforts.