Complete time stamp of when the server started
Posted in 2025
Jacob Salomon wanted the full date and time the Informix instance started, rather than the time-only message in the log. Mike Walker gave a sysmaster.sysshmvals query using sh_boottime, and Andreas Legner and Art Kagel showed dbinfo('utc_to_datetime', sh_boottime). Jacob confirmed it worked. David Williams asked about sh_bootstamp and sh_stamp; no answer shown.
Auto-generated by Claude from the posts below — may be imperfect; read the full thread.
Topics: General Discussion
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
------------------------------
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
------------------------------
select dbinfo("UTC_TO_DATETIME", sh_boottime) from sysmaster:sysshmvals; ------------------------------ Andreas Legner Informix Dev HCL Software ------------------------------
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
------------------------------
Jacob: It is in sysmaster.sysshmvals.sh_boottime along with the last time that stays were zeroed out. That column is a Unix epoch. You Cadbury get it as a dztetim by using dbinfo: Select dbinfo( 'utc_to_datetime', sh_boottime) From sysmaster.sysshmvals; Art ------------------------------ Art S. Kagel, President and Principal Consultant ASK Database Management Corp. www.askdbmgt.com ------------------------------
The well known chocolate function ? Cheers Paul Paul Watson Oninit LLC +1-913-387-7529 www.oninit.com Oninit® is a registered trademark of Oninit LLC
I HATE Autocorrect! ------------------------------ Art S. Kagel, President and Principal Consultant ASK Database Management Corp. www.askdbmgt.com ------------------------------
Hi Andreas, Can I confirm sh_bootstamp INT, { boot time stamp } sh_stamp INT, { current time stamp } are based on the internal timestamp counter which counts "internal server operations"? When exactly is the internal timestamp counter updated? Regards, David. ------------------------------ David Williams Senior Database Platform Engineer Flutter London ------------------------------
Related threads
- IDS not writing to online.log
- Help!!! syntax error
- installclientsdk bug?
- RamDisk tempdbs boot script for Linux