Search code examples
postgresqlpostgresql-9.2postgresql-10

Data migration from PostgreSQL 9.2 to PostgreSQL 10


I want to migrate data from PostgreSQL 9.2 to PostgreSQL 10. Please, suggest the best way to data migration from old to new versions of PostgreSQL.


Solution

  • You may use pgdump and restore for this task.

    e.g suppose you have database dbname_pg92 in postgres92 and dbname_pg10 in postgres10 then you can use the below commands for dump and restore

    ./pg_dump -U postgres -p 5432 -h localhost -Ft dbname_pg92 > dump92.sql.tar
    ./pg_restore -U postgres -h 172.16.208.155 -p 5432 -d dbname_pg10 dump92.sql.tar