I want to create a copy of my database from one server to another (my laptop to a server for example). Ive been looking online about how to do it and found this article:http://www.postgresqltutorial.com/postgresql-copy-database/ However I am confused when it says

"Second, copy the dump file to the remote server"

I know how to pg_dump and pg_restore but now sure what they mean by copy the dump file?

  • 3
    They mean: Copying a file from one computer to the other. Simple as that. – John aka hot2use Jul 25 '18 at 6:36

If you are using Windows and are using RDP to connect to the server you can just select the dump file, press CTRL-C, switch to the server connection and browse to a folder where you would like to copy the file to and press CTRL-V.

If your laptop and the server are on the same network, you can create a file share on either your laptop or on the server (or use an existing one) and use Windows Explorer to copy-paste the files over.

There is also a copy command if you want to do it from a DOS box or batch file.

If you are using Linux, again, it depends on how you can connect to your server. There are options to mount a remote file share using NFS or Samba and copy files over, or you can use scp to copy files over an SSH connection.

This way you can have a "copy" of the dump file on the remote server, and use pg_restore to restore that copy of the dump file.

Not the answer you're looking for? Browse other questions tagged or ask your own question.