Backup / restore PostgreSQL database

To backup / dump entire DB (database cluster), use the following command:
pg_dumpall > outfileor with username and gzipped
pg_dumpall -U postgres | gzip > db_backup.gz-U usename – connect as specified database user

To restore from dump file “db_backup” use:
psql -f db_backup postgres

Leave a Reply

Your email address will not be published.