Recovery of a dropped/damaged database
Recovering a complete database is also required sometimes. It's actually a lot easier than recovering a single table. Many users choose to place all of their tables in a single database; in that case, this recipe isn't relevant.
How to do it…
The methods differ, depending on the type of backup you have available. If you have multiple types of backup, you have a choice.
Logical – from the custom dump -F c
Recreate the database in the original server using parallel tasks to speed things along. This can be executed remotely without needing to transfer dumpfile
 between systems, as shown in the following example, where we use the -j
 option to specify four parallel processes:
pg_restore -h myhost -d postgres --create -j 4 dumpfile
Logical – from the script dump created by pg_dump
Recreate the database in the original server. This can be executed remotely...