pg.ddx.io  pgsql-admin@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Alexander Burbello <burbello3000@yahoo.com.br>
To: pgsql-admin@postgresql.org
Subject: Restore and Recover Database
Date: Tue, 25 Jul 2006 17:16:27 -0300
Message-ID: <44C67C1B.3050809@yahoo.com.br> (raw)

Sorry insist in this question, but did someone try to restore and 
recover the database, and check if no data is lost??

I tryed to do some steps following the Postgres documentation, but ... I 
couldn't recover.
Anybody has some tips or suggestion?

Thanks in advance.




I followed the steps based on the site, but I couldn't finish succesfully.

I did:

 1. Put the database on Backup Mode and copy datafiles.
    /pg/bin/psql dbdev -c "SELECT pg_start_backup('/pg/backup/');"
    tar -cvf /pg/backup/bk_base.tar /pg/data/base/*
    /pg/bin/psql dbdev -c "SELECT pg_stop_backup();"

    File .conf: archive_command = 'cp -i %p /pg/backup/xlog/%f </dev/null'


 2. Created a new table and populated with data, to simulate the recovery:
    create table test (
     aa integer,
     bb varchar(50)
    );

    insert into test values (1,'aaa');
    ...
    insert into test values (5,'aaa');

    Data inserted successfully!!!


 3. Shutdown on database;

    Last log transactions copied to the directory archived log;
    cp /pg/data/pg_xlog/* /pg/backup/xlog/


 4. Configuring the recovery.conf file:

    restore_command = 'cp /pg/backup/xlog/%f %p'
    recovery_target_time = '2006-07-06 16:33:52 BRT'


 5. Simulate the lost directories, deleting... :

    rm -r /pg/data/base/*

 6. Recreating the directories exploding the tar file:

    tar -xvf bkp_base... .tar

 7. Starting the database for applying the log transactions.
    Supposing recove the table "test" located on log transactions.

    LOG:  database system was shut down at 2006-07-06 16:47:18 BRT
    LOG:  starting archive recovery
    LOG:  restore_command = "cp /pg/backup/xlog/%f %p"
    LOG:  recovery_target_time = 2006-07-06 16:33:52-03
    cp: cannot stat `/pg/backup/xlog/00000001.history': No such file or directory
    LOG:  restored log file "000000010000000000000001" from archive
    LOG:  record with zero length at 0/1122880
    LOG:  invalid primary checkpoint record
    LOG:  restored log file "000000010000000000000001" from archive
    LOG:  record with zero length at 0/1122844
    LOG:  invalid secondary checkpoint record
    PANIC:  could not locate a valid checkpoint record
    LOG:  startup process (PID 3989) was terminated by signal 6
    LOG:  aborting startup due to startup process failure


 8. There was an error and the table was lost!!!!!!!!!!!!!!!!!







view thread (2+ messages)  latest in thread

Message-ID: <44C67C1B.3050809@yahoo.com.br>
Permalink:  ../44C67C1B.3050809@yahoo.com.br/
Also on:    postgresql.org/message-id/44C67C1B.3050809@yahoo.com.br

 · 

reply

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Reply to all the recipients from your mail client; the link fills in
  the headers below: reply via email
  Some clients, webmail especially, drop In-Reply-To and References from
  a link, and the reply then starts a new thread: use the mbox below.

  To: pgsql-admin@postgresql.org
  Cc: burbello3000@yahoo.com.br
  Subject: Re: Restore and Recover Database
  In-Reply-To: <44C67C1B.3050809@yahoo.com.br>
  References: <44C67C1B.3050809@yahoo.com.br>

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox