dumping and restoring a postgres database

Tue, Mar 21, 2006

Dump the database to text file, without BLOBs:

pg_dump -f backup.sql DATABASE_NAME

Restore the database from text file without BLOBs:

pgsql -d DATABASE_NAME -f backup.sql

Dump the database with BLOBs:

pg_dump -Ft -b DATABASE_NAME > backup.tar

Restore the database with BLOBs:

pg_restore -d DATABASE_NAME backup.tar

comments powered by Disqus