Restore dump on the remote machine
You can run a restore over the network without copying the dump to the remote host.
Just invoke pg_restore
with -h <hostname>
and -p <port>
(and probably -U <username>
to authenticate as different user) on the host you got the dump file, for example:
pg_restore -h 192.168.0.190 -p 5432 -d databasename -U myuser mydump.dump
References:
Alternatively, you can use psql:
psql -h 192.168.0.190 -p 5432 -d <dbname> -U <username> -W -f mydump.dump
An example for a remote RDS instance on AWS
psql -h mydb.dsdreetr34.eu-west-1.rds.amazonaws.com -p 5432 -d mydbname -U mydbuser -W -f mydatabase-dump.sql -f, --file=FILENAME execute commands from file, then exit -W, --password force password prompt (should happen automatically)