> > I'd like to set up a copy job here for offsite backup (on > demand) and therefore would need > > a fine SQL-query to get all jobs listed for the most recend > full and all following differentials > > and incrementals. All backups are to one single pool. > > > > As said, the offsite backup should be done on demand and > therefore I cannot take the latest > > full alone... > > > > I'm sure this query should be possible but my SQL-knowledge > is a little poor :) > > > > Thanks a lot, > > christian > > > Hi Christian, > > maybe you can check the example query.sql that comes with bacula > ("Select most recent backup for a client") to get you started. Your > query should return a list of jobids to be copied which is what the > example query provides. You might want to add some safety net so jobs > that are already on tape won't be copied again (previousjobid, I > think). > > Cheers, Uwe
Hi Uwe, thanks for reminding me about the query.sql :) Starting from there I found now a way to create a query that includes the most recent full, the latest differential and all incrementals since the latest differentials (see below). It is definitly working here for me and I'm glad to share it, but.... I'm absolutely sure that there MUST be a better (more nifty) way to get the same result :) Thanks, Christian P.S.: here's the query: :List all Jobs needed for a disaster recovery for a given jobname: *Enter Job name: SELECT DISTINCT Job.JobId,StartTime FROM Job WHERE Job.Name = '%1' AND ( (Level='F' AND JobStatus IN ('T', 'W')) OR (Level='D' AND JobStatus IN ('T', 'W') AND Job.StartTime >= ( SELECT DISTINCT StartTime FROM Job WHERE Job.Name = '%1' AND Level='F' AND JobStatus IN ('T', 'W') ) ) OR (Level='I' AND JobStatus IN ('T', 'W') AND Job.StartTime >= ( SELECT DISTINCT StartTime FROM Job WHERE Job.Name = '%1' AND Level='D' AND JobStatus IN ('T', 'W') AND Job.StartTime >= ( SELECT DISTINCT StartTime FROM Job WHERE Job.Name = '%1' AND Level='F' AND JobStatus IN ('T', 'W') ) ) ) ); ------------------------------------------------------------------------------ Free Next-Gen Firewall Hardware Offer Buy your Sophos next-gen firewall before the end March 2013 and get the hardware for free! Learn more. http://p.sf.net/sfu/sophos-d2d-feb _______________________________________________ Bacula-users mailing list Bacula-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/bacula-users