Restore dump on the remote machine

Danila Zharenkov picture Danila Zharenkov · Oct 15, 2014 · Viewed 25.4k times · Source

I've got my own machine with postgres dmp file, which I want to restore on the remote virtual machine (e.g. ip is 192.168.0.190 and postgres port is 5432) in my network. Is it possible to restore this dump using pg_restore without copying dump to remote machine? Because the size of dump about 12GB and the disk space on the virtual machine is 20GB. Thanks

Answer

nif picture nif · Oct 15, 2014

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: