I'm looking to copy a PostgreSQL Server to Another server.
- I want to migrate entire server which might contain multiple databases
- I am trying to do it with cloud databases (e.g. AWS which doesn't provide super user privileges for RDS) so it would be better to provide a solution with Users of attribute Create role, Create DB Password valid until infinity
I want something like (This query doesn't exists just an example)
pg_dumpall -C -h localhost -U localuser | psql -h remotehost -U remoteuser
I know that below query exists but it is does not work same for pg_dumpall
pg_dump -C -h localhost -U localuser dbname | psql -h remotehost -U remoteuser dbname
-c for clean databases before recreating. also you should have superuser privilege for this user.