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Â
yum
command or the PostgreSQL binaries from: https://www.bigsql.org/postgresql/installers.jsp. - The...