I lost the pg_control file

Started by Tulio Oliveiraalmost 25 years ago7 messagesgeneral
Jump to latest
#1Tulio Oliveira
mestredosmagos@marilia.com

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

#2Tom Lane
tgl@sss.pgh.pa.us
In reply to: Tulio Oliveira (#1)
Re: I lost the pg_control file

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

#3Tulio Oliveira
tulio@marilia.com
In reply to: Tulio Oliveira (#1)
Re: I lost the pg_control file

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

#4Tulio Oliveira
mestredosmagos@marilia.com
In reply to: Tulio Oliveira (#3)
Re: I lost the pg_control file

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

#5Tom Lane
tgl@sss.pgh.pa.us
In reply to: Tulio Oliveira (#3)
Re: I lost the pg_control file

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

#6Tulio Oliveira
mestredosmagos@marilia.com
In reply to: Tulio Oliveira (#1)
Re: I lost the pg_control file

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".

#7Tom Lane
tgl@sss.pgh.pa.us
In reply to: Tulio Oliveira (#6)
Re: I lost the pg_control file

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