Scott, this is almost exactly what I was looking for. Like I said, I could recall the name of that sysmaster table. But I see 4 time-related fields in there. Here's a query to see them all:
select dbinfo('UTC_TO_DATETIME', sh_boottime) boot_time,
dbinfo('UTC_TO_DATETIME', sh_pfclrtime) stats_cleared,
dbinfo('UTC_TO_DATETIME', sh_curtime) current_time,
dbinfo('UTC_TO_DATETIME', sh_bootstamp) boot_tstamp,
dbinfo('UTC_TO_DATETIME', sh_stamp) current_time_stamp
from sysshmvals
And the rather interesting results:
boot_time 2025-06-13 03:35:56
stats_cleared 2025-06-13 03:35:56
current_time 2025-06-13 12:10:34
boot_tstamp 1973-02-07 20:44:00
current_time_stamp 1989-05-19 06:00:45
OK, I know my server was bounced ~ 3:30+ this morning. So it makes sense that stats_cleared == boot_time. And just to be certain, I also fetched sh_curtime (current_time) which is correct in my time zone. For my purposes I will use sh_pfclrtime
since my purpose is to display I/O stats since beginning of stats.
This should be the end of my thread but the other two time stamps caught my curiosity:
- Column dh_bootstamp (displayed as boot_tstamp) seems to be the Unix time-0 time so I would discount it entirely here. Obviously not used.
- Column sh_stamp (current_time_stamp), which is listed in sysmaster.sql as "current time stamp" in the comment, makes no sense and it changes every time I run the query, but never anything I can make sense of. Maybe it's not a value translatable to datetime?
That said, my bottom line question has been answered, hats off to Scott again.
And as I type this, I see Andreas L has piped in with the exact, concise answer to my bottom line question. Now I have only one hat left. :-)
MUCH gratitude!
------------------------------
Jacob Salomon
------------------------------
Original Message:
Sent: Fri June 13, 2025 11:12 AM
From: Mike Walker
Subject: Complete time stamp of when the server started
Try this against sysmaster. It's will show when the internal stats were last cleared (onstat -z) or when Informix was last started. Full disclosure, I think that Art shared this originally!
dbaccess sysmaster <<!
select current year to second - ( sh_curtime - sh_boottime) units second when_started,
( sh_curtime - sh_boottime) units second seconds_ago,
round((( sh_curtime - sh_boottime) units second)::char(20) /60/60,2) hours_ago,
round((( sh_curtime - sh_boottime) units second)::char(20) /60/60/24,2) days_ago
from sysmaster:sysshmvals;
!
You can replace sh_boottime with sh_pfclrtime to get the time that onstat -z was run to clear the internal stats.
------------------------------
Mike Walker
xDB Systems, Inc
www.xdbsystems.com
Original Message:
Sent: Fri June 13, 2025 10:45 AM
From: Jacob Salomon
Subject: Complete time stamp of when the server started
Hi family.
I SOOO want this one to be a quickie question & answer.
Bottom line: How do I get the complete date/time of when the current server instance started up?
Currently, the best I can do is:
grep 'IBM Informix Dynamic Server Started' <message log> | tail -1|awk '{print $1}'
In my case I got 03:35:54
. Now while this is a start (ahem) it is obviously missing the date. If it started up last week, this time stamp is less than helpful. Most (all?) other messages in the online log start with a full date-time stamp like 06/13/25 10:09:04
.
I was so sure there is a DBINFO parameter that would would hand this to me but I don't see that in the DBINFO documentation.
I also recall there is a table in sysmaster that keeps a gazzilion little items about the current server and one row may contain the start date/time. But I don't recall the name of that table. A peruse of sysmaster.sql was an example of searching for the needle in the haystack. (Aside: Author Kurt Vonnegut has advised aspiring authors to "avoid cliches like the plague." :-)
(The up time in every onstat heading would involve datetime and interval arithmetic that crosses the month<->day boundary.)
So how do find this?
Thank y'all for advice.
------------------------------
Jacob Salomon
------------------------------