If your dump was performed with the “–clean” option, you can skip the reinitializing of your databases to avoid duplicating data. This option, used with the “pg_dumpall” command will cause the restore to clean out all the objects in the database before performing the restore. If you didn’t include this option, then just delete the data directory and reinitialize the database as shown below.
PGDATA=/var/lib/pgsql/data/ pg_ctl stop
or “/etc/init.d/postgres stop” if you have fancy init scripts.
rm -rf /var/lib/pgsql/data
/etc/init.d/postgres initdb
edit pg_hba.conf
change “ident” to “md5″ for local connections
PGDATA=/var/lib/pgsql/data/ pg_ctl start
or “/etc/init.d/postgres start” if you have fancy init scripts.
psql -U postgres -f pg_dumpall_file postgres
The dump file is a plain text list of commands that restores all objects, or specific parts of the database if just used dump instead of dumpall.