DBAtlas · Atlas de operações de banco de dados

Listar jobs agendados / ver seu status

Oracle

SELECT job_name, enabled, state, last_start_date, next_run_date
FROM dba_scheduler_jobs
ORDER BY next_run_date;
-- Run history: SELECT job_name, status, actual_start_date, run_duration
--                 FROM dba_scheduler_job_run_details ORDER BY log_date DESC;

dba_scheduler_jobs mostra os jobs definidos e seus estados; dba_scheduler_job_run_details mostra os resultados de sucesso/falha das execuções anteriores.

PostgreSQL

SELECT jobid, schedule, command, nodename, active FROM cron.job;
-- Run history:
SELECT jobid, status, return_message, start_time, end_time
FROM cron.job_run_details ORDER BY start_time DESC LIMIT 20;

Com o pg_cron, cron.job lista os jobs definidos e cron.job_run_details fornece o status e a mensagem de retorno de cada execução.

MySQL

SELECT event_schema, event_name, status, interval_value, interval_field, last_executed
FROM information_schema.events
ORDER BY last_executed DESC;

information_schema.events lista os eventos definidos, seu status (ENABLED/DISABLED) e o horário da última execução.

SQL Server

SELECT j.name, j.enabled, h.run_status, h.run_date, h.run_time
FROM msdb.dbo.sysjobs j
LEFT JOIN msdb.dbo.sysjobhistory h ON h.job_id = j.job_id AND h.step_id = 0
ORDER BY h.run_date DESC, h.run_time DESC;

msdb.dbo.sysjobs fornece os jobs do Agent definidos, e sysjobhistory fornece o histórico de execuções e o resultado (run_status).

MongoDB

# Not applicable: there is no built-in scheduler, so there are no jobs to list. If Atlas Triggers are used, view them in the Atlas UI/API.

O MongoDB Community não tem tabela de jobs; os Atlas Triggers são gerenciados na interface do Atlas.

Redis

# Not applicable: Redis has no concept of scheduled jobs, so there are no jobs to list.

O Redis não inclui agendador de jobs; não há jobs para listar.

Elasticsearch

GET _slm/policy
GET _ilm/policy
// For Watcher states: GET _watcher/stats  and  GET _watcher/_query/watches

_slm/policy lista as políticas de snapshot, _ilm/policy lista as políticas de ciclo de vida e _watcher/stats mostra o estado de execução do Watcher.

Abrir no DBAtlas →