PG_UPGRADE(1)                                       PG_UPGRADE(1)

NAME
       pg_upgrade  - Allows upgrade from a previous release with-
       out reloading data

SYNOPSIS
       pg_upgrade [ -f filename ] old_data_dir

DESCRIPTION
       pg_upgrade is a utility  for  upgrading  from  a  previous
       PostgreSQL  release  without  reloading all the data.  Not
       all Postgres release transitions can be handled this  way;
       check  the release notes for details on your installation.

              "UPGRADING POSTGRES WITH PG_UPGRADE"

              1.     Back  up  your  existing   data   directory,
                     preferably  by  making  a complete dump with
                     pg_dumpall.

              2.     Do

                     % pg_dumpall -s >db.out

                     to dump out your old database's table  defi-
                     nitions without any data.

              3.     Stop the old postmaster and all backends.

              4.     Rename  (using  mv)  your  old  pgsql  data/
                     directory to data.old/.

              5.     Do

                     % make install

                     to install the new binaries.

              6.     Run  initdb  to  create  a   new   template1
                     database  containing  the  system tables for
                     the new release.

              7.     Start the new postmaster. (Note: it is crit-
                     ical  that  no users connect to the database
                     until the upgrade is complete. You may  wish
                     to  start  the  postmaster without -i and/or
                     alter pg_hba.conf temporarily.)

              8.     Change your working directory to  the  pgsql
                     main directory, and type:

                     % pg_upgrade -f db.out data.old

                     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.

              9.     Carefully   examine   the  contents  of  the
                     upgraded database. If you  detect  problems,
                     you'll  need  to  recover  by restoring from
                     your full pg_dump backup.

              10.    The upgraded database will be in an un-vacu-
                     umed  state. You will probably want to run a
                     VACUUM ANALYZE before  beginning  production
                     work.

              11.    Restart  the  postmaster and/or restore your
                     old pg_hba.conf  if  needed  to  allow  user
                     logins.  You can delete the data.old/ direc-
                     tory when you are finished.

Application               15 August 1999                        1