I didn't get any replies, but I devised this query:

SELECT DISTINCT media.volumename, media.volstatus, pool.name AS pool,
media.mediatype, job.name AS job_name, job.starttime
FROM (
     SELECT job.name as name, MAX(starttime) AS starttime
     FROM job
     WHERE job.level = 'F' AND level='F' AND jobstatus IN ('T', 'W')
     AND job.name != 'BackupCatalog' AND AGE(starttime) < INTERVAL '60 days'
     GROUP BY job.name
) AS successful_full_jobs
JOIN job ON job.name = successful_full_jobs.name AND job.starttime =
successful_full_jobs.starttime
JOIN jobmedia ON jobmedia.jobid = job.jobid
JOIN media ON media.mediaid = jobmedia.mediaid
JOIN pool ON pool.poolid = media.poolid
ORDER BY media.volumename;


I'm not that familiar with the data model, so this query may be incorrect.

One thing I find unsatisfactory about it is the "AGE(starttime) <
INTERVAL '60 days'" condition.  If I leave that out, I get results
from full backups taken a long time ago with job names which are no
longer in use (i.e. which have been replaced by other jobs also in the
results of the query).   But I can't see a better way to eliminate
those.

Can anybody suggest an improvement or correction?

Thanks,
James.

-- 
You received this message because you are subscribed to the Google Groups 
"bareos-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To view this discussion on the web visit 
https://groups.google.com/d/msgid/bareos-users/CAGwX767OfiZk3YTYiyzj6pQu_cFZf51f5KkGgd77WrRGpQZzBQ%40mail.gmail.com.

Reply via email to