Question

Migration of data from PostgreSQL 9.1.13 to PostgreSQL 9.3

Hello there,

I have the following issue. I have database PostgreSQL version 9.1. I have a second server with PostgreSQL 9.3. I want to move the data from PostgreSQL 9.1 to PostgreSQL 9.3. For that purpose I dumped the data from PostgreSQL 9.1 using the following command:

pg_dump -U postgres -Ft -p 5432 DB_NAME > DUMP_FILE_NAME.bkp.tar

And then I restored it to PostgreSQL 9.3:

pg_restore -U postgres -p 5432 -v -c -O -d NEW_DB_NAME DUMP_FILE_NAME.bkp.tar

The issue is that not the whole data was restored. Part of the tables were missing, a significant part of the functionalities, etc.

So, I have a question, is it possible to migrate the whole data somehow?

I also tried to install PostgreSQL 9.1 on the seconds server but PostgreSQL no longer supports version 9.1. That’s why it was necessary to do that with the help of the source code from here: http://www.postgresql.org/ftp/source/v9.1.13/

Then I followed the instructions:

http://www.postgresql.org/docs/9.1/static/install-procedure.html http://www.postgresql.org/docs/9.1/static/install-post.html

and few other articles on Internet. Result…nothing. I can’t tun PostgreSQL 9.1 using its source code. Can you please help?

Regards, Pavel


Submit an answer

This textbox defaults to using Markdown to format your answer.

You can type !ref in this text area to quickly search our full set of tutorials, documentation & marketplace offerings and insert the link!

Sign In or Sign Up to Answer

These answers are provided by our Community. If you find them useful, show some love by clicking the heart. If you run into issues leave a comment, or add your own answer to help others.

Want to learn more? Join the DigitalOcean Community!

Join our DigitalOcean community of over a million developers for free! Get help and share knowledge in Q&A, subscribe to topics of interest, and get courses and tools that will help you grow as a developer and scale your project or business.

The key to migrating data from one major version of PostgreSQL to another is to you the pg_dump binary from the new version to dump the data from the old one. As mentioned in the PostgreSQL 9.3 upgrade docs:

It is recommended that you use the pg_dump and pg_dumpall programs from the newer version of PostgreSQL, to take advantage of enhancements that might have been made in these programs. Current releases of the dump programs can read data from any server version back to 7.0.

While using pg_dump is the recommended route, if you are upgrading in place the pg_upgrade command is also useful. See more here.