Re: HELP! Uninstalled wrong version of postgres

From: Leonardo M(dot) Ramé <l(dot)rame(at)griensu(dot)com>
To: pgsql-general(at)postgresql(dot)org
Subject: Re: HELP! Uninstalled wrong version of postgres
Date: 2016-03-25 23:38:01
Message-ID: 56F5CBD9.6060901@griensu.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

El 24/03/16 a las 14:19, Howard News escribió:
> Hi,
>
> I uninstalled the wrong version of postgres on Ubuntu using apt-get
> remove postgresql-9.0, convinced that this was an old unused version.
> You guess the rest...
>
> The data files still appear to be there, all 485GB of them. Can these be
> restored?
>
> Thanks.
>

Ok, if the data files are still there I'd do this:

1) Assuming the data is in /var/lib/postgresql/9.0, rename that
directory to /var/lib/9.0-old, AND COPY THAT DIRECTORY ELSEWHERE.
2) Reinstall 9.0 with "apt-get install postgresql-9.0". This should
re-create the /var/lib/9.0 directory with an empty "main" dir.
3) Stop 9.0 with "pg_ctlcluster 9.0 main stop".
4) Rename the new directory /var/lib/9.0 to /var/lib/9.0-new
5) Rename the old dir (/var/lib/9.0-old) to /var/lib/9.0
6) Restart the cluster with "pg_ctlcluster 9.0 main start".

And everything should be fine again.

P.S.: All those steps should be done as root.

Regards,
--
Leonardo M. Ramé
http://leonardorame.blogspot.com

In response to

Browse pgsql-general by date

  From Date Subject
Next Message Albe Laurenz 2016-03-26 08:43:22 Re: PostgreSQL advocacy
Previous Message Mark Morgan Lloyd 2016-03-25 23:32:49 Re: PostgreSQL advocacy