0

I'm doing PITR with below settings and getting error as below.

archive_command = 'test ! -f /usr/wal_archive/%f && cp %p /usr/wal_archive/%f'
restore_command = 'cp /usr/wal_archive/%f "%p"'
recovery_target_time = '2020-12-09 15:20:00.0'
recovery_target_timeline = 'latest'

Error:

2020-12-09 17:43:43.029 IST [39613] LOG:  invalid checkpoint record
2020-12-09 17:43:43.029 IST [39613] FATAL:  could not locate required checkpoint record
2020-12-09 17:43:43.029 IST [39613] HINT:  If you are restoring from a backup, touch "/var/lib/postgresql/12/main/recovery.signal" and add required recovery options.   If you are not restoring from a backup, try removing the file "/var/lib/postgresql/12/main/backup_label".   Be careful: removing "/var/lib/postgresql/12/main/backup_label" will result in a corrupt cluster if restoring from a backup.
2020-12-09 17:43:43.030 IST [39612] LOG:  startup process (PID 39613) exited with exit code 1
2020-12-09 17:43:43.030 IST [39612] LOG:  aborting startup due to startup process failure
2020-12-09 17:43:43.031 IST [39612] LOG:  database system is shut down pg_ctl: could not start server Examine the log output.`

Any hint?

Laurenz Albe
  • 209,280
  • 17
  • 206
  • 263
Darshan Shah
  • 157
  • 1
  • 1
  • 15

1 Answers1

1

Why do people read blogs if all is spelled out in the documentation?

  1. Set recovery configuration settings in postgresql.conf (see Section 19.5.4) and create a file recovery.signal in the cluster data directory. You might also want to temporarily modify pg_hba.conf to prevent ordinary users from connecting until you are sure the recovery was successful.
Laurenz Albe
  • 209,280
  • 17
  • 206
  • 263
  • Hello Laurenz Albe, My PITR process works but I can not restore data at particular time. Do I need to give time in UTC time or I can give my local machine/server time ? – Darshan Shah Dec 11 '20 at 06:44
  • You can specify a time zone explicitly. If, you don't, the `timezone` setting will be used. – Laurenz Albe Dec 11 '20 at 06:59
  • Thanks Laurenz, After giving recovery_target_time in below format and it worked. "2020-12-11 14:34:28.833347+05:30" – Darshan Shah Dec 11 '20 at 09:05