1- <!-- $PostgreSQL: pgsql/doc/src/sgml/pgupgrade.sgml,v 1.6 2010/05/19 20:20:38 momjian Exp $ -->
1+ <!-- $PostgreSQL: pgsql/doc/src/sgml/pgupgrade.sgml,v 1.7 2010/05/19 20:37:03 momjian Exp $ -->
22
33<sect1 id="pgupgrade">
44 <title>pg_upgrade</title>
99
1010 <para>
1111 <application>pg_upgrade</> (formerly called pg_migrator) allows data
12- stored inPostgres data files to be migrated to a laterPostgres
12+ stored in<productname>PostgreSQL</> data files to be migrated to a later<productname>PostgreSQL</>
1313 major version without the data dump/reload typically required for
1414 major version upgrades, e.g. from 8.4.7 to the current major release
15- ofPostgres . It is not required for minor version upgrades, e.g.
15+ of<productname>PostgreSQL</> . It is not required for minor version upgrades, e.g
1616 9.0.1 -> 9.0.4.
1717 </para>
1818
2121
2222 <para>
2323 pg_upgrade supports upgrades from 8.3.X and later to the current
24- major release ofPostgres , including snapshot and alpha releases.
24+ major release of<productname>PostgreSQL</> , including snapshot and alpha releases.
2525
2626 </para>
2727
140140 </para>
141141
142142 <para>
143- If you are using a version-specificPostgreSQL install directory, e.g.
143+ If you are using a version-specificinstallation directory, e.g.
144144 /opt/PostgreSQL/8.4, you do not need to move the old cluster. The
145145 one-click installers all use version-specific install directories.
146146 </para>
147147
148148 <para>
149- If yourPostgreSQL install directory is not version-specific, e.g.
150- /usr/local/pgsql, it is necessary to move the currentPostgres install
151- directory so it does not interfere with the newPostgres installation.
152- Once the currentPostgres server is shut down, it is safe to rename the
153- Postgres install directory; assuming the old directory is
149+ If yourinstallation directory is not version-specific, e.g.
150+ /usr/local/pgsql, it is necessary to move the currentPostgreSQL install
151+ directory so it does not interfere with the new<productname>PostgreSQL</> installation.
152+ Once the current<productname>PostgreSQL</> server is shut down, it is safe to rename the
153+ PostgreSQL install directory; assuming the old directory is
154154 /usr/local/pgsql, you can do:
155155
156156<programlisting>
@@ -161,26 +161,26 @@ mv /usr/local/pgsql /usr/local/pgsql.old
161161
162162 <para>
163163 If you are using tablespaces and migrating to 8.4 or earlier, there must
164- be sufficient directory permissions to allow pg_upgrade to rename each
164+ be sufficient directory permissions to allow<application> pg_upgrade</> to rename each
165165 tablespace directory to add a ".old" suffix.
166166 </para>
167167 </listitem>
168168
169169 <listitem>
170170 <para>
171- ForPostgreSQL source installs, build the new PostgreSQL version
171+ For source installs, build the new version
172172 </para>
173173
174174 <para>
175- Build the newPostgres source with configure flags that are compatible
176- with the old cluster. pg_upgrade will check pg_controldata to make
175+ Build the newPostgreSQL source with configure flags that are compatible
176+ with the old cluster.<application> pg_upgrade</> will check<command> pg_controldata</> to make
177177 sure all settings are compatible before starting the upgrade.
178178 </para>
179179 </listitem>
180180
181181 <listitem>
182182 <para>
183- Install the newPostgres binaries
183+ Install the newPostgreSQL binaries
184184 </para>
185185
186186 <para>
@@ -212,8 +212,10 @@ gmake prefix=/usr/local/pgsql.new install
212212 </para>
213213
214214 <para>
215- Initialize the new cluster using initdb. Again, use compatible initdb
216- flags that match the old cluster (pg_upgrade will check that too.) Many
215+ Initialize the new cluster <xref
216+ linkend="app-initdb">,<indexterm><primary>initdb</></>.
217+ Again, use compatible initdb
218+ flags that match the old cluster. Many
217219 prebuilt installers do this step automatically. There is no need to
218220 start the new cluster.
219221 </para>
@@ -242,8 +244,8 @@ gmake prefix=/usr/local/pgsql.new install
242244 pg_upgrade will connect to the old and new servers several times,
243245 so you might want to set authentication to <literal>trust</> in
244246 <filename>pg_hba.conf</>, or if using <literal>md5</> authentication,
245- use a <filename>pgpass</> fileto avoid being prompted repeatedly
246- for a password.
247+ use a <filename>~/. pgpass</> file(see <xref linkend="libpq-pgpass">)
248+ to avoid being prompted repeatedly for a password.
247249 </para>
248250 </listitem>
249251
@@ -270,20 +272,20 @@ NET STOP postgresql-9.0
270272 or
271273
272274<programlisting>
273- NET STOP pgsql-8.3 (different service name)
275+ NET STOP pgsql-8.3 (<productname>PostgreSQL</> 8.3 and older used a different service name)
274276</programlisting>
275277 </para>
276278 </listitem>
277279
278280 <listitem>
279281 <para>
280- Run pg_upgrade
282+ Run<application> pg_upgrade</>
281283 </para>
282284
283285 <para>
284- Always run the pg_upgrade binary in the new server, not the old one.
285- pg_upgrade requires the specification of the old and new cluster's
286- PGDATA and executable (/bin) directories. You can also specify separate
286+ Always run the<application> pg_upgrade</> binary in the new server, not the old one.
287+ <application> pg_upgrade</> requires the specification of the old and new cluster's
288+ <varname> PGDATA</> and executable (/bin) directories. You can also specify separate
287289 user and port values, and whether you want the data linked instead of
288290 copied (the default). If you use linking, the migration will be much
289291 faster (no data copying), but you will no longer be able to access your
@@ -300,7 +302,7 @@ RUNAS /USER:postgres "CMD.EXE"
300302SET PATH=%PATH%;C:\Program Files\PostgreSQL\9.0\bin;
301303</programlisting>
302304
303- and then run pg_upgrade with quoted directories, e.g.:
305+ and then run<application> pg_upgrade</> with quoted directories, e.g.:
304306
305307<programlisting>
306308pg_upgrade.exe
@@ -362,25 +364,28 @@ psql --username postgres --file script.sql postgres
362364 The scripts can be run in any order and can be deleted once they have
363365 been run.
364366 </para>
365-
367+
368+ <caution>
366369 <para>
367370 In general it is unsafe to access tables referenced in rebuild scripts
368371 until the rebuild scripts have run to completion; doing so could yield
369372 incorrect results or poor performance. Tables not referenced in rebuild
370373 scripts can be accessed immediately.
371374 </para>
375+ </caution>
372376 </listitem>
373377
374378 <listitem>
375379 <para>
376380 Statistics
377381 </para>
378-
382+ <caution>
379383 <para>
380384 Because optimizer statistics are not transferred by pg_upgrade, you will
381385 be instructed to run a command to regenerate that information at the end
382386 of the migration.
383387 </para>
388+ </caution>
384389 </listitem>
385390
386391 <listitem>
@@ -437,7 +442,7 @@ psql --username postgres --file script.sql postgres
437442 </sect2>
438443
439444 <sect2>
440- <title>LimitationsIn Migrating <emphasis>from</> PostgreSQL 8.3</title>
445+ <title>Limitationsin migrating <emphasis>from</> PostgreSQL 8.3</title>
441446
442447
443448 <para>
@@ -490,7 +495,7 @@ psql --username postgres --file script.sql postgres
490495
491496 <para>
492497 Also, the default datetime storage format changed to integer after
493- Postgres 8.3. pg_upgrade will check that the datetime storage format
498+ <productname>PostgreSQL</> 8.3. pg_upgrade will check that the datetime storage format
494499 used by the old and new clusters match. Make sure your new cluster is
495500 built with the configure flag <option>--disable-integer-datetimes</>.
496501 </para>
@@ -504,7 +509,7 @@ psql --username postgres --file script.sql postgres
504509 </para>
505510
506511 <para>
507- All failure, rebuild, and reindex cases will be reported by pg_upgrade
512+ All failure, rebuild, and reindex cases will be reported by<application> pg_upgrade</>
508513 if they affect your installation; post-migration scripts to rebuild
509514 tables and indexes will be automatically generated.
510515 </para>