Last active
December 12, 2015 07:09
-
-
Save tdowling/4734522 to your computer and use it in GitHub Desktop.
Copy a database in postgres
This file contains hidden or 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
| /usr/lib/postgresql/9.2/bin/pg_dump -U sofi -n public -h yyc-sofidb01 sofi_production > /tmp/tavis-full.sql; echo 'grant all on database sofi_dev to sofi;' >> /tmp/tavis-full.sql; | |
| sudo su - postgres; | |
| kill `ps -f -U postgres | grep sofi | grep -v grep | awk '{print $2}'` ; dropdb sofi_dev ; createdb sofi_dev ; psql -d sofi_dev -1 -f /tmp/tavis-full.sql |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment