Обсуждение: Restoreing from a Unix TAR backup of data directory...
I'm using BSDI 4.0, intel x86: I have a backup of my /usr/local/pgsql/data directory (and all sub dirs) made using the Unix TAR command while the database was not active. At the time, I was using Postgresql version 6.1. I now need to restore from this backup. I've obtained (thanks the the help of various people on this mailing list) a copy of PG version 6.1, and PG version 6.1.1. I installed Postgresql on my system, and then did a "tar -xvpf backupfilename.tar" command to overwrite the "data" directory with my data. However, this did not allow me to access the data. Every time I attempt to start a PSQL session, I get the following message: -----cut----- Connection to database 'billing' failed. PQexec() -- Request was sent to backend, but backend closed the channel before r esponding. This probably means the backend terminated abnormally before or whil e processing the request. -----cut---- I traced the problem down to the postgres session that the postmaster started up, and I ran one on it's own: -------cut--------- fnord:/usr/local/pgsql/bin $ postgres -d9 -o debug.txt -D /usr/local/pgsql/data billing ---debug info--- Quiet = f Noversion = f stable = f timings = f dates = Normal bufsize = 64 query echo = f multiplexed backend? = f DatabaseName = [billing] ---------------- InitPostgres().. Segmentation fault ----cut------ (Note: At the end of this run, the debug.txt file was empty) If I install the PG version 6.1 (or 6.1.1) and do a initdb, and then attempt to access the default (template1) db, everything works just fine. (Instead of a Segmentation fault, I get: ------cut---- POSTGRES backend interactive interface $Revision: 1.33 $ $Date: 1997/04/24 03:39:09 $ ------cut---- and I can use the database system without any problems, but it doesn't help me get to my backed up data) I have tried to also issue a "create database billing" command in the template1 database, and THEN overwrite ONLY the "/usr/local/pgsql/data/base/billing" dirctory with my backed up data. In this case, I could use the psql session to connect to the "template1" database, but I got the same problem detailed above when I tried to connect to the "billing" database. The PG_VERSION files from my backups say "6.1" as well as the PG_VERSION files from the PG 6.1 and PG 6.1.1 installations. So, my questions are: a) Does anybody know why my backed up data is causing the postgres process to do a seg fault when it tries to read it? b) Anybody know how to fix it? c) Lacking that ability, is there a way to extract the raw data from the backed up database files without using the postgres engine? Thanks, Jay W. Summet
I'm going to make your day here, but you might not, in fact, have v6.1 databases...they might be newer then that :( When we were just starting out, we hadn't perfected everything, and, in some releases, failed up to update the PG_VERSION data :( Last night, talking with a friend of mine, I clued into the fact that we do do branches on the CVS repository *d'oh* ... the problem is that I have pre-6.0 and 6.3+ branches only...its only something we just started doing... I'm trying to pull out a v6.3 source tree right now, and will email you once its available...if I'm right, this *might* help you. Don't hold your breath, but its an attempt ... On Tue, 16 Mar 1999, Jay W. Summet wrote: > I'm using BSDI 4.0, intel x86: > > I have a backup of my /usr/local/pgsql/data directory (and all sub > dirs) made using the Unix TAR command while the database was not > active. > > At the time, I was using Postgresql version 6.1. I now need to > restore from this backup. I've obtained (thanks the the help of > various people on this mailing list) a copy of PG version 6.1, and PG > version 6.1.1. > > I installed Postgresql on my system, and then did a "tar -xvpf > backupfilename.tar" command to overwrite the "data" directory with my > data. However, this did not allow me to access the data. > > Every time I attempt to start a PSQL session, I get the following > message: > -----cut----- > Connection to database 'billing' failed. > PQexec() -- Request was sent to backend, but backend closed the > channel before r esponding. This probably means the backend > terminated abnormally before or whil e processing the request. > -----cut---- > > > I traced the problem down to the postgres session that the postmaster > started up, and I ran one on it's own: > -------cut--------- > fnord:/usr/local/pgsql/bin $ postgres -d9 -o debug.txt > -D /usr/local/pgsql/data billing > ---debug info--- > Quiet = f > Noversion = f > stable = f > timings = f > dates = Normal > bufsize = 64 > query echo = f > multiplexed backend? = f > DatabaseName = [billing] > ---------------- > > InitPostgres().. > Segmentation fault > ----cut------ > (Note: At the end of this run, the debug.txt file was empty) > > If I install the PG version 6.1 (or 6.1.1) and do a initdb, and then > attempt to access the default (template1) db, everything works just > fine. (Instead of a Segmentation fault, I get: > ------cut---- > POSTGRES backend interactive interface > $Revision: 1.33 $ $Date: 1997/04/24 03:39:09 $ > ------cut---- > and I can use the database system without any problems, but > it doesn't help me get to my backed up data) > > I have tried to also issue a "create database billing" command > in the template1 database, and THEN overwrite ONLY the > "/usr/local/pgsql/data/base/billing" dirctory with my backed up data. > > In this case, I could use the psql session to connect to the > "template1" database, but I got the same problem detailed above when > I tried to connect to the "billing" database. > > The PG_VERSION files from my backups say "6.1" as well as the > PG_VERSION files from the PG 6.1 and PG 6.1.1 installations. > > > So, my questions are: > a) Does anybody know why my backed up data is causing the postgres > process to do a seg fault when it tries to read it? > b) Anybody know how to fix it? > c) Lacking that ability, is there a way to extract the raw data from > the backed up database files without using the postgres engine? > > Thanks, > Jay W. Summet > Marc G. Fournier ICQ#7615664 IRC Nick: Scrappy Systems Administrator @ hub.org primary: scrappy@hub.org secondary: scrappy@{freebsd|postgresql}.org
> > I'm going to make your day here, but you might not, in fact, have v6.1 > databases...they might be newer then that :( > > When we were just starting out, we hadn't perfected everything, and, in > some releases, failed up to update the PG_VERSION data :( > > Last night, talking with a friend of mine, I clued into the fact that we > do do branches on the CVS repository *d'oh* ... the problem is that I have > pre-6.0 and 6.3+ branches only...its only something we just started > doing... > > I'm trying to pull out a v6.3 source tree right now, and will email you > once its available...if I'm right, this *might* help you. Don't hold your > breath, but its an attempt ... I am dying here too. I do remember 6.? not updating PG_VERSION. My guess now, as Marc has suspected, is that he is running 6.2.*. -- Bruce Momjian | http://www.op.net/~candle maillist@candle.pha.pa.us | (610) 853-3000 + If your life is a hard drive, | 830 Blythe Avenue + Christ can be your backup. | Drexel Hill, Pennsylvania 19026