Troubleshooting
Problem
How to convert the DB2 value MinRecTime in db2pd to a human readable timestamp.
Symptom
The db2pd command displays MinRecTime as a number and not as a timestamp:
For example:
db2pd -d SAMPLE -tablespaces:
Tablespace Statistics:
Address Id TotalPgs UsablePgs UsedPgs PndFreePgs FreePgs HWM Max HWM State MinRecTime NQuiescers PathsDropped TrackmodState
0x000000003C254F40 0 20480 20476 17064 0 3412 17064 17064 0x00000000 0 0 No n/a
0x000000003C2620E0 1 1 1 1 0 0 - - 0x00000000 0 0 No n/a
0x000000003C26F280 2 4096 4064 1824 128 2112 2016 2016 0x00000000 0 0 No n/a
0x000000003C27C420 3 4096 4092 564 0 3528 564 564 0x00000000 1469536340 0 No n/a
The above is a shortened version of the output from db2pd for ease of reading in this document:
Tablespace Statistics:
Address Id MinRecTime
0x000000003C254F40 0 0
0x000000003C2620E0 1 0
0x000000003C26F280 2 0
0x000000003C27C420 3 1469536340
For example:
db2pd -d SAMPLE -tablespaces:
Tablespace Statistics:
Address Id TotalPgs UsablePgs UsedPgs PndFreePgs FreePgs HWM Max HWM State MinRecTime NQuiescers PathsDropped TrackmodState
0x000000003C254F40 0 20480 20476 17064 0 3412 17064 17064 0x00000000 0 0 No n/a
0x000000003C2620E0 1 1 1 1 0 0 - - 0x00000000 0 0 No n/a
0x000000003C26F280 2 4096 4064 1824 128 2112 2016 2016 0x00000000 0 0 No n/a
0x000000003C27C420 3 4096 4092 564 0 3528 564 564 0x00000000 1469536340 0 No n/a
The above is a shortened version of the output from db2pd for ease of reading in this document:
Tablespace Statistics:
Address Id MinRecTime
0x000000003C254F40 0 0
0x000000003C2620E0 1 0
0x000000003C26F280 2 0
0x000000003C27C420 3 1469536340
Cause
The value above (1469536340) represents the number of elapsed seconds since: 1970-01-01-00.00.00
Resolving The Problem
The following SQL will convert this value to a readable timestamp:
1
--------------------------
2016-07-26-12.32.20.000000
1 record(s) selected.
db2 "values timestamp('1970-01-01-00.00.00') + 1469536340 seconds"
1
--------------------------
2016-07-26-12.32.20.000000
1 record(s) selected.
Related Information
[{"Product":{"code":"SSEPGG","label":"Db2 for Linux, UNIX and Windows"},"Business Unit":{"code":"BU058","label":"IBM Infrastructure w\/TPS"},"Component":"Database Objects\/Config - Tablespaces","Platform":[{"code":"PF002","label":"AIX"},{"code":"PF010","label":"HP-UX"},{"code":"PF016","label":"Linux"},{"code":"PF027","label":"Solaris"},{"code":"PF033","label":"Windows"}],"Version":"9.8;9.7;10.1;10.5;11.1","Edition":"Advanced Enterprise Server;Advanced Workgroup Server;Enterprise Server;Express;Express-C;Personal;Workgroup Server","Line of Business":{"code":"LOB10","label":"Data and AI"}}]
Was this topic helpful?
Document Information
Modified date:
02 February 2020
UID
swg21987843