Thread: Need help to restore database
Hi all,
we are facing with a struggle problem with PostgreSql database production.
A client system based on pgsql is down because the database raise an error message like “ no left space on device”. We have deleted some log files on this machine and after a system restart the db (and the system) was up&running. After two days the database has crashed again. Looking the postgres log there was an error on xlog file (I have inspected the directory pg_xlog and no files I found it). I’ll try to re-build the xlog file with pg_resetxlog. The utilities has created a new xlog file, the postmaster process run, but any command pg_dump, etc I try to execute failed. The system respond that there are not database in the system. Can anyone help us ?
Thanks in advance
Giancarlo
On Tue, 17 Mar 2009 09:50:55 +0100, "Lori, Giancarlo" <giancarlo.lori@eds.com> wrote: > Hi all, > we are facing with a struggle problem with PostgreSql database > production. > A client system based on pgsql is down because the database raise an > error message like " no left space on device". We have deleted some log > files on this machine and after a system restart the db (and the system) > was up&running. After two days the database has crashed again. Looking > the postgres log there was an error on xlog file (I have inspected the > directory pg_xlog and no files I found it). I'll try to re-build the > xlog file with pg_resetxlog. The utilities has created a new xlog file, > the postmaster process run, but any command pg_dump, etc I try to > execute failed. The system respond that there are not database in the > system. Can anyone help us ? > > Thanks in advance > Giancarlo Maybe it's not good idea, but... First - stop the postgreSQL service. Make the copy of Your database cluster and existing tablespaces. Try to run a standalone backend instead normal PostgreSQL, giving for switch -P name of database "postgres". You can run it like this (if Your system user, who usually rruns postgresql service is named "postgres" - when not, use for "su the proper account name": su postgres -c "/usr/local/pgsql/bin/postgres -D /home/postgres/bazy -O -P postgres" In "standalone backend" You can run SQL commands - run VACUUM FULL. Press Ctrl+D to leave the standalone backend. Repeat this all for Your database and other, wchich are listed for VACUUM, when standalone backend starts. Read about "standalone backend" in the PostgreSQL documenatation. If You running PostgreSQL on Windows server, use runas with its specific options instead su, of course. Brgds Adam
Lori, Giancarlo wrote: > A client system based on pgsql is down because the database raise an > error message like " no left space on device". We have deleted some log > files on this machine and after a system restart the db (and the system) > was up&running. After two days the database has crashed again. Looking > the postgres log there was an error on xlog file (I have inspected the > directory pg_xlog and no files I found it). I'll try to re-build the > xlog file with pg_resetxlog. The utilities has created a new xlog file, > the postmaster process run, but any command pg_dump, etc I try to > execute failed. The system respond that there are not database in the > system. Looks like somebody deleted critical files to get some space back. > Can anyone help us ? Find the most recent backup ... -- Alvaro Herrera http://www.CommandPrompt.com/ The PostgreSQL Company - Command Prompt, Inc.
On Tue, Mar 17, 2009 at 12:01:01PM +0100, adamr@informatyka.gdansk.pl wrote: > On Tue, 17 Mar 2009 09:50:55 +0100, "Lori, Giancarlo" > <giancarlo.lori@eds.com> wrote: > > the postmaster process run, but any command pg_dump, etc I try to > > execute failed. The system respond that there are not database in the > > system. Can anyone help us ? I'm no expert, the quiet from the pros is deafening to me. What does the postmaster log say when you start up? What is the exact error msg that you refer to as "there are not database in the system?" What does the \l meta-command say, anything like this: template1=# \l List of databases Name | Owner | Encoding -------------+---------+---------- postgres | pgadmin | UTF8 template0 | pgadmin | UTF8 template1 | pgadmin | UTF8 (3 rows)
On Tue, 2009-03-17 at 09:50 +0100, Lori, Giancarlo wrote: > we are facing with a struggle problem with PostgreSql database > production. > > A client system based on pgsql is down because the database raise an > error message like “ no left space on device”. We have deleted some > log files on this machine and after a system restart the db (and the > system) was up&running. After two days the database has crashed again. > Looking the postgres log there was an error on xlog file (I have > inspected the directory pg_xlog and no files I found it). I’ll try to > re-build the xlog file with pg_resetxlog. The utilities has created a > new xlog file, the postmaster process run, but any command pg_dump, > etc I try to execute failed. The system respond that there are not > database in the system. Can anyone help us ? 2ndQuadrant has a lot of experience with helping people out with problems like this, including data recovery from damaged databases. Please let us know if we can be of any help. Apologies for mentioning commercial matters on list, though this work helps fund further developments in this area. -- Simon Riggs www.2ndQuadrant.com PostgreSQL Training, Services and Support
Thanks to all, I have solved, I have been able to restart the Postgres db, and then after a pg-dump I have created a newone. Thanks again -----Messaggio originale----- Da: Simon Riggs [mailto:simon@2ndQuadrant.com] Inviato: martedì 17 marzo 2009 15.10 A: Lori, Giancarlo Cc: pgsql-admin@postgresql.org Oggetto: Re: [ADMIN] Need help to restore database On Tue, 2009-03-17 at 09:50 +0100, Lori, Giancarlo wrote: > we are facing with a struggle problem with PostgreSql database > production. > > A client system based on pgsql is down because the database raise an > error message like “ no left space on device”. We have deleted some > log files on this machine and after a system restart the db (and the > system) was up&running. After two days the database has crashed again. > Looking the postgres log there was an error on xlog file (I have > inspected the directory pg_xlog and no files I found it). I’ll try to > re-build the xlog file with pg_resetxlog. The utilities has created a > new xlog file, the postmaster process run, but any command pg_dump, > etc I try to execute failed. The system respond that there are not > database in the system. Can anyone help us ? 2ndQuadrant has a lot of experience with helping people out with problems like this, including data recovery from damaged databases. Please let us know if we can be of any help. Apologies for mentioning commercial matters on list, though this work helps fund further developments in this area. -- Simon Riggs www.2ndQuadrant.com PostgreSQL Training, Services and Support
On Tue, Mar 17, 2009 at 03:27:42PM +0100, Lori, Giancarlo wrote: > Thanks to all, I have solved, I have been able to restart the Postgres db, and then after a pg-dump I have created a newone. > Thanks again I'd like to learn from your experience. Perhaps you would be willing to expand on the events and your actions.