RE: How to restore database to previous state

From: "Ahmed, Nawaz (Fuji Xerox Australia)" <Nawaz(dot)Ahmed(at)aus(dot)fujixerox(dot)com>
To: Andrus <kobruleht2(at)hot(dot)ee>, pgsql-general <pgsql-general(at)postgresql(dot)org>
Subject: RE: How to restore database to previous state
Date: 2020-05-10 23:29:50
Message-ID: SG2PR06MB2203AB733B798971A11112BBBCA00@SG2PR06MB2203.apcprd06.prod.outlook.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

Hi,

Have you looked at the recovery parameter as below ?

recovery_target_time

Using this, you could achieve a PITR of the current database. If the recovery requires WAL that does not exist on disk then you may have to restore it from previous night's backup.

Please have a look at the docs for other such recovery parameters: https://www.postgresql.org/docs/12/runtime-config-wal.html

Regards,
Nawaz

-----Original Message-----
From: Andrus <kobruleht2(at)hot(dot)ee>
Sent: Monday, 11 May 2020 7:43 AM
To: pgsql-general <pgsql-general(at)postgresql(dot)org>
Subject: How to restore database to previous state

Hi!

Postgres 12 database is runing on Debian

max_wal_size = 5GB

is specified in postgres.conf file

How to restore database to some previous state, e.q. before important data was accidently deleted.

Binary asynchrunous replication with slot is also used.

I looks like it is possible to create standby server which replicates changes using 24 hour delay and data directory backups in every night.
However this requires separate delayed standby server .
Is there simpler solution, e.q reverse playback of wal segments starting from current data directory contents.

Andrus.

IMPORTANT NOTE: Fuji Xerox email transmission, including any attachments, is private and confidential and may contain legally privileged information. It is for the addressee's attention only. If you are not the intended recipient and have received this transmission, you must not use, edit, print, copy or disclose its contents to any person or disseminate the information contained herein or hereto attached, and you must notify sender immediately by return email and delete this transmission from your system. Any confidentiality, privilege or copyright is not waived or lost because this e-mail has been sent to you in error. We have used reasonable efforts to protect this transmission from computer viruses and other malicious software, but no warranty is made and the sender takes no responsibility for any loss or damage incurred from using this email or the information contained in this email.

In response to

Browse pgsql-general by date

  From Date Subject
Next Message David G. Johnston 2020-05-11 00:25:41 Re: How to restore database to previous state
Previous Message Andrus 2020-05-10 21:43:05 How to restore database to previous state