4

I have two postgreSql DB on different server lets say A and B. Can I use flyway some how to copy all data from DB A to B which is newly setup and empty. Its will be helpful if anyone point me to correct direction and tool, requirement is to copy data from one DB to another through some tool automation huge data volume need to consider in solution.

3
  • 5
    Don't use something slow and complicated to copy a large database. Use pg_dump and pg_restore. Commented Aug 22, 2019 at 5:52
  • pg_basebackup if you want to copy the whole PostgreSQL cluster, not just some single DB. Commented Aug 22, 2019 at 16:44
  • @LaurenzAlbe thanks , migrate word used in flyway some how confusing for me, I understand now its involved manual script generation and need to feed to flyway for migration and no direct solution. Commented Aug 23, 2019 at 10:50

1 Answer 1

6

Flyway doesn't directly support such a capability. However, you could do the following:

  • As Laurenz says, use pg_dump to extract DB A into a script file
  • Create a Flyway migration script and copy in the contents of the script file
  • Run the Migrate command against DB B
Sign up to request clarification or add additional context in comments.

1 Comment

Sometimes this couldn't be an option as it's requires service downtime.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.