Backup and Restoring DB in PostgreSQL

Just a simple note for myself. Every time I want to do this, I always end up googles it :D.

For backup the whole database, you can use pg_dump:

pg_dump dbname -f outputfile -U username

For restoring the dumped file,

psql -d destdbname -U username < dumpfilename

 

Leave a comment