Bacula-users

Re: [Bacula-users] List files associated with destroyed tape

2014-08-08 12:59:45
Subject: Re: [Bacula-users] List files associated with destroyed tape
From: Martin Simmons <martin AT lispworks DOT com>
To: bacula-users AT lists.sourceforge DOT net
Date: Fri, 8 Aug 2014 17:55:35 +0100
Yes, a query like below should return all of the fileid's for the files stored
on volume 'zzzzz'.  YMMV on mysql.

These are the fileid's to delete from the file table.  After that, you'll need
to delete the rows from the jobmedia table associated with the volume.

SELECT f.fileid
FROM file f
LEFT JOIN ( SELECT jj.jobid, jj.firstindex, jj.lastindex
            FROM jobmedia jj, media m
            WHERE jj.mediaid = m.mediaid and m.volumename='zzzzz'
          ) jmlj
     ON jmlj.jobid = f.jobid AND f.fileindex >= jmlj.firstindex AND f.fileindex 
<= jmlj.lastindex
WHERE jmlj.jobid = f.jobid;

__Martin


>>>>> On Fri, 08 Aug 2014 07:41:27 -0400, John Wallach said:
> 
> Ah,
> 
> That makes a lot of sense from a preservation of the jobs that's the
> best behavior, however we've shoehorned bacula into an archiving system
> so I don't want to lose access to the other data backed up on the media
> associated with the job.
> 
> I found this query that you commented on:
> http://adsm.org/lists/html/Bacula-users/2010-08/msg00412.html
> 
> I think translating that to mysql and adjusting for job/mediaid will get
> me what I am looking for. The files in this job should be unique so if I
> were to find them would there be a way to safely remove them from the
> file table?
> 
> Thanks,
> jmw

------------------------------------------------------------------------------
Want fast and easy access to all the code in your enterprise? Index and
search up to 200,000 lines of code with a free copy of Black Duck
Code Sight - the same software that powers the world's largest code
search on Ohloh, the Black Duck Open Hub! Try it now.
http://p.sf.net/sfu/bds
_______________________________________________
Bacula-users mailing list
Bacula-users AT lists.sourceforge DOT net
https://lists.sourceforge.net/lists/listinfo/bacula-users