Thread: Recovery from Archive files

Recovery from Archive files

From
senthilnathan
Date:
How to recover a standalone postgres setup using archive files alone? What
are the steps/config involved?

--
View this message in context:
http://postgresql.1045698.n5.nabble.com/Recovery-from-Archive-files-tp4917420p4917420.html
Sent from the PostgreSQL - general mailing list archive at Nabble.com.

Re: Recovery from Archive files

From
John R Pierce
Date:
On 10/19/11 4:57 AM, senthilnathan wrote:
> How to recover a standalone postgres setup using archive files alone? What
> are the steps/config involved?

'archive files' ?  you mean a WAL archive? you need the base backup
*and* all WAL files since to recover with that.

--
john r pierce                            N 37, W 122
santa cruz ca                         mid-left coast


Re: Recovery from Archive files

From
senthilnathan
Date:
Thanks John.,

Yes its from WAL Archives. I dont have the basebackup instead i am having
all the WAL files that are archived right from the server start. My question
is how(steps?) to to build whole setup(postgres server)by replaying all WAL
files
(from 000000010000000000000001....................000000010000000100000027)

--
View this message in context:
http://postgresql.1045698.n5.nabble.com/Recovery-from-Archive-files-tp4917420p4920328.html
Sent from the PostgreSQL - general mailing list archive at Nabble.com.

Re: Recovery from Archive files

From
John R Pierce
Date:
On 10/19/11 9:31 PM, senthilnathan wrote:
> Thanks John.,
>
> Yes its from WAL Archives. I dont have the basebackup instead i am having
> all the WAL files that are archived right from the server start. My question
> is how(steps?) to to build whole setup(postgres server)by replaying all WAL
> files

WAL file archives are like successive differences from the base backup.

without the base backup, they are useless.


--
john r pierce                            N 37, W 122
santa cruz ca                         mid-left coast


Re: Recovery from Archive files

From
Raghavendra
Date:
On Thu, Oct 20, 2011 at 10:01 AM, senthilnathan <senthilnathan.t@gmail.com> wrote:
Thanks John.,

Yes its from WAL Archives. I dont have the basebackup instead i am having
all the WAL files that are archived right from the server start. My question
is how(steps?) to to build whole setup(postgres server)by replaying all WAL
files
(from 000000010000000000000001....................000000010000000100000027)


I think you should give a try on any test box. 

Am assuming you are having $PGDATA (data directory) and their WAL Archives. Take a copy of these to your test box and follow below steps.

1. Remove postmaster.pid from $PGDATA
2. Create recovery.conf file in $PGDATA directory.
    vi recovery.conf
            restore_command = ' cp /WAL Archives destination/%f %p'
            recovery_target_time = '2011-10-20 14:30:25'  
    :wq

    Note: Here target_time is your current rebuild time, because you want to replay all WAL Archives which are available.

3. Start the instance and check $PGDATA/pg_log/.log file on to know how recovery process went.


---
Regards,
Raghavendra
EnterpriseDB Corporation

Re: Recovery from Archive files

From
John R Pierce
Date:
On 10/20/11 2:33 AM, Raghavendra wrote:
> Am assuming you are having $PGDATA (data directory) and their WAL
> Archives.

he said he does not have the base backup ($PGDATA), so this is pointless.



--
john r pierce                            N 37, W 122
santa cruz ca                         mid-left coast


Re: Recovery from Archive files

From
Raghavendra
Date:
On Thu, Oct 20, 2011 at 11:58 PM, John R Pierce <pierce@hogranch.com> wrote:
On 10/20/11 2:33 AM, Raghavendra wrote:
Am assuming you are having $PGDATA (data directory) and their WAL Archives.

he said he does not have the base backup ($PGDATA), so this is pointless.

Ahh.. Agreed.
I mis-read, I though he is trying to recovery from current DATA directory and not with base backup which he doesn't have it.

---
Regards,
Raghavendra
EnterpriseDB Corporation


Re: Recovery from Archive files

From
Ian Harding
Date:
On Thu, Oct 20, 2011 at 11:42 AM, Raghavendra
<raghavendra.rao@enterprisedb.com> wrote:
> On Thu, Oct 20, 2011 at 11:58 PM, John R Pierce <pierce@hogranch.com> wrote:
>>
>> On 10/20/11 2:33 AM, Raghavendra wrote:
>>>
>>> Am assuming you are having $PGDATA (data directory) and their WAL
>>> Archives.
>>
>> he said he does not have the base backup ($PGDATA), so this is pointless.
>
> Ahh.. Agreed.
> I mis-read, I though he is trying to recovery from current DATA directory
> and not with base backup which he doesn't have it.
> ---
> Regards,
> Raghavendra
> EnterpriseDB Corporation
> Blog: http://raghavt.blogspot.com/
>
>
I thought if you had every log file ever generated from initdb, you
could initdb, and start replaying logs?  It's an odd scenario, but I
thought I heard that could work... Come to think of it, I think that
was an Oracle thing I heard... but still.. if you had every log
file....

- Ian