Bacula-users

[Bacula-users] Purging jobs according to an SQL statement

2009-07-30 08:11:37
Subject: [Bacula-users] Purging jobs according to an SQL statement
From: Miroslav Prýmek <m.prymek AT gmail DOT com>
To: bacula-users AT lists.sourceforge DOT net
Date: Mon, 27 Jul 2009 17:31:43 +0200
Hello to all,

at first I would like to thank the authors for their work!

I have a bunch of questions.

My situation:

I have many defined jobs for backing up the server. They are
scheduled on mothly basis:
first sat of month -> full backups
every other sat -> differential backups
all other days -> incremental backups

All backups are going to the pool "QuickPool" (PoolId=4) stored on
the backup server's internal HDD. Every sunday
I migrate all the full and diff backups to the pool "ArchivePool" (PoolId=5)
stored on an external USB disk (manually unmounted after succesfull migration).

It's done with this job [displaying only relevant fields]:
Job {
 Name = "MoveToUsbDisk"
 Type = Migrate

 Selection Type    = SQLQuery
 Selection Pattern = "select JobId from Job where (level=\"F\" or level=\"D\") and JobStatus=\"T\" and PoolId=4 and PurgedFiles=0;"
}
**
Migration seems to work OK. Can you please ensure me that the migration method is right?
**

The problem is that the obsolete incremental backups remain in the
"QuickPool" pool (internal disk).

**
The solution could be to define the retention periods but I didn't understand well
how to do it right. Should I set the job retention, volume retention or what? Where
precisely (pool definition?) and what values?
**

The inconvenient think with the retention time is that in the case of some error (e.g. some backups
not migrated), I could loose some important backups...

I've googled up the Phil Stracchino's suggestion for "Automatically purge obsoleted jobs"
http://osdir.com/ml/bacula.user/2003-04/msg00106.html ).
That's precisely what I want and it could be realized with a simple thing: purging jobs according
to the SQL selection of JobId-s. The SQL statement for me would be (I think):

select JobId from Job where Name="SomeJobName" and PoolId=4 and StartTime<(select max(StartTime)
from Job where Name="SomeJobName" and Level="F" and JobStatus="T" and PoolId=5);

This statement should return the ids of the incremental backups present in the QuickPool (id=4)
which are older then the newest full backup of the same name present in the ArchivePool (id=5).

**
Is it possible to somehow purge all jobs with PoolId-s returned by this SQL statement?
**

Thank you very much for any suggestions...

M. Prymek

------------------------------------------------------------------------------
Let Crystal Reports handle the reporting - Free Crystal Reports 2008 30-Day 
trial. Simplify your report design, integration and deployment - and focus on 
what you do best, core application coding. Discover what's new with 
Crystal Reports now.  http://p.sf.net/sfu/bobj-july
_______________________________________________
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>
  • [Bacula-users] Purging jobs according to an SQL statement, Miroslav Prýmek <=