- On the source server(remote/local), export the backup first:
pg_dump -U {username} -h {host} -p {port} -f {output-file-path}.sql {dbname to backup}
copy the backup file to the target server.
- On the target server(remote/local), log into the postgres using below command.