What does pgrestore do?
pg_restore is a PostgreSQL command-line utility used for restoring database backups created with pg_dump or pg_dumpall. It enables you to restore the data and schema of a PostgreSQL database from a backup file.
Why is it important?
Restoring backups with pg_restore is crucial for data recovery, database migration, and replication. It allows you to recover a PostgreSQL database to a specific point-in-time or transfer data between PostgreSQL clusters.
How to use pgrestore:
You can use pg_restore to restore a PostgreSQL backup with various options. Here's a basic usage example:
pg_restore [option...] [backupfile]
Common Options:
-U, --username: The name of the user to connect as.
-h, --host: Database server host or socket directory.
-d, --dbname: The name of the database to restore into.
-v, --verbose: Print detailed progress messages.
-c, --clean: Output commands to clean (drop) database objects before recreating them.
--data-only: Restore only the data, not the schema.
--schema-only: Restore only the schema, not the data.