Bacula-users

Re: [Bacula-users] SQL-Query for copy job to get latest full + all following differentials & incrementals...

2013-02-14 02:15:11
Subject: Re: [Bacula-users] SQL-Query for copy job to get latest full + all following differentials & incrementals...
From: Uwe Schuerkamp <uwe.schuerkamp AT nionex DOT net>
To: "Masopust, Christian" <christian.masopust AT siemens DOT com>
Date: Thu, 14 Feb 2013 08:11:51 +0100
On Wed, Feb 13, 2013 at 08:08:34PM +0100, Masopust, Christian wrote:
> 
> :List all Jobs needed for a disaster recovery for a jobname:
> *Enter Job name:
> SELECT DISTINCT Job.JobId,StartTime FROM Job  WHERE Job.Name = '%1' AND (
>   (Level='F' 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') ORDER BY StartTime DESC LIMIT 
> 1
>     )
>   ) 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') ORDER BY StartTime DESC LIMIT 
> 1
>     )
>   ) 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') ORDER BY StartTime DESC 
> LIMIT 1
>       )
>     ORDER BY StartTime DESC LIMIT 1 )
>   )
> ) ORDER BY JobId;
> 

Hi Christian,

thanks for sharing, I'm glad the query.sql got you on your way. If you
manage to "shoe-horn" a client or job name dynamically into a copy job
definition then please let me know ;)

All the best, 

Uwe 

-- 
NIONEX --- Ein Unternehmen der Bertelsmann SE & Co. KGaA



------------------------------------------------------------------------------
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 AT lists.sourceforge DOT net
https://lists.sourceforge.net/lists/listinfo/bacula-users