Postgres Export/Import (Obsolete)

The Postgres database for users is vital to backup since it not only controls access to accounts, but also objects will not properly appear in Hydra without the account that generated them for some reason as yet unknown.

To export use either:

pg_dump -U postgres chf_hydra -Fc > chf_hydra.dump  (dumps a postgres binary, PG restore has a number of options to handle recovering specific tables or data) (Recovery options besides full untested as of 1/27/16 D.S.)

pg_dump -U postgres chf_hydra -Fp > chf_hydra_dump.sql  (dumps a text file with SQL statements to generate the database, does not allow levels of recovery)


To import a backup copy:

In Postgres make a blank database chf_hydra

pg_restore -d chf_hydra -U postgres chf_hydra.dump
or
psql chf_hydra < chf_hydra_dump.sql


Then set permissions

psql -U postgres
GRANT Create,Connect,Temporary ON DATABASE chf_hydra TO chf_pg_hydra;

The postgres account password is in ansible-vault (groupvars/all)