Thread: How can i keep my databases when installing PostgreSQL ?

How can i keep my databases when installing PostgreSQL ?

From
Josef Springer
Date:
Hello everybody,<br /><br /> i must reinstall PostgreSQL, because the installed server does not work anymore. Because
oflost disk sectors the server can not be started in the system-services GUI. The result of the starting request is<br
/>"Fehler 1053 Der Dienst antwortet nicht auf die Start oder Steueranweisung"<br /><br /> What is the doing to preserve
existingdatabases, when reinstalling PostgreSQL ?<br /><br /> Can anybody help me ?<br /><br /> Best regards,<br /><div
class="moz-signature"></div><p>JosefSpringer<br /><br /> 

Re: How can i keep my databases when installing PostgreSQL ?

From
Kevin Grittner
Date:
Josef Springer <Josef.Springer@joops.com> wrote:

> i must reinstall PostgreSQL, because the installed server does not
>    work anymore. Because of lost disk sectors the server can not be
>    started in the system-services GUI. The result of the starting
>    request is
> "Fehler 1053 Der Dienst antwortet nicht auf die Start oder
>     Steueranweisung"
>
> What is the doing to preserve existing databases, when reinstalling
>     PostgreSQL ?

First, copy the data directory tree to some safe medium.

https://wiki.postgresql.org/wiki/Corruption

The exact steps required after installing new software are going to
vary somewhat depending on the OS and the installer used.  Once the
software is there you will either need to set up a service script
pointing to the data directory or copy the data directory in place
of what the installer sets up.

Once you are able to start the database service, I would recommend
that you immediately pg_dump of all databases and restore them to a
freshly created cluster.  I would only put that new cluster on the
old machine if I was confident that the cause of the storage
failure had been found and fixed.

--
Kevin Grittner
EDB: http://www.enterprisedb.com
The Enterprise PostgreSQL Company