Bacula-users

Re: [Bacula-users] howto to recover postgres catalog after delete from file

2011-05-19 19:33:09
Subject: Re: [Bacula-users] howto to recover postgres catalog after delete from file
From: Thomas Stegbauer <mailingliste1 AT stegbauer DOT info>
To: bacula-users AT lists.sourceforge DOT net
Date: Fri, 20 May 2011 01:29:34 +0200 (CEST)

----- Ursprüngliche Mail -----
Von: "Phil Stracchino" <alaric AT metrocast DOT net>
An: bacula-users AT lists.sourceforge DOT net
Gesendet: Donnerstag, 19. Mai 2011 22:06:43
Betreff: Re: [Bacula-users] howto to recover postgres catalog after delete from 
file

On 05/19/11 12:54, Thomas Stegbauer wrote:
> hi all,
> 
> i am running bacula 5.0.1 with postgresql catalog on Ubuntu.
> As there was an error in the file relation. it was an blockerror.
> i was unable to do a select on the file table, nor a pg_dump of the
> catalog.
> 
> so i deleted everything from
> file
> filepath
> path - table, but left the table there.
> 
> running dbcheck brings out 1 o orphaned file  (from a job i tried)
> 
> no i whant to make an backup with bacula to fill the file table again.
> 
> but after the backup job i get:
> 9-Mai 05:23 pa-server-dir JobId 2268: Fatal error: sql_create.c:894 Fill
> File table Query failed: INSERT INTO File (FileIndex, JobId, PathId,
> FilenameId, LStat, MD5)SELECT batch.FileIndex, batch.JobId, Path.PathId,
> Filename.FilenameId,batch.LStat, batch.MD5 FROM batch JOIN Path ON
> (batch.Path = Path.Path) JOIN Filename ON (batch.Name = Filename.Name):
> ERR=ERROR:  null value in column "fileid" violates not-null constraint
> 
> how to i get the catalog up and running?


You have a backup copy of your DB.   ...Right?

Worse case:  Stop Bacula, drop the Bacula DB, recreate it, restart
Bacula, bscan in the volume containing your last Catalog backup, restore
the Catalog.

However, if the device your Catalog is stored on is throwing block
errors, and you do this WITHOUT first replacing that device, you're
playing Russian roulette.  Replace the drive first.


-- 
  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.

Hi Phil,

sorry answered directly before.

as the pg_dump brought an error and bacula backed up the corrupted export
well to tape, we did not get the error in the beginning. so i dont know
when it came up.

First thing is we need a backup
so i dropped the content of the filetable and hoped the data get created
by the next backup.

it is not so important if i cant restore a single file from an old backup,
but i want to make a new full-backup, with correct catalog update.
i do not understand where the batch relation come from and why there is an
sql-Error when the file, filename and path table are empty?

best regards
thomas

------------------------------------------------------------------------------
What Every C/C++ and Fortran developer Should Know!
Read this article and learn how Intel has extended the reach of its 
next-generation tools to help Windows* and Linux* C/C++ and Fortran 
developers boost performance applications - including clusters. 
http://p.sf.net/sfu/intel-dev2devmay
_______________________________________________
Bacula-users mailing list
Bacula-users AT lists.sourceforge DOT net
https://lists.sourceforge.net/lists/listinfo/bacula-users