head	1.21;
access;
symbols
	REL7_2_BETA5:1.20
	REL7_2_BETA4:1.13
	REL7_2_BETA3:1.12
	REL7_2_BETA2:1.12
	REL7_2_BETA1:1.12
	REL7_1_2:1.12
	REL7_1_STABLE:1.12.0.2
	REL7_1_BETA:1.11
	REL7_1_BETA3:1.12
	REL7_1_BETA2:1.12
	REL7_1:1.12
	REL7_0_PATCHES:1.9.0.2
	REL7_0:1.9
	REL6_5_PATCHES:1.4.0.2
	REL6_5:1.4
	REL6_4:1.2.0.2;
locks; strict;
comment	@# @;


1.21
date	2002.01.14.17.32.07;	author momjian;	state dead;
branches;
next	1.20;

1.20
date	2002.01.13.01.13.59;	author momjian;	state Exp;
branches;
next	1.19;

1.19
date	2002.01.11.20.48.47;	author momjian;	state Exp;
branches;
next	1.18;

1.18
date	2002.01.11.20.34.14;	author momjian;	state Exp;
branches;
next	1.17;

1.17
date	2002.01.11.06.08.02;	author momjian;	state Exp;
branches;
next	1.16;

1.16
date	2002.01.11.04.39.19;	author momjian;	state Exp;
branches;
next	1.15;

1.15
date	2002.01.10.04.58.19;	author momjian;	state Exp;
branches;
next	1.14;

1.14
date	2002.01.09.21.50.51;	author momjian;	state Exp;
branches;
next	1.13;

1.13
date	2001.12.08.03.24.38;	author thomas;	state Exp;
branches;
next	1.12;

1.12
date	2000.12.25.23.15.26;	author petere;	state Exp;
branches;
next	1.11;

1.11
date	2000.07.22.02.39.10;	author momjian;	state Exp;
branches;
next	1.10;

1.10
date	2000.07.21.00.24.37;	author momjian;	state Exp;
branches;
next	1.9;

1.9
date	2000.03.27.17.14.43;	author thomas;	state Exp;
branches;
next	1.8;

1.8
date	99.09.28.15.59.10;	author momjian;	state Exp;
branches;
next	1.7;

1.7
date	99.09.28.03.41.35;	author momjian;	state Exp;
branches;
next	1.6;

1.6
date	99.07.31.22.05.48;	author tgl;	state Exp;
branches;
next	1.5;

1.5
date	99.07.22.15.09.13;	author thomas;	state Exp;
branches;
next	1.4;

1.4
date	99.07.06.17.16.40;	author thomas;	state Exp;
branches;
next	1.3;

1.3
date	99.05.27.16.29.02;	author momjian;	state Exp;
branches;
next	1.2;

1.2
date	98.10.25.02.47.35;	author momjian;	state Exp;
branches;
next	1.1;

1.1
date	98.10.15.05.47.03;	author momjian;	state Exp;
branches;
next	;


desc
@@


1.21
log
@Move pg_upgrade to /contrib.  Still need to make Peter's portability
changes.
@
text
@<!--
$Header: /cvsroot/pgsql/doc/src/sgml/ref/pg_upgrade.sgml,v 1.20 2002/01/13 01:13:59 momjian Exp $
PostgreSQL documentation
-->

<refentry id="APP-PG-UPGRADE">
 <refmeta>
  <refentrytitle id="APP-PG-UPGRADE-TITLE">
   <application>pg_upgrade</application>
  </refentrytitle>
  <manvolnum>1</manvolnum>
  <refmiscinfo>Application</refmiscinfo>
 </refmeta>
 <refnamediv>
  <refname>
   <application>pg_upgrade</application>
  </refname>
  <refpurpose>
   Allows upgrade from a previous release without reloading data
  </refpurpose>
 </refnamediv>
 <refsynopsisdiv>
  <refsynopsisdivinfo>
   <date>1999-07-31</date>
  </refsynopsisdivinfo>
  <cmdsynopsis>
   <command>pg_upgrade</command>
    <group choice="plain"><arg>-1</arg><arg>-2</arg></group>
  </cmdsynopsis>
 </refsynopsisdiv>

 <refsect1 id="R1-APP-PG-UPGRADE-1">
  <refsect1info>
   <date>1999-07-31</date>
  </refsect1info>
  <title>
   Description
  </title>

  <para>
   <application>pg_upgrade</application>
   is a utility for upgrading from a previous
   <productname>PostgreSQL</productname> release without reloading all the data.
   Not all <productname>PostgreSQL</productname> release transitions can be
   handled this way.  Check the release notes for details on your installation.
  </para>

  <procedure>
   <title>Upgrading <productname>PostgreSQL</productname> with pg_upgrade</title>

   <step performance="required">
    <para>
     Back up your existing data directory, preferably by making a
     complete dump with pg_dumpall.
    </para>
   </step>

   <step performance="required">
    <para>
     Copy the program <filename>pgsql/src/bin/pg_dump/pg_upgrade</filename>
     from the current PostgreSQL distribution into somewhere in your path.
    </para>
   </step>

   <step performance="required">
    <para>
     Change your working directory to the 
     pgsql main directory, and type:
     <programlisting>
$ pg_upgrade -1
     </programlisting>
     to collect information about the old database needed for the
     upgrade.
    </para>
   </step>

   <step performance="required">
    <para>
     Do:
     <programlisting>
$ make install
     </programlisting>
     to install the new binaries.
    </para>
   </step>

   <step performance="required">
    <para>
     Do:
     <programlisting>
$ cd pgsql/contrib/pg_resetxlog
$ make install
     </programlisting>
     to install the /contrib/pg_resetxlog utility 
     which will be used by pg_upgrade.
    </para>
   </step>

   <step performance="required">
    <para>
     Run <application>initdb</application> 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.
    </para>
   </step>

   <step performance="required">
    <para>
     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 <filename>pg_hba.conf</filename>
     temporarily.)
    </para>
   </step>

   <step performance="required">
    <para>
     Change your working directory to the 
     pgsql main directory, and type:
     <programlisting>
$ pg_upgrade -2
     </programlisting>
     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
     <filename>data.old/</filename> into the proper
     <filename>data/</filename> subdirectories, replacing the empty data files
     created during the db.out script.
    </para>
   </step>

   <step performance="required">
    <para>
     Restore your old <filename>pg_hba.conf</filename> if needed to allow
     user logins.
    </para>
   </step>

   <step performance="required">
    <para>
     <emphasis>Carefully</emphasis> 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 <filename>data.old/</filename> directory when you
     are satisfied.
    </para>
   </step>

   <step performance="required">
    <para>
     The upgraded databases will be in an un-vacuumed state.  You will probably
     want to run a <command>VACUUM ANALYZE</command> before beginning
     production work.
    </para>
   </step>
  </procedure>
 </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:
-->
@


1.20
log
@Wow, it actually worked for the regression database.  More testing needed.
@
text
@d2 1
a2 1
$Header: /cvsroot/pgsql/doc/src/sgml/ref/pg_upgrade.sgml,v 1.19 2002/01/11 20:48:47 momjian Exp $
@


1.19
log
@More man pages improvements;  also needed to test sgml build.
@
text
@d2 1
a2 1
$Header: /cvsroot/pgsql/doc/src/sgml/ref/pg_upgrade.sgml,v 1.18 2002/01/11 20:34:14 momjian Exp $
d26 4
a29 3
  <synopsis>
pg_upgrade -s <replaceable class="parameter">filename</replaceable> <replaceable class="parameter">old_data_dir</replaceable>
  </synopsis>
d60 2
a61 5
     Then do:
     <programlisting>
$ pg_dumpall -s > schema.out
     </programlisting>
     to dump out your old database's table definitions without any data.
d67 7
a73 15
     <command>VACUUM</command> your entire database using
     <command>vacuumdb -a</command.>
    </para>
   </step>

   <step performance="required">
    <para>
     Stop the old 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>.
d102 2
a103 1
     containing the system tables for the new release.
d110 1
a110 1
     to the database until the upgrade is complete.  You may wish to start
d121 1
a121 1
$ pg_upgrade -s schema.out data.old
d143 1
a143 1
     database.  If you detect problems, you'll need to recover by restoring
d152 1
a152 1
     The upgraded database will be in an un-vacuumed state.  You will probably
a156 7

   <note>
    <para>
     pg_upgrade does not handle custom tables/indexes/sequences in template1.
     It does handle other template1 object customizations.
    </para>
   </note>
@


1.18
log
@Sync up.
@
text
@d2 1
a2 1
$Header: /cvsroot/pgsql/doc/src/sgml/ref/pg_upgrade.sgml,v 1.17 2002/01/11 06:08:02 momjian Exp $
d94 12
@


1.17
log
@More cleanups.
@
text
@d2 1
a2 1
$Header: /cvsroot/pgsql/doc/src/sgml/ref/pg_upgrade.sgml,v 1.16 2002/01/11 04:39:19 momjian Exp $
d157 2
a158 1
     pg_upgrade does not migrate large objects.
@


1.16
log
@Handle int4-int8 sequence migration without full data dump.
@
text
@d2 1
a2 1
$Header: /cvsroot/pgsql/doc/src/sgml/ref/pg_upgrade.sgml,v 1.15 2002/01/10 04:58:19 momjian Exp $
d59 5
a63 2
     <command>VACUUM</command> your entire database using
     <command>vacuumdb -a</command.>
d69 2
a70 5
     Then do:
     <programlisting>
$ pg_dumpall -s > schema.out
     </programlisting>
     to dump out your old database's table definitions without any data.
@


1.15
log
@More pg_upgrade improvements.  Almost done, except for max transaction
setting.
@
text
@d2 1
a2 1
$Header: /cvsroot/pgsql/doc/src/sgml/ref/pg_upgrade.sgml,v 1.14 2002/01/09 21:50:51 momjian Exp $
d27 1
a27 1
pg_upgrade -s <replaceable class="parameter">filename</replaceable> [ -d <replaceable class="parameter">filename</replaceable> ] <replaceable class="parameter">old_data_dir</replaceable>
d53 8
a60 4
     complete dump with pg_dumpall. Those upgrading from 7.1 are
     required to supply this dump filename to pg_upgrade with the
     <option>-d</option> option. Other releases should not use the
     <option>-d</option> option.
d118 1
a118 1
$ pg_upgrade -s schema.out -d data.out data.old
a138 6
     Stop and restart the postmaster.
    </para>
   </step>

   <step performance="required">
    <para>
d155 5
@


1.14
log
@Update with new features.  Still disabled.
@
text
@d2 1
a2 1
$Header: /cvsroot/pgsql/doc/src/sgml/ref/pg_upgrade.sgml,v 1.13 2001/12/08 03:24:38 thomas Exp $
d53 4
a56 1
     complete dump with pg_dumpall.
@


1.13
log
@Use PostgreSQL consistantly throughout docs. Before, usage was split evenly
 between Postgres and PostgreSQL.
@
text
@d2 1
a2 1
$Header: /cvsroot/pgsql/doc/src/sgml/ref/pg_upgrade.sgml,v 1.12 2000/12/25 23:15:26 petere Exp $
d27 1
a27 1
pg_upgrade [ -f <replaceable class="parameter">filename</replaceable> ] <replaceable class="parameter">old_data_dir</replaceable>
d61 1
a61 1
$ pg_dumpall -s >db.out
d111 1
a111 1
$ pg_upgrade -f db.out data.old
@


1.12
log
@Refine some things to create better looking man pages.
@
text
@d2 2
a3 2
$Header: /home/projects/pgsql/cvsroot/pgsql/doc/src/sgml/ref/pg_upgrade.sgml,v 1.11 2000/07/22 02:39:10 momjian Exp $
Postgres documentation
d42 2
a43 2
   Postgres release without reloading all the data.
   Not all <productname>Postgres</productname> release transitions can be
d48 1
a48 1
   <title>Upgrading <productname>Postgres</productname> with pg_upgrade</title>
@


1.11
log
@Cleanups
@
text
@d2 1
a2 1
$Header: /home/projects/pgsql/cvsroot/pgsql/doc/src/sgml/ref/pg_upgrade.sgml,v 1.10 2000/07/21 00:24:37 momjian Exp $
d11 1
@


1.10
log
@Change prompt % to $.
@
text
@d2 1
a2 1
$Header: /home/projects/pgsql/cvsroot/pgsql/doc/src/sgml/ref/pg_upgrade.sgml,v 1.9 2000/03/27 17:14:43 thomas Exp $
d81 1
a81 1
     Do
@


1.9
log
@Start updating for the v7.0 release.
Use "generic functions" for math and other routines.
Use SQL92 "type 'literal'" syntax rather than Postgres "'literal'::type".
@
text
@d2 1
a2 1
$Header: /usr/local/cvsroot/pgsql/doc/src/sgml/ref/pg_upgrade.sgml,v 1.8 1999/09/28 15:59:10 momjian Exp $
d60 1
a60 1
% pg_dumpall -s >db.out
d83 1
a83 1
% make install
d110 1
a110 1
% pg_upgrade -f db.out data.old
@


1.8
log
@Recommend postmaster stop/start for pg_upgrade.
@
text
@d2 1
a2 1
$Header: /usr/local/cvsroot/pgsql/doc/src/sgml/ref/pg_upgrade.sgml,v 1.7 1999/09/28 03:41:35 momjian Exp $
d41 1
a41 1
   PostgreSQL release without reloading all the data.
@


1.7
log
@Reverse out last scan.l patch for minus handling.\
@
text
@d2 1
a2 1
$Header: /usr/local/cvsroot/pgsql/doc/src/sgml/ref/pg_upgrade.sgml,v 1.6 1999/07/31 22:05:48 tgl Exp $
d124 13
d140 2
a152 8
   <step performance="required">
    <para>
     Restart the postmaster and/or restore your old
     <filename>pg_hba.conf</filename> if needed to allow user logins.
     You can delete the <filename>data.old/</filename> directory when you
     are finished.
    </para>
   </step>
@


1.6
log
@Add some more verbiage to man page's directions for pg_upgrade.
@
text
@d2 1
a2 1
$Header: /usr/local/cvsroot/pgsql/doc/src/sgml/ref/pg_upgrade.sgml,v 1.5 1999/07/22 15:09:13 thomas Exp $
d43 1
a43 1
   handled this way; check the release notes for details on your installation.
d58 1
a58 1
     Do
@


1.5
log
@Complete merge of all old man page information.
ecpg reference page still needs formatting.
@
text
@d2 1
a2 1
$Header$
d23 1
a23 1
   <date>1999-07-20</date>
a25 1
pg_upgrade
d32 1
a32 1
   <date>1998-10-04</date>
d42 2
a43 2
   Not all <productname>Postgres</productname> releases can be handled 
   this way; check the release notes for details on your installation.
d47 1
a47 1
   <title>Upgrading <productname>Postgres</productname></title>
d51 2
a52 1
     Back up your data directory.
d58 1
a58 1
     Use:
d62 1
a62 2
     to dump out your old  database definitions without any
     data.  Stop the postmaster and all backends.
d68 7
a74 1
     Rename  (using mv) your old pgsql <filename>data/</filename> directory to
d81 5
a85 2
     Do a
     <command>make install</command> to install the new binaries.
d91 2
a92 2
     Run <application>initdb</application> to create a new template1 database containing the system
     tables for the new release.
d98 4
a101 1
     Start the new postmaster.
d112 15
a126 5
     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.
d132 3
a134 1
     <emphasis>Carefully</emphasis> examine the contents of the upgraded database.
d140 2
@


1.4
log
@Fix markup for docbook2man man page generation.
No big deal; fixed lots of other markup at the same time.
Bigest change: make sure there is no whitespace
 in front of <term> contents.
This will probably help the other output types too.
@
text
@d1 5
d8 1
a8 1
  <refentrytitle>
d20 1
d23 1
a23 1
   <date>1998-10-04</date>
d38 1
d43 3
d120 2
@


1.3
log
@Make pg_dump dump ACL's by default, print warning on use of -z, and add
new -x option to skip acl dump.
@
text
@d1 19
a19 19
<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>
d21 3
a23 2
pg_upgrade [-f <replaceable class="parameter">input_file</replaceable>] <replaceable class="parameter">old_data_dir</replaceable>
</SYNOPSIS>
d25 25
a49 13
<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.  First,
 to be safe, back up your data directory.  Then, use:
<programlisting>
d51 38
a88 12
</programlisting>
to dump out your old  database definitions without any
data.  Stop the postmaster and all backends.
</para>

<para>
Then  rename  (using mv) your old pgsql /data directory to
/data.old and do a make install to install the new binaries.
Run initdb to create a new template1 database containing the system
tables for the new release.  Start the new postmaster, cd to the 
pgsql main directory, and type:
<programlisting>
d90 39
a128 9
</programlisting>
The  system  will do some checking to make sure everything
is properly configured, and 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 /data.old
into  the  proper /data directory.  You can then check out
the data.  You can delete the /data.old directory when you
are finished.
</REFENTRY>
@


1.2
log
@Fix from Tom Lane for pg_shadow in pg_upgrade
@
text
@d37 1
a37 1
% pg_dumpall -s -z >db.out
@


1.1
log
@SGML updates from post 6.3.2 manual changes.  Added pg_upgrade man page.
@
text
@d37 1
a37 1
% pg_dumpall -s >db.out
@

