Re: Data corruption while taking backup of database

From: Daniel Migowski <dmigowski(at)ikoffice(dot)de>
To: Pushker Chaubey <pchaubey(at)vertex(dot)co(dot)in>
Cc: pgsql-jdbc(at)postgresql(dot)org
Subject: Re: Data corruption while taking backup of database
Date: 2008-06-26 14:36:57
Message-ID: 4863A989.5040000@ikoffice.de
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-jdbc

Hello Heikki,

the problem is just the order of the exported tables. We always use
begin and commit surrounding the dump when restoring, and ensure, all
contraints are DEFERRABLE INITIALLY DEFERRED (You can alternatively SET
constraints ALL DEFERRED; after creating the schema and before entering
the data).

With best regards,
Daniel Migowski

Heikki Linnakangas schrieb:
> Pushker Chaubey wrote:
>> We took back up of a database using the following command
>> pg_dump -a
>> Please note that when we took the back the database was available for
>> use simultaneously from various clients.
>>
>> In the back up file that was generated we found some data that was
>> violating foreign key constraints. And there fore we were not able to
>> restore database back with this back up file.
>>
>> What may be the possible reasons?
>>
>> Also please tell me, is it safe if we allow concurrent modification
>> of data through DMLs and the same time take the back up using pg_dump?
>
> Yes, that is safe. pg_dump takes a coherent snapshot of the database
> as it is when the backup starts; modifications during the backup don't
> show up in the backup. But clearly something has corrupted your
> database either before the backup or during it.
>
> Are the rows that violate the foreign key constraint still there in
> the original database? When was the last time you backed up? Can you
> check if the foreign key violation present in the previous backup as
> well?
>
> What does the schema of the tables involved look like? Can you post
> the offending rows?
>
> (this has nothing to do with JDBC, BTW. pgsql-general mailing list
> would be more appropriate)
>

In response to

Browse pgsql-jdbc by date

  From Date Subject
Next Message A. Tres Finocchiaro 2008-06-26 16:42:08 Re: Problem establishing connection
Previous Message Pushker Chaubey 2008-06-26 10:20:19 Re: Data corruption while taking backup of database