Created
February 17, 2014 23:29
-
-
Save eirsyl/9061420 to your computer and use it in GitHub Desktop.
Dump / Restore Postgres Database
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
su postgres | |
pg_dump dbname > outfile | |
psql dbname < infile | |
# Chango owner onn all tables | |
for tbl in `psql -qAt -c "select tablename from pg_tables where schemaname = 'public';" "dbname"` ; do psql -c "alter table $tbl owner to ownername" "dbname" ; done |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment