On 27/07/10, Lamp Zy (lampzy AT gmail DOT com) wrote:
> Hello,
>
> I'm using bacula-5.0.2.
>
> Is there a way in bconsole to see which jobs used a particular tape?
>
> I can run "list jobmedia", save the output to a file and then grep for
> the media name but it's a lot of steps and it shows only the jobid.
The following is a generic SQL query that I think might do what you want.
SELECT
j.name as jobname, m.volumename as volname,
p.path as path, fn.name as filename
FROM
job j, media m, file f, jobmedia jm,
filename fn, path p
WHERE
jm.mediaid = m.mediaid
AND
jm.jobid = j.jobid
AND
jm.startfile = f.fileid
AND
f.pathid = p.pathid
AND
f.filenameid = fn.filenameid;
This might be worth saving as a view. In Postgres you would do something like:
CREATE VIEW v_job_vol_path_name AS
<query body as above>
You could then query it to find jobids by media like this:
SELECT
distinct(jobname), volname
FROM
v_job_vol_path_name
ORDER BY
jobname, volname;
You can also use this view to find which files are on which jobs, which are on
which tapes and son on.
I hope this helps.
Rory
--
Rory Campbell-Lange
rory AT campbell-lange DOT net
------------------------------------------------------------------------------
The Palm PDK Hot Apps Program offers developers who use the
Plug-In Development Kit to bring their C/C++ apps to Palm for a share
of $1 Million in cash or HP Products. Visit us here for more details:
http://ad.doubleclick.net/clk;226879339;13503038;l?
http://clk.atdmt.com/CRS/go/247765532/direct/01/
_______________________________________________
Bacula-users mailing list
Bacula-users AT lists.sourceforge DOT net
https://lists.sourceforge.net/lists/listinfo/bacula-users
|