Thread: Deleted pg_log fix
Yup, I did it. Forced pg_log empty and almost lost EVERYTHING!
This is a RedHat 6.2 on an i386 class system.
Thanks to a few threads in this group, I was able to save 100% of my data, almost a gig.
I do not use XID's and have been warned that they may be lost using this method.
What I did:
First thing I did was make a huge tarball of the entire data directory for safety.
I then edited the following 2 files in the postgresql-7.0.2 source tree
/usr/src/postgresql-7.0.2/src/backend/access/transam/transsup.c
line 44 or so
added "AMI_OVERRIDE=true;" IMMEDIATELY AFTER "AMI_OVERRIDE=flag;"
/usr/src/postgresql-7.0.2/src/backend/access/transam/xact.c
line 238 or so
added "AMI_OVERRIDE=true;" IMMEDIATELY AFTER "AMI_OVERRIDE=false;"
Then return to /usr/src/postgresql-7.0.2/src and
gmake clean
gmake
gmake install
Then went to /usr/local/pgsql/bin and cp'd all files to my /usr/bin, replacing the old pg commands
At this point I was able to use "pg_dump -di" on each database and recover all schema and data 100%.
I then unmodified the files, recompiled and reloaded the execs to /usr/bin, created a new db and used psql to read in the old data and schema.
This might not work for everyone but it saved MY ass and I hope it can save yours.