Re: Restoring database from false update

From: "David G(dot) Johnston" <david(dot)g(dot)johnston(at)gmail(dot)com>
To: Maksim Fomin <maxim(at)fomin(dot)one>
Cc: "pgsql-general(at)postgresql(dot)org" <pgsql-general(at)postgresql(dot)org>
Subject: Re: Restoring database from false update
Date: 2020-11-15 04:47:12
Message-ID: CAKFQuwZqNw0zMRiNTqJ2pxsshxVG9no0XpMHLW07MeJC6w0f6g@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

On Fri, Nov 13, 2020 at 1:56 PM Maksim Fomin <maxim(at)fomin(dot)one> wrote:

> Later, I stopped the service and moved backup folder to the usual place.
> For some reason psql shows that there are no relations found in the
> database, although the database is listed. My next step was to copy data
> from file-system level backup (about 4-5 days ago) but the result was the
> same.
>
> How I can restore the database?
>

Assuming you have a complete and valid v12 data directory backup created
from a shutdown server, and containing good WAL files...and that the server
is presently running a v12 instance of PostgreSQL you are able to connect
to using psql.

What do the following show?

select version();
show data_directory;

Assuming that the version is 12.x you want to ensure that your data
directory backup replaces the entire contents of wherever data_directory is
pointing (while the PostgreSQL process is stopped).

Having done that, and starting the server back up, you should find the old
cluster to have been restored.

If that doesn't work:

Reviewing log files can help.

If you can report the startup command that is run to launch the postgres
process that would help too.

Showing before and after directory structures can help.

David J.

In response to

Responses

Browse pgsql-general by date

  From Date Subject
Next Message David G. Johnston 2020-11-15 04:53:28 Re: Range partitioning and overlap
Previous Message David G. Johnston 2020-11-15 04:24:59 Re: New "function tables" in V13 documentation