Bacula-users

Re: [Bacula-users] Find a file in backup without exact name or path

2012-06-11 17:26:02
Subject: Re: [Bacula-users] Find a file in backup without exact name or path
From: Phil Stracchino <alaric AT metrocast DOT net>
To: bacula-users AT lists.sourceforge DOT net
Date: Mon, 11 Jun 2012 17:23:40 -0400
On 06/11/2012 04:51 PM, Domen Kožar wrote:
> You will have to write an SQL query that does the following:
> 
> - selects all jobs from the client that you are interested in
> - filter by path where backup was stored
> - generate path/filenames for all jobs (they are base64 encoded)
> - with programming language filter results by *flyer*

Or, you could do something like the following:

mysql> select * from Filename where Name like '%flyer%';

You *REALLY* want to do this as a search on a single table, NOT part of
a join, because your filename fragment both begins and ends with a
wildcard, and therefore your DB cannot use an index to search for it,
which means it's going to force a full table scan.  You want that full
table scan to happen on a single table, not on a join of five tables.


Once you have identified a likely filename, do something like this:

mysql> select File.FileId, Path.Path, Filename.Name, Client.Name,
Job.JobId from File join Filename on File.FilenameId =
Filename.FilenameId join Path on File.PathId = Path.PathId join Job on
Job.JobId = File.JobId join Client on Job.ClientId = Client.ClientId
where Filename.Name = 'your filename here';


This will give you the name of the client, the job ID it was backed up
in, and where on that client it is located.



-- 
  Phil Stracchino, CDK#2     DoD#299792458     ICBM: 43.5607, -71.355
  alaric AT caerllewys DOT net   alaric AT metrocast DOT net   phil AT 
co.ordinate DOT org
  Renaissance Man, Unix ronin, Perl hacker, SQL wrangler, Free Stater
                 It's not the years, it's the mileage.



------------------------------------------------------------------------------
Live Security Virtual Conference
Exclusive live event will cover all the ways today's security and 
threat landscape has changed and how IT managers can respond. Discussions 
will include endpoint security, mobile security and the latest in malware 
threats. http://www.accelacomm.com/jaw/sfrnl04242012/114/50122263/
_______________________________________________
Bacula-users mailing list
Bacula-users AT lists.sourceforge DOT net
https://lists.sourceforge.net/lists/listinfo/bacula-users

<Prev in Thread] Current Thread [Next in Thread>