My requirement is to copy all tables and not the database (SID, SCHEMA) from one database to another on postgres.

Below is the command to copy single table from a database to another database.

pg_dump -U Username -h DatabaseEndPoint -a -t TableToCopy SourceDatabase | psql -h DatabaseEndPoint -p portNumber -U Username -W TargetDatabase
What would be the command to copy not one but all tables and their contents from one database to another in postgres?

I'm using postgres 12.

Aucune réponse