Restore a PostgreSQL database from an archive file created by pg_dump

February 26, 2022

$ pg_restore --verbose --clean --no-acl --no-owner -h HOSTNAME -d DB_NAME FILE_PATH
  • --verbose: Specifies verbose mode. If specified, pg_dump will output detailed object comments, start and end times to the dump file, and progress messages to stderr.
  • --clean: Organize (delete) the database objects before recreating them.
  • --no-acl: Access privileges (grant/revoke command) will not be restored.
  • --no-owner: Do not output commands to match object ownership to the original database.
  • -h HOSTNAME: Specify the host name.
  • -d DB_NAME: Specify the database name.

References