IBM Maximo: SQL Queries - tabela CRONTASKHISTORY

From Wiki
Revision as of 21:06, 12 April 2022 by Ebasso (talk | contribs) (Criou a página com "= 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...")
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)

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_min, 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