1

I have PostgreSQL instance with n databases on it.

Is it possible to restore just a single database using PITR ?

# restore
tar xvfz /var/lib/postgresql/db_file_backup.tar.gz -C /var/lib/postgresql/10/main/

# add recovery.conf
nano /var/lib/postgresql/10/main/recovery.conf

  restore_command = 'cp /var/lib/postgresql/pg_log_archive/%f %p'
  recovery_target_time = '2018-02-22 15:20:00 EST'

# start DB
sudo systemctl start postgresql@10-main

I see that pg_restore contains dbname parameter. But it's logical. I need to restore to specific Point-In-Time.

pg_restore --help pg_restore restores a PostgreSQL database from an archive created by pg_dump. Usage:  pg_restore [OPTION]... [FILE] General options:  -d, --dbname=NAME        connect to database name

1 Answer 1

3

You cannot have that.

PITR requires a file system level backup and recovery, and both encompass the whole cluster. I am not saying it is theoretically impossible, but no such functionality exists.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Not the answer you're looking for? Browse other questions tagged or ask your own question.