To increase your confidence in the safety of your data, you should regularly test your ability to
restore from a logical backup. Restoring a logical backup that you created using the custom format
requires the use of the pg_restore
tool as follows:
Makefile.install
prerequisite
installer than came with your version of Evergreen contains an installation target that should
satisfy these requirements. Refer to the installation documentation for more details.
postgres
user, create a new database using the createdb
command into which you will
restore the data. Base the new database on the template0 template database to enable the
combination of UTF8 encoding and C locale options, and specify the character type and collation
type as "C" using the --lc-ctype
and --lc-collate
parameters. For example, to create a new
database called "testrestore": createdb --template=template0 --lc-ctype=C --lc-collate=C testrestore
postgres
user, restore the logical backup into your newly created database using
the pg_restore
command. You can use the -j
parameter to use more CPU cores at a time to make
your recovery operation faster. If your target database is hosted on a different server, you can
use the -U <user-name>
and -h <hostname>
options to connect to that server. For example,
to restore the logical backup from a file named evergreen_20121212.dump into the "testrestore"
database on a system with 2 CPU cores: pg_restore -j 2 -d testrestore evergreen_20171212.dump