Home > Enterprise >  Data Only from One Server to Another in Postgres SQL
Data Only from One Server to Another in Postgres SQL

Time:07-16

I see that there are solutions for copying tables from one Postgres SQL server to another. But I need to transfer ONLY DATA from one server to another. I noticed the following command:

pg_dump -C -h localhost -U localuser dbname | psql -h remotehost -U remoteuser dbname

But I do not want to copy anything else other than data. How can I do that?

Another question. I have multiple tables on Server A. If I want to copy Data from all tables on Server A to Server B, how can I do that? Thank you.

CodePudding user response:

To copy only the data with pg_dump, you can use the -a flag (or the long form would be --data-only):

pg_dump -C --data-only -h localhost -U localuser dbname | psql -h remotehost -U remoteuser dbname
  • Related