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. We use the bar_action and bar_instance tables .

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
FROM bar_action, bar_instance
WHERE
        bar_action.act_aid = bar_instance.ins_aid
        AND bar_action.act_oid = bar_instance.ins_oid
        AND bar_instance.ins_level = 0
        -- Ignore non chunk backups
        AND bar_instance.ins_backup_order > 0
        -- V 15 treats it as 1,  V14 will list it as '5'.
        AND bar_action.act_type in (1,5)
        AND bar_instance.seal_time = (SELECT MAX(seal_time) FROM bar_instance WHERE ins_level = 0 and rsam_time > 0)



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

Tom Beebe (tom@xdbsystems.com)