> > > > :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 ;) >
Hi Uwe, yes, it would be fine to get the job name dynamically into this definition :) But... if I try the above SQL in a copy job's "Selection Pattern", it failes because of a too small buffer (when I'm right, the buffer is "only" 500 chars). So next I tried to put the statement above in a stored procedure in my database and use "call my-procedure(my-jobname);" in Selection Pattern. This at least gets the correct job ids for my copy job but the whole job failes with lots of database related error messages like: > 14-Feb 09:40 atpcc7fc-dir JobId 0: Fatal error: sql_create.c:517 > sql_create.c:517 > query SELECT ClientId,Uname FROM Client WHERE Name='atvies2gfx-fd' failed: > Commands out of sync; you can't run this command now Any idea what's going on here? And now, as a last try I defined a view within my database with the above statement, use "select JobId from my-view;" and.... Heureka!!! ... it's working!! So... some questions left: - can the size of "Selection Pattern" be increased (probably without increasing it for all other parameter values) ? - why are stored procedures not possible in this case? Thanks, Christian ------------------------------------------------------------------------------ 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