Using pg_dump to upgrade data
In this recipe, we are going to upgrade the PostgreSQL cluster from version 9.5 to 9.6. We will utilize the pg_dump utility for this purpose.
Getting ready
The only prerequisites here are that an existing PostgreSQL cluster must be set up and running. The required version here is PostgreSQL Version 9.6. These steps are carried out on a 64 bit CentOS machine.
How to do it...
Here are the series of steps that need to be carried out for upgrading PostgreSQL from version 9.5 to 9.6 using pg_dump:
- Back up your database using
pg_dumpall:pg_dumpall > db.backup - The next step would be to shut down the current PostgreSQL server:
pg_ctl -D /var/lib/pgsql/9.5/data stop - Rename the old PostgreSQL installation directory:
mv /var/lib/pgsql /var/lib/pgsql.old - Install the new version of PostgreSQL, which is PostgreSQL Version 9.6, by using either theÂ
yumcommand or the PostgreSQL binaries from: https://www.bigsql.org/postgresql/installers.jsp. - The...
Register for a free Packt account to unlock a world of extra content!
A free Packt account unlocks extra newsletters, articles, discounted offers, and much more. Start advancing your knowledge today.
Unlock this book and the full library FREE for 7 days
Get unlimited access to 7000+ expert-authored eBooks and videos courses covering every tech area you can think of
Renews at $19.99/month. Cancel anytime