FATAL error after a system crash

Lists: pgsql-general
From: Feng-Cheng Chang <breeze(at)alumni(dot)nctu(dot)edu(dot)tw>
To: pgsql-general(at)postgresql(dot)org
Subject: FATAL error after a system crash
Date: 2002-05-04 06:33:25
Message-ID: 3CD380B5.9020708@alumni.nctu.edu.tw
Views: Raw Message | Whole Thread | Download mbox | Resend email
Lists: pgsql-general

Hello everybody,

My system crashed two days ago. After the system restarted, the
postmaseter also started without any error messages. The problem happens
when I try to
connect to the database using either psql or JDBC, it says

"FATAL 1: cannot open pg_variable: no such file or directory"

and terminates the connection.

Is there any chance to recover the database to a "workable" state?
Because I forgot to backup for a few weeks, the latest dump is
quite out-of-date :(
Frankly speaking, I have no idea about where the problem is.
Hope this is not really a "fatal" crash.

Would any kind people here help me to recover the DB?
If the data are corrupted and the database should be re-initialized,
is there any method to retrieve as much data as possible from the old
repository files?

P.S.
My system configuration:
Win2k server
cygwin + postgresql 7.1.3

Thank you very much!!

Feng-Chang Chang


From: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
To: Feng-Cheng Chang <breeze(at)alumni(dot)nctu(dot)edu(dot)tw>
Cc: pgsql-general(at)postgresql(dot)org
Subject: Re: FATAL error after a system crash
Date: 2002-05-06 14:04:56
Message-ID: 5069.1020693896@sss.pgh.pa.us
Views: Raw Message | Whole Thread | Download mbox | Resend email
Lists: pgsql-general

Feng-Cheng Chang <breeze(at)alumni(dot)nctu(dot)edu(dot)tw> writes:
> when I try to
> connect to the database using either psql or JDBC, it says
> "FATAL 1: cannot open pg_variable: no such file or directory"
> and terminates the connection.

Well, if that's the only problem, you got (very) lucky. 7.1.* doesn't
actually use pg_variable, but there is still vestigial code in it that
tries to open that file during startup. All you need is an empty file
of the right name, so try

touch $PGDATA/global/1264

But I fear that'll just let you get to the next problem :-(. If Windoze
managed to lose that file, it probably managed to lose other stuff too.
If it does seem to start up okay, I'd recommend trying to do pg_dumpall,
and then initdb and reload if the dump process doesn't show errors.

> P.S.
> My system configuration:
> Win2k server
> cygwin + postgresql 7.1.3

This is not a production-grade setup IMHO. If you don't want to run
a real OS to put Postgres on top of, you'd better be a lot more
religious about backing up.

regards, tom lane


From: Feng-Cheng Chang <breeze(at)alumni(dot)nctu(dot)edu(dot)tw>
To: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
Cc: pgsql-general(at)postgresql(dot)org
Subject: Re: FATAL error after a system crash
Date: 2002-05-06 16:03:27
Message-ID: 3CD6A94F.4010408@alumni.nctu.edu.tw
Views: Raw Message | Whole Thread | Download mbox | Resend email
Lists: pgsql-general

Tom Lane wrote:

>Feng-Cheng Chang <breeze(at)alumni(dot)nctu(dot)edu(dot)tw> writes:
>
>
>>"FATAL 1: cannot open pg_variable: no such file or directory"
>>and terminates the connection.
>>
>>
>
>Well, if that's the only problem, you got (very) lucky. 7.1.* doesn't
>actually use pg_variable, but there is still vestigial code in it that
>tries to open that file during startup. All you need is an empty file
>of the right name, so try
>
> touch $PGDATA/global/1264
>
>But I fear that'll just let you get to the next problem :-(. If Windoze
>managed to lose that file, it probably managed to lose other stuff too.
>If it does seem to start up okay, I'd recommend trying to do pg_dumpall,
>and then initdb and reload if the dump process doesn't show errors.
>
Things went like what you said....
I started postmaster and connected to it using psql without error
messages. When I tried to pg_dumpall or pg_dump, the message "cannot
open pg_inherits: no such file or directory" appeared. Although I
couldn't dump the database, I use SQL COPY to save all needed tables to
files :-D After the table-by-table recovery, my application was back!

Thank you for your great help :-)

>>Win2k server
>>cygwin + postgresql 7.1.3
>>
>>
>
>This is not a production-grade setup IMHO. If you don't want to run
>a real OS to put Postgres on top of, you'd better be a lot more
>religious about backing up.
>
I don't think it is a good setup, either. If I had a spare machine, I
would like to install a UNIX-like system and move my application to it.
Anyway, thank you for your suggestion. I'll never forget to backup
periodically :-)

--
Feng-Cheng Chang (張 峰 誠)
Ph.D. Student of
Communication Electronics & Signal Processing Laboratory,
Institute of Electronics, NCTU, Taiwan, R.O.C.
E-mail: fcchang(dot)ee88g(at)nctu(dot)edu(dot)tw