Upgrading PostgreSQL 9.2.10 to 9.4.1
I decided to upgrade my PostgreSQL server today. I did this upgrade slightly different than the last time. All commands were done as the root
user unless indicated.
su -l pgsql pg_dumpall | bzip2 -9c > all-db-9.2.10-2015-05-07.sql.bz2 chmod 0600 all-db-9.2.10-2015-05-07.sql.bz2 exit /usr/local/etc/rc.d/postgresql stop make -C /usr/ports/databases/postgresql94-server config-recursive portupgrade -fpvo databases/postgresql94-client databases/postgresql92-client portupgrade -fpvo databases/postgresql94-contrib databases/postgresql92-contrib portupgrade -fpvo databases/postgresql94-server databases/postgresql92-server portupgrade -fprv -x databases/postgresql94-client -x databases/postgresql94-server -x databases/postgresql94-contrib databases/postgresql94-client mv /usr/local/pgsql/data /usr/local/pgsql/data0 su -l pgsql -c 'mkdir /usr/local/pgsql/data' /usr/local/etc/rc.d/postgresql initdb /usr/local/etc/rc.d/postgresql start su -l pgsql bzcat all-db-9.2.10-2015-05-07.sql.bz2 | psql -f - template1 # Transfer all relevant settings from /usr/local/pgsql/data0 to /usr/local/pgsql/data for pg_hba.conf and postgresql.conf exit /usr/local/etc/rc.d/postgresql restart su -l pgsql pg_dumpall | bzip2 -9c > all-db-9.4.1-2015-05-07.sql.bz2 chmod 0600 all-db-9.4.1-2015-05-07.sql.bz2 exit rm -R /usr/local/pgsql/data0