Export PostgreSQL Database to Dump File
Purpose
This topic describes how to use the psql command to backup the PostgreSQL database to a dump file.
Export 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.