For PostgreSQL version 11 and earlier, on starting the PostgreSQL server, it goes into recovery mode if recovery.conf file is present in the data directory. This file contains all the parameters to perform the log recovery operation.
For PostgreSQL versions 12 and later, set the recovery related parameters in the postgresql.conf file. For running a restore operation using PostgreSQL Agent, if the user does not select the Recover Database Server check box while performing the recovery operation, or if the server fails to start, then the restore operation creates the postgresql.conf.with_recovery_commands file in the data directory. At the bottom of this file, all the minimum recovery parameters required to start the server are added as shown below:
> restore_command = 'cp /srv/pgsql/wal/%f %p'
> recovery_end_command = 'touch /srv/pgsql/data/recovery.done.cv'
> recovery_target_time = '2020-03-17 08:11:26GMT'
> recovery_target_action = promote
Copy these parameters from the postgresql.conf.with_recovery_commands file to the postgresql.conf file. Substitute the values of these parameters based on your environment, and then start the PostgreSQL server.
After the PostgreSQL server is online, remove these recovery parameters from the postgresql.conf file.
Note
The recovery_target_time parameter is needed only for running a point-in-time restore operation.
For PostgreSQL versions 9.5 and above, copy the backup_label file from archive log directory to the data directory.