<refentry id="APP-PG-UPGRADE">
 <refmeta>
  <refentrytitle>
   <application>pg_upgrade</application>
  </refentrytitle>
  <refmiscinfo>Application</refmiscinfo>
 </refmeta>
 <refnamediv>
  <refname>
   <application>pg_upgrade</application>
  </refname>
  <refpurpose>
   Allows upgrade from a previous release without reloading data
  </refpurpose>
 <refsynopsisdiv>
  <refsynopsisdivinfo>
   <date>1998-10-04</date>
  </refsynopsisdivinfo>
  <synopsis>
pg_upgrade
pg_upgrade [ -f <replaceable class="parameter">filename</replaceable> ] <replaceable class="parameter">old_data_dir</replaceable>
  </synopsis>
 </refsynopsisdiv>

 <refsect1 id="R1-APP-PG-UPGRADE-1">
  <refsect1info>
   <date>1998-10-04</date>
  </refsect1info>
  <title>
   Description
  </title>
  <para>
   <application>pg_upgrade</application>
   is a utility for upgrading from a previous
   PostgreSQL release without reloading all the data.

  <procedure>
   <title>Upgrading <productname>Postgres</productname></title>

   <step performance="required">
    <para>
     Back up your data directory.
    </para>
   </step>

   <step performance="required">
    <para>
     Use:
     <programlisting>
% pg_dumpall -s >db.out
     </programlisting>
     to dump out your old  database definitions without any
     data.  Stop the postmaster and all backends.
    </para>
   </step>

   <step performance="required">
    <para>
     Rename  (using mv) your old pgsql <filename>data/</filename> directory to
     <filename>data.old/</filename>.
    </para>
   </step>

   <step performance="required">
    <para>
     Do a
     <command>make install</command> to install the new binaries.
    </para>
   </step>

   <step performance="required">
    <para>
     Run <application>initdb</application> to create a new template1 database containing the system
     tables for the new release.
    </para>
   </step>

   <step performance="required">
    <para>
     Start the new postmaster.
    </para>
   </step>

   <step performance="required">
    <para>
     Change your working directory to the 
     pgsql main directory, and type:
     <programlisting>
% pg_upgrade -f db.out data.old
     </programlisting>
     The  system  will do some checking to make sure everything
     is properly configured, and will run your db.out script to create
     all the  databases and  tables you had, but with no
     data.  It will then move the  data  files  from <filename>data.old/</filename>
     into  the  proper <filename>data/</filename> directory.
    </para>
   </step>

   <step performance="required">
    <para>
     <emphasis>Carefully</emphasis> examine the contents of the upgraded database.
    </para>
   </step>

   <step performance="required">
    <para>
     You can delete the <filename>data.old/</filename> directory when you
     are finished.
    </para>
 </refsect1>
</refentry>

<!-- Keep this comment at the end of the file
Local variables:
mode: sgml
sgml-omittag:nil
sgml-shorttag:t
sgml-minimize-attributes:nil
sgml-always-quote-attributes:t
sgml-indent-step:1
sgml-indent-data:t
sgml-parent-document:nil
sgml-default-dtd-file:"../reference.ced"
sgml-exposed-tags:nil
sgml-local-catalogs:"/usr/lib/sgml/catalog"
sgml-local-ecat-files:nil
End:
-->
