I am trying to copy an entire table from one database to another in Postgres. Any suggestions?
Right-click on the database name, then select "Tasks" > "Export data..." from the object explorer. The SQL Server Import/Export wizard opens; click on "Next". Provide authentication and select the source from which you want to copy the data; click "Next". Specify where to copy the data to; click on "Next".
Source database engine: Select PostgreSQL as the source database engine. Destination region: Select the destination region for the target Cloud SQL for PostgreSQL instance. Migration job type: Select the migration type that you want to perform from the drop-down list.
Extract the table and pipe it directly to the target database:
pg_dump -t table_to_copy source_db | psql target_db
Note: If the other database already has the table set up, you should use the -a
flag to import data only, else you may see weird errors like "Out of memory":
pg_dump -a -t table_to_copy source_db | psql target_db
You can also use the backup functionality in pgAdmin II. Just follow these steps:
Works well and can do multiple tables at a time.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With