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.

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>