pg_upgrade 1 Application pg_upgrade Allows upgrade from a previous release without reloading data 1999-07-31 pg_upgrade -1-2 1999-07-31 Description pg_upgrade is a utility for upgrading from a previous PostgreSQL release without reloading all the data. Not all PostgreSQL release transitions can be handled this way. Check the release notes for details on your installation. Upgrading <productname>PostgreSQL</productname> with pg_upgrade Back up your existing data directory, preferably by making a complete dump with pg_dumpall. Copy the program pgsql/src/bin/pg_dump/pg_upgrade from the current PostgreSQL distribution into somewhere in your path. Change your working directory to the pgsql main directory, and type: $ pg_upgrade -1 to collect information about the old database needed for the upgrade. Do: $ make install to install the new binaries. Do: $ cd pgsql/contrib/pg_resetxlog $ make install to install the /contrib/pg_resetxlog utility which will be used by pg_upgrade. Run initdb to create a new template1 database containing the system tables for the new release. Make sure you use settings similar to those used in your previous version. Start the new postmaster. (Note: it is critical that no users connect to the server until the upgrade is complete. You may wish to start the postmaster without -i and/or alter pg_hba.conf temporarily.) Change your working directory to the pgsql main directory, and type: $ pg_upgrade -2 The program will do some checking to make sure everything is properly configured, and will run your db.out script to recreate all the databases and tables you had, but with no data. It will then physically move the data files containing non-system tables and indexes from data.old/ into the proper data/ subdirectories, replacing the empty data files created during the db.out script. Restore your old pg_hba.conf if needed to allow user logins. Carefully examine the contents of the upgraded databases. If you detect problems, you'll need to recover by restoring from your full pg_dump backup. You can delete the data.old/ directory when you are satisfied. The upgraded databases will be in an un-vacuumed state. You will probably want to run a VACUUM ANALYZE before beginning production work.