Skip site navigation (1) Skip section navigation (2)

Re: wal logs in pg_xlog

From: Jeff Frost <jeff(at)frostconsultingllc(dot)com>
To: pgsql-admin(at)postgresql(dot)org
Subject: Re: wal logs in pg_xlog
Date: 2005-06-29 15:08:28
Message-ID: (view raw, whole thread or download thread mbox)
Lists: pgsql-admin
On Tue, 28 Jun 2005, Nasir Iqbal Danish wrote:

> Please provide me if u can some script to identify which one is latest file 
> so that I can copy this to some other place.
> One more question. Is there a way to build or configure the database server 
> to replicate pg_xlogs ?

I use this fairly simple method:

LASTLOG=`ls -rt /pg_xlog/ | grep -v "backup\|archive" | tail -1`

There might be something more elegant.  I also use the following method to get 
rid of archived wal files that are older than the oldest base backup I am 

OLDESTFILE=$PITRBASEDIR/`ls -t $PITRBASEDIR | tail -1`/backup_label

if [ -f $OLDESTFILE ]; then
 	/usr/bin/find $PITRDESTDIR -type f -not -newer $OLDESTFILE \
 		-exec rm -f \{\} \;

Your mileage may vary, but it appears to work for me.

Jeff Frost, Owner 	<jeff(at)frostconsultingllc(dot)com>
Frost Consulting, LLC
Phone: 650-780-7908	FAX: 650-649-1954

In response to

pgsql-admin by date

Next:From: jehan procacciaDate: 2005-06-29 18:20:06
Subject: restore database from bare files
Previous:From: Leander GillardDate: 2005-06-29 15:05:22
Subject: Postrgre Integrated App Development

Privacy Policy | About PostgreSQL
Copyright © 1996-2017 The PostgreSQL Global Development Group