IBM Maximo: SQL Queries - tabela CRONTASKHISTORY

From Wiki

SQL Queries

Listar o total de crontasks executadas por Ano

select to_char(endtime,'YYYY') as yr, count(1) as cnt
from crontaskhistory
group by to_char(endtime,'YYYY')
order by to_char(endtime,'YYYY') desc

Listar o total de crontasks executadas por Crontask e Instancia

select crontaskname, instancename, count(1) as cnt 
from crontaskhistory
group by crontaskname, instancename
order by cnt desc

Com essa informações podemos melhorar o cleanup da tabela CRONTASKHISTORY. Basta desmarcar a opção Manter Histórico.

Maximo CronTask Monitor SQL

From Maximo CronTask Monitor SQL

Listar as crontasks executados com maior tempo de duração em SEGUNDOS nos últimos 30 dias

select crontaskname, instancename, servername, round((endtime-starttime)*24*60*60) exec_time, starttime, endtime
from crontaskhistory
where activity='ACTION'
and starttime > sysdate - 30
order by exec_time desc

Listar as crontasks executados com maior tempo de duração em MINUTOS nos últimos 7 dias

select crontaskname, instancename, servername, round((endtime-starttime)*24*60) exec_time, starttime, endtime
from crontaskhistory
where activity='ACTION'
and starttime > sysdate - 7
order by exec_time desc

Listar as crontasks executados por hora

select extract(hour from (cast(starttime as timestamp))) exec_hour, round(sum(endtime-starttime)*24*60*60,3) exec_time
from crontaskhistory
where activity='ACTION'
and starttime > sysdate - 30
group by extract(hour from (cast(starttime as timestamp)))
order by extract(hour from (cast(starttime as timestamp)))

Ver também