simonthompson99
9/27/2019 - 4:13 PM

[Transfer db from index to local] Dump, transfer, then load database from index to local #sql #database

[Transfer db from index to local] Dump, transfer, then load database from index to local #sql #database

-- on query
pg_dump -h 10.1.24.39 -p 5433 --schema <schema-name> <db_name> > ~/scratch/<dump_file>.sql
 
-- local
cd ~/scratch
scp sthompson@10.1.24.38:~/scratch/<dump_file>.sql .
sed -i .bak 's/OWNER TO cdt_user;/OWNER TO simon;/g' <dump_file>.sql
psql -d <target_db> -h localhost -p 5432 -U simon < <dump_file>.sql