On 7/3/26 17:58, Phil Stracchino wrote:

This is my SQL selection query for copy jobs:

   Selection Pattern = "SELECT DISTINCT J.JobId
                        FROM Job J
                        JOIN Pool P ON P.PoolId = J.PoolId
                        LEFT JOIN Job J2 ON J2.PriorJobId = J.JobId
                        WHERE P.Name = 'Full-Disk'
                        AND J2.JobId IS NULL
                        AND J.Type = 'B'
                        AND J.JobStatus IN ('T','W')
                        AND J.JobBytes > 0
                        AND J.StartTime > now() - interval 7 day"

Notice that it selects copies only within a specified time window, and only jobs that have not already been copied.  (That's what the J2 join is for:  "No later Job points at this Job as its prior.")  It also selects only one Job type at a time (though I do it by Pool), where yours mixes Full and Differential together.

Thanks for your suggestion.
I'll look into it and try to adapt it to my case.
(Still I wonder if there is, or should be, an easier way :).

 bye
        av.


_______________________________________________
Bacula-users mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/bacula-users

Reply via email to