Thread: I lost the pg_control file
Hi, ALL, I just lost the pg_control file, located in /usr/local/pgsql/data/global I was making only backups one time a day, and I can't lost the entry day... All the data files are intact (I gess) in PG_DATA directory. I start a new INITDB after rename the PG_DATA directory to another name, but if I copy the pg_control file to real data directory, I receive a "NO FILE POINTER ERROR"... Please, can I recover from this crash using the files in /data/base directory ??? regards, Tulio Oliveira -- Tulio Oliveira Akácia Tecnologia www.akacia.com.br tulio@akacia.com.br
Tulio Oliveira <mestredosmagos@marilia.com> writes: > I just lost the pg_control file, located in /usr/local/pgsql/data/global How did that happen? > I start a new INITDB after rename the PG_DATA directory to another name, > but if I copy the pg_control file to real data directory, I receive a > "NO FILE POINTER ERROR"... I think you could recover by copying in a freshly-initialized pg_control (be sure you make it with the same locale setting as before!) and then running the pg_resetxlog utility from contrib. You'll probably have to use the -f switch to pg_resetxlog ... read its README file! Once you get the postmaster to start, do NOT make any changes to the database, or you will be very sorry :-(. Run pg_dumpall, then reload the data into a correctly initialized database. regards, tom lane
Tom Lane wrote: > > Tulio Oliveira <mestredosmagos@marilia.com> writes: > > I just lost the pg_control file, located in /usr/local/pgsql/data/global > > How did that happen? > > > I start a new INITDB after rename the PG_DATA directory to another name, > > but if I copy the pg_control file to real data directory, I receive a > > "NO FILE POINTER ERROR"... > > I think you could recover by copying in a freshly-initialized pg_control > (be sure you make it with the same locale setting as before!) and then > running the pg_resetxlog utility from contrib. You'll probably have to > use the -f switch to pg_resetxlog ... read its README file! > > Once you get the postmaster to start, do NOT make any changes to the > database, or you will be very sorry :-(. Run pg_dumpall, then reload > the data into a correctly initialized database. > > regards, tom lane > > ---------------------------(end of broadcast)--------------------------- > TIP 6: Have you searched our list archives? > > http://www.postgresql.org/search.mpl Thanks, Tom Lane, But I can't compile the pg_resetxlog !!! in /usr/src/postgresql-7.1rc4/contrib/pg_resetxlog directory, I typed "make" and the result is: gcc -O2 -Wall -Wmissing-prototypes -Wmissing-declarations -I../../src/include -c -o pg_resetxlog.o pg_resetxlog.c gcc -O2 -Wall -Wmissing-prototypes -Wmissing-declarations pg_resetxlog.o pg_crc.o -Wl,-rpath,/usr/local/pgsql/lib -lz -lcrypt -lresolv -lnsl -ldl -lm -lbsd -o pg_resetxlog /usr/bin/ld: cannot find -lbsd collect2: ld returned 1 exit status make: *** [pg_resetxlog] Error 1 And even I chmod 777 pg_resetxlog, and try ./pg_resetxlog -f $PGDATA, I get an error "bash: ./pg_resetxlog.o: cannot execute binary file" Please, what can I do ??? regards, tulio oliveira -- Tulio Oliveira Akácia Tecnologia www.akacia.com.br tulio@akacia.com.br
Tulio Oliveira <tulio@marilia.com> writes: > gcc -O2 -Wall -Wmissing-prototypes -Wmissing-declarations > -I../../src/include > -c -o pg_resetxlog.o pg_resetxlog.c > gcc -O2 -Wall -Wmissing-prototypes -Wmissing-declarations pg_resetxlog.o > pg_crc.o -Wl,-rpath,/usr/local/pgsql/lib -lz -lcrypt -lresolv -lnsl > -ldl -lm -lbsd -o pg_resetxlog > /usr/bin/ld: cannot find -lbsd > collect2: ld returned 1 exit status > make: *** [pg_resetxlog] Error 1 Hmm, did you run configure yourself, or are you using configure data out of an RPM? Configure should not have added -lbsd to the compile switches if you don't have it available. regards, tom lane
Tom Lane wrote: > > Tulio Oliveira <tulio@marilia.com> writes: > > gcc -O2 -Wall -Wmissing-prototypes -Wmissing-declarations > > -I../../src/include > > -c -o pg_resetxlog.o pg_resetxlog.c > > gcc -O2 -Wall -Wmissing-prototypes -Wmissing-declarations pg_resetxlog.o > > pg_crc.o -Wl,-rpath,/usr/local/pgsql/lib -lz -lcrypt -lresolv -lnsl > > -ldl -lm -lbsd -o pg_resetxlog > > /usr/bin/ld: cannot find -lbsd > > collect2: ld returned 1 exit status > > make: *** [pg_resetxlog] Error 1 > > Hmm, did you run configure yourself, or are you using configure data > out of an RPM? Configure should not have added -lbsd to the compile > switches if you don't have it available. > > regards, tom lane Yeah, I run configure by myself... But I download the lastest PostgreSQL version 7.1.1 and with this I can compile the pg_resetxlog... Then I ran it over my $PGDATA directory with 4.5Gb of data. But then, all data lost. When I "psql dbtest" and type \d, I can't see any tables in there... I try many times, and nothing... I have the demaged 4.5Gb backup, but is not a good idea restore the one-day last backup... Please, anyone can help-me by TELNET ??? Tulio Oliveira ICQ# 11530810 regards, -- Um velho homem sábio disse uma vez: "Quando você atualiza um exploit, você é bom. Quando você é o primeiro a hackear cada sucessiva versão de um produto que roda em milhões de computadores pela Internet, você cria uma Dinastia".
Tulio Oliveira <mestredosmagos@marilia.com> writes: > Yeah, I run configure by myself... But I download the lastest PostgreSQL > version 7.1.1 and with this I can compile the pg_resetxlog... Then I ran > it over my $PGDATA directory with 4.5Gb of data. > But then, all data lost. When I "psql dbtest" and type \d, I can't see > any tables in there... Hm. Try tweaking pg_resetxlog to insert a really large "next transaction number" in the -f case, say about 2 billion instead of the rather silly 514 it's using now (there are two places to change, look for XXX comments). regards, tom lane
Tom Lane wrote: > > Tulio Oliveira <mestredosmagos@marilia.com> writes: > > I just lost the pg_control file, located in /usr/local/pgsql/data/global > > How did that happen? > > > I start a new INITDB after rename the PG_DATA directory to another name, > > but if I copy the pg_control file to real data directory, I receive a > > "NO FILE POINTER ERROR"... > > I think you could recover by copying in a freshly-initialized pg_control > (be sure you make it with the same locale setting as before!) and then > running the pg_resetxlog utility from contrib. You'll probably have to > use the -f switch to pg_resetxlog ... read its README file! > > Once you get the postmaster to start, do NOT make any changes to the > database, or you will be very sorry :-(. Run pg_dumpall, then reload > the data into a correctly initialized database. > > regards, tom lane > > ---------------------------(end of broadcast)--------------------------- > TIP 6: Have you searched our list archives? > > http://www.postgresql.org/search.mpl Thanks, Tom Lane, But I can't compile the pg_resetxlog !!! in /usr/src/postgresql-7.1rc4/contrib/pg_resetxlog directory, I typed "make" and the result is: gcc -O2 -Wall -Wmissing-prototypes -Wmissing-declarations -I../../src/include -c -o pg_resetxlog.o pg_resetxlog.c gcc -O2 -Wall -Wmissing-prototypes -Wmissing-declarations pg_resetxlog.o pg_crc.o -Wl,-rpath,/usr/local/pgsql/lib -lz -lcrypt -lresolv -lnsl -ldl -lm -lbsd -o pg_resetxlog /usr/bin/ld: cannot find -lbsd collect2: ld returned 1 exit status make: *** [pg_resetxlog] Error 1 And even I chmod 777 pg_resetxlog, and try ./pg_resetxlog -f $PGDATA, I get an error "bash: ./pg_resetxlog.o: cannot execute binary file" Please, what can I do ??? regards, tulio oliveira -- Tulio Oliveira Akácia Tecnologia www.akacia.com.br tulio@akacia.com.br