aaraza
10/6/2017 - 2:58 PM

Postgres Backup

Backing up and restoring postgres database

# --dbname is necessary because you have to add the name of a valid database 
# to initially connect to or it will just dump the contents to STDOUT:
pg_restore --create --exit-on-error --verbose --dbname=ali dump.bak
# -O and -x drop privalages and owners on database
pg_dump cap -U postgres -h localhost -Fc -p 9000 -O -x --verbose > dump.bak