Skip to content

Backup and restore the production database

Matthew Perry edited this page Sep 5, 2013 · 2 revisions

On the production server:

pg_dump forestplanner > /tmp/forestplanner_20130903.dump 
bzip2 /tmp/forestplanner_20130903.dump

Now transfer it to stage or dev and restore it.

bunzip2 forestplanner_20130903.dump.bz
dropdb forestplanner
createdb -T template0 forestplanner
psql forestplanner < forestplanner_20130903.dump

If you get errors related to ROLE/user not existing, make sure you create that postgres user in the new environment:

createuser ubuntu

Note: A full dump/restore might be too large and slow to do regularly. As long as the fixture data (FVSAggregate, etc) remains the same, we might want to only dump the user tables (i.e. tables associated with Madrona features)