Dear Laurenz, Thank you very much for the idea. We ran pg_rewind correctly:
[postgres@gacsdb05 data-13.3]$ pg_rewind -c -R --target-pgdata=/PostgresDB/sas_hdd/data-13.3/ --source-server="host=XXXX port=XXXX user=postgres password=XXX" pg_rewind: source and target cluster are on the same timeline pg_rewind: no rewind required but then we got the following error: [2022-11-07 22:57:55 CET-]LOG: starting PostgreSQL 13.3 on x86_64-pc-linux-gnu, compiled by gcc (GCC) 8.5.0 20210514 (Red Hat 8.5.0-10), 64-bit [2022-11-07 22:57:55 CET-]LOG: listening on IPv4 address "0.0.0.0", port XXXX [2022-11-07 22:57:55 CET-]LOG: could not create IPv6 socket for address "::": Address family not supported by protocol [2022-11-07 22:57:55 CET-]LOG: listening on Unix socket "/tmp/.s.PGSQL.XXXX" [2022-11-07 22:57:55 CET-]LOG: database system was shut down in recovery at 2022-11-07 22:57:47 CET [2022-11-07 22:57:55 CET-]LOG: restored log file "00000003.history" from archive cp: cannot stat '/PostgresWalLogArchive/new/00000004.history': No such file or directory [2022-11-07 22:57:55 CET-]LOG: entering standby mode [2022-11-07 22:57:55 CET-]LOG: restored log file "00000003.history" from archive [2022-11-07 22:57:55 CET-]LOG: invalid primary checkpoint record [2022-11-07 22:57:55 CET-]PANIC: could not locate a valid checkpoint record [2022-11-07 22:57:55 CET-]LOG: startup process (PID 3011860) was terminated by signal 6: Aborted [2022-11-07 22:57:55 CET-]LOG: aborting startup due to startup process failure [2022-11-07 22:57:55 CET-]LOG: database system is shut down We have read we can run pg_resetwal but the Wal folder is the folder where the Wals are archived in the primary. Would that be correct to reset them? Any suggestion? Thank you so much, Pilar El lun, 7 nov 2022 a las 12:21, Laurenz Albe (<laurenz.a...@cybertec.at>) escribió: > On Mon, 2022-11-07 at 11:02 +0100, Pilar de Teodoro wrote: > > We have a very large database of 37TB and we had to promote our standby > to primary due to > > some disk failures. Now the issues are solved, we would like to make > standby the old primary > > from a copy of the new primary which is already in place. Is it > possible without using pg_basebackup? > > That's exactly what "pg_rewind" is for. It is a fast version of > "pg_basebackup" for exactly > that case. > > Yours, > Laurenz Albe > -- > Cybertec | https://www.cybertec-postgresql.com >