×
×

Knowledgebase & Downloads

The knowledgebase provides documentation written by our team. Please select a category or search for answers.

Articles

Dumping PostgreSQL databases with pg_dump

Assuming your postgres database name is someuser_dbuser1 and assigned dbuser is someused_dbuser1

Dumping postgres DB from server's terminal (terminal can be accessed via SSH or in Directadmin)

1. Create plain text dump:
pg_dump -U someuser_dbuser1 someuser_db1 > someuser_db1.sql

2. Optionally compress the dump to speed up transfer
gzip someuser_db1.sql

Alternatively you can replace steps #1 and #2 with postgres custom compressed format:
pg_dump -F c -U someuser_dbuser1 someuser_db1 > someuser_db1
3. Download someuser_db1.sql.gz (or someuser_db1 if you chose custom compressed format)
using FTP, SCP or Directadmin file manager.


Dumping postgres DB from remote location using a terminal (you need to know your server IP or hostname)

1. Allow remote access
Allow access to postgres server from your public IP or from all IPs (%) in Directadmin - Extra Features - Postgres - [yourdatabasename] - Allow IP or subnet

2. Create plain text dump:
pg_dump -h YOUR_SERVER_IP_OR_HOSTNAME -U someuser_dbuser1 someuser_db1 > someuser_db1.sql

3. Optionally compress the dump to save space:
gzip someuser_db1.sql

Alternatively you can replace steps #2 and #3 with postgres custom compressed format:
pg_dump -h YOUR_SERVER_IP_OR_HOSTNAME -F c -U someuser_dbuser1 someuser_db1 > someuser_db1


Powered by HostBill