Re: HELP! Uninstalled wrong version of postgres - Mailing list pgsql-general

From Leonardo M. Ramé
Subject Re: HELP! Uninstalled wrong version of postgres
Date
Msg-id 56F5CBD9.6060901@griensu.com
Whole thread Raw
In response to HELP! Uninstalled wrong version of postgres  (Howard News <howardnews@selestial.com>)
List 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


pgsql-general by date:

Previous
From: Mark Morgan Lloyd
Date:
Subject: Re: PostgreSQL advocacy
Next
From: Jerry Sievers
Date:
Subject: Pg-Logical output pkg; can't install 9.4 and 9.5 on same Wheezy box