Tag Archives: Backups

Getting the duration of the last Informix level 0 backup with onbar

Sometimes you may want to quickly review the duration of the last level 0 backup from a system.
We can do this by using the sysutils database. When a backup runs it writes to a series of tables. The only one we need for this is the bar_action table.

The fields we care about are act_aid (the identifier of the action), act_type (what the activity is, ‘5’ is full system backup), act_start and act_end.

We want to get the diff of the act_start of the first object being backed up and the act_end of the last object completing.

A simple sql to do this is:


SELECT
    -- Get the difference from the start to the end, return it in hour to second
    ((MAX(act_end) - MIN(act_start))::INTERVAL HOUR TO SECOND)::CHAR(10), 
    -- Get the raw start and end times in case they are needed
    MAX(act_end) end_time, MIN(act_start) start_time
    --  Get the highest act_aid 
FROM bar_action
WHERE bar_action.act_aid = (SELECT MAX(act_aid) FROM bar_action WHERE act_type = 5)


Note, this does not work for ontape backups, only onbar.

Tom Beebe (tom@xdbsystems.com)