From OpenNMS
Database
Always use pg_dump/pg_restore with the -Fc option when backing up and restoring! It is much smarter than a "raw SQL" dump.
- Backing Up
-
pg_dump -U opennms -Fc -f /tmp/opennms.pgsql.gz opennms - Restoring
-
createdb -U opennms opennms
pg_restore -U opennms -Fc -d opennms /tmp/opennms.pgsql.gz
If you're using PostgreSQL 8.4 or higher, when you restore, you can do it with multiple threads, to speed up the process, by adding the -j flag, eg, pg_restore -U opennms -Fc -j4 -d opennms /tmp/opennms.pgsql.gz.






