Re: Restoring database from false update - Mailing list pgsql-general

From David G. Johnston
Subject Re: Restoring database from false update
Date
Msg-id CAKFQuwZqNw0zMRiNTqJ2pxsshxVG9no0XpMHLW07MeJC6w0f6g@mail.gmail.com
Whole thread Raw
In response to Restoring database from false update  (Maksim Fomin <maxim@fomin.one>)
Responses Restoring database from false update  (Maksim Fomin <maxim@fomin.one>)
List pgsql-general
On Fri, Nov 13, 2020 at 1:56 PM Maksim Fomin <maxim@fomin.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.

pgsql-general by date:

Previous
From: "David G. Johnston"
Date:
Subject: Re: New "function tables" in V13 documentation
Next
From: "David G. Johnston"
Date:
Subject: Re: Range partitioning and overlap