I have two servers and 5 schemes in Postgres, one server is in production and the other is in the background.
- Windows server 2019
- Postgres 12.7
I have these schemas in the postgres database which is by default, I guess it is not the best option. But this is the scenario.
On the production server I have much more data since it is the one that is operating, what I want to do is copy the database on the production server and copy it to the secondary one since I need to do some tests, but safely.
Tried this with no positive result:
pg_dump.exe -U postgres -d postgres --format=c -f db.sql
And on secondary server the following:
pg_restore.exe --create --clean --if-exists -Fc -d postgres -U postgres "db.sql"
I thought I could do it only with the diagrams in the following way:
pg_dump.exe --file "db.sql" --username "postgres" --format=c --blobs --schema-only --schema "schema" "postgres"
pg_restore.exe --username "postgres" --dbname "postgres" --schema-only --verbose --schema "schema" "db.sql"
But I think it would not be a valid option either, would I have to do a clean when restoring? just copy the data with the --only-data option? How could I completely copy the schema at the source, and rewrite it completely at the destination? with the clean option?
Thanks.