pg_dump
(pg_dumpall
) and pg_restore
tools.
To protect yourself against data loss, we recommend frequently backing up the databases you manage with Gcore Managed PostgreSQL.
Ubuntu 22.04
apt
:
pg_dump
and pg_restore
tools, install the Postgres package, which includes them:CentOS 7
Windows
username
, password
, port
, and dbname
) to connect to the Gcore Managed Database server, where databases are stored. You can find credentials in the Customer Portal, with instructions available in our dedicated guide.
$ pg_dump -U username -W -h hostname -d database_name > database_name.sql
$ pg_dump -F t -U username -W -h hostname -d database_name > backup_file.tar
$ pg_dump -F c -U username -W -h hostname -d database_name > backup_file.dump
$ pg_dump -F d -U username -W -h hostname -d database_name -f backup_dir
username
, hostname
, and database_name
, enter custom values, which you can access using our guide. For backup_file
or backup_dir
, specify the relevant name for the backup file or directory.
Below are some other details for the commands:
-W
prompts the password before connecting to the PostgreSQL server-F
specifies the output format of the backup and can be followed by the following flags:
c
for custom formatd
for directory formatt
for tarall_pg.sql
is the output backup nameusername
is your username from the Customer Portalhostname
is your hostname from the Customer Portalusername
is your username from the Customer Portalhostname
is your hostname from the Customer Portaldatabase_name
is your database name from the Customer Portalbackup_file.tar
is the file or directory with your backup