Export PostgreSQL Database to Dump File

From Gejoreuy
Revision as of 13:22, 14 October 2019 by Gejor (talk | contribs) (Created page with "== Purpose == This topic describes how to use the psql command to backup the PostgreSQL database to a dump file. == Import the Dump File == Just run below command and chang...")
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to navigation Jump to search

Purpose

This topic describes how to use the psql command to backup the PostgreSQL database to a dump file.

Import the Dump File

Just run below command and change it with the database value.

[root@gejoreuy ~]# pg_dump -U username -h hostname -p port databasename -f filename

Note :

  • username: The username to log on to the on-premises PostgreSQL database.
  • hostname: The hostname of the on-premises database. You can use localhost as the hostname if you log on to the local database host.
  • port: The port number of the on-premises PostgreSQL database.
  • databasename: The name of the on-premises database to be backed up.
  • filename: The name of the backup file to be generated.