Forrest logo
back to the pg_restore tool

pg_restore:tldr:59581

pg_restore: Restore an archive into an existing database.
$ pg_restore -d ${db_name} ${archive_file-dump}
try on your machine

The command "pg_restore -d ${db_name} ${archive_file-dump}" is used to restore a PostgreSQL database from a previous backup created with the "pg_dump" command.

Here's what each part of the command means:

  • pg_restore: This is the executable or command that is used to restore a PostgreSQL database. It is part of the PostgreSQL database management system.

  • -d ${db_name}: This specifies the name of the database that you want to restore. Replace ${db_name} with the actual name of your database.

  • ${archive_file-dump}: This is the filename or absolute path of the backup archive file that you want to restore. Replace ${archive_file-dump} with the actual filename or path of your backup archive file. The backup archive file is typically created using the "pg_dump" command.

In summary, this command is used to restore a PostgreSQL database by specifying the name of the database to be restored and the path or filename of the backup archive file.

This explanation was created by an AI. In most cases those are correct. But please always be careful and never run a command you are not sure if it is safe.
back to the pg_restore tool