Pgbackrest Restore and Restore Delta

Hello, I will tell you about restore and restore delta on pgbackrest.

The normal restore command returns to the data path you specified. Restore –delta, on the other hand, restores the data path you gave from scratch on a different home.

All operations must be done with the postgres user.

cat /etc/pgbackrest.conf

pgbackrest info

pgbackrest archive-get --stanza=testdb

After doing the pre-run checks, we should get the –stanza name from pgbackrest.conf.
In addition, before the backup-restore we made, the existing DB can be backed up as dumpall.

pg_dump  testdb -f backup.sql
pg_dumpall -f backup_all.sql

It can be used for post-restore control by creating a table.

Even if the DATA folder cannot be completely backed up, files such as postgres.conf and pg_hba MUST be backed up.


mv /postgres/data /postgres/data_old

mkdir /postgres/data

pg_ctl stop -D /postgres/data

pgbackrest --stanza=testdb-int --log-level-console=info --type=time "--target=2021-07-07 08:00:00.024378+01" --db-path=/postgres/data2/ restore

The pg_hba.conf content is updated after restoration.

mv /postgres/data/pg_hba.conf /postgres/data/pg_hba_07072021.conf

cp /postgres/data_07072021/pg_hba.conf /postgres/data/pg_hba.conf

pg_ctl start -D /postgres/data
pg_ctl reload -D /postgres/data



We are returning the database on a different path

pgbackrest --stanza=testdb --log-level-console=info --type=time "--target=2021-07-07 08:00:00.024378+01" --db-path=/postgres/data2 restore --delta

We are changing the port via postgresql.conf. We output dumps on a table basis via the new instance.

pg_dump -d testdb -p 5432 -n public test -f backup_all.sql

Let’s not forget to delete the database we created later.




 2,913 views last month,  1 views today

About tayfun inam

Computer Engineer -PostgreSql-Oracle Database Administrator I am about Oracle & SQL Server database, Goldengate, Exadata Machine, Oracle Database Appliance administrator with 8+years experience.I have OCA,PostgreSql senior Certificates I have worked 50+ Banking, Insurance, Finance, Telco and etc. clients as a Consultant, Insource or Outsource.I have done 200+ Operations in this clients such as Exadata Installation & PoC & Migration & Upgrade, Oracle & SQL Server Database Upgrade, Oracle RAC Installation, SQL Server AlwaysOn Installation, Database Migration, Disaster Recovery, Backup Restore, Performance Tuning, Periodic Healthchecks.I have done 2000+ Table replication with Goldengate or SQL Server Replication tool for DWH Databases in many clients.

Leave a Reply

Your email address will not be published.