Sophie

Sophie

distrib > Mandriva > 2006.0 > x86_64 > by-pkgid > b8f4049de69feba5041d49ed4382e582 > files > 221

postgresql-docs-8.0.11-0.1.20060mdk.x86_64.rpm

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<HTML
><HEAD
><TITLE
>If You Are Upgrading</TITLE
><META
NAME="GENERATOR"
CONTENT="Modular DocBook HTML Stylesheet Version 1.79"><LINK
REV="MADE"
HREF="mailto:pgsql-docs@postgresql.org"><LINK
REL="HOME"
TITLE="PostgreSQL 8.0.11 Documentation"
HREF="index.html"><LINK
REL="UP"
TITLE="  Installation Instructions"
HREF="installation.html"><LINK
REL="PREVIOUS"
TITLE="Getting The Source"
HREF="install-getsource.html"><LINK
REL="NEXT"
TITLE="Installation Procedure"
HREF="install-procedure.html"><LINK
REL="STYLESHEET"
TYPE="text/css"
HREF="stylesheet.css"><META
HTTP-EQUIV="Content-Type"
CONTENT="text/html; charset=ISO-8859-1"><META
NAME="creation"
CONTENT="2007-02-02T03:57:22"></HEAD
><BODY
CLASS="SECT1"
><DIV
CLASS="NAVHEADER"
><TABLE
SUMMARY="Header navigation table"
WIDTH="100%"
BORDER="0"
CELLPADDING="0"
CELLSPACING="0"
><TR
><TH
COLSPAN="5"
ALIGN="center"
VALIGN="bottom"
>PostgreSQL 8.0.11 Documentation</TH
></TR
><TR
><TD
WIDTH="10%"
ALIGN="left"
VALIGN="top"
><A
HREF="install-getsource.html"
ACCESSKEY="P"
>Prev</A
></TD
><TD
WIDTH="10%"
ALIGN="left"
VALIGN="top"
><A
HREF="installation.html"
>Fast Backward</A
></TD
><TD
WIDTH="60%"
ALIGN="center"
VALIGN="bottom"
>Chapter 14. Installation Instructions</TD
><TD
WIDTH="10%"
ALIGN="right"
VALIGN="top"
><A
HREF="installation.html"
>Fast Forward</A
></TD
><TD
WIDTH="10%"
ALIGN="right"
VALIGN="top"
><A
HREF="install-procedure.html"
ACCESSKEY="N"
>Next</A
></TD
></TR
></TABLE
><HR
ALIGN="LEFT"
WIDTH="100%"></DIV
><DIV
CLASS="SECT1"
><H1
CLASS="SECT1"
><A
NAME="INSTALL-UPGRADING"
>14.4. If You Are Upgrading</A
></H1
><A
NAME="AEN15176"
></A
><P
>   The internal data storage format changes with new releases of
   <SPAN
CLASS="PRODUCTNAME"
>PostgreSQL</SPAN
>. Therefore, if you are upgrading an
   existing installation that does not have a version number
   <SPAN
CLASS="QUOTE"
>"8.0.x"</SPAN
>, you must back up and restore your
   data as shown here. These instructions assume that your existing
   installation is under the <TT
CLASS="FILENAME"
>/usr/local/pgsql</TT
> directory,
   and that the data area is in <TT
CLASS="FILENAME"
>/usr/local/pgsql/data</TT
>.
   Substitute your paths appropriately.
  </P
><DIV
CLASS="PROCEDURE"
><OL
TYPE="1"
><LI
CLASS="STEP"
><P
>     Make sure that your database is not updated during or after the
     backup. This does not affect the integrity of the backup, but the
     changed data would of course not be included. If necessary, edit
     the permissions in the file
     <TT
CLASS="FILENAME"
>/usr/local/pgsql/data/pg_hba.conf</TT
> (or equivalent) to
     disallow access from everyone except you.
    </P
></LI
><LI
CLASS="STEP"
><P
>     <A
NAME="AEN15189"
></A
>

     To back up your database installation, type:
</P><PRE
CLASS="SCREEN"
><KBD
CLASS="USERINPUT"
>pg_dumpall &gt; <TT
CLASS="REPLACEABLE"
><I
>outputfile</I
></TT
></KBD
></PRE
><P>
     If you need to preserve OIDs (such as when using them as
     foreign keys), then use the <TT
CLASS="OPTION"
>-o</TT
> option when running
     <SPAN
CLASS="APPLICATION"
>pg_dumpall</SPAN
>.
    </P
><P
>     <SPAN
CLASS="APPLICATION"
>pg_dumpall</SPAN
> does not
     save large objects.  Check
     
     <A
HREF="backup.html#BACKUP-DUMP-CAVEATS"
>Section 22.1.4</A
>
     if you need to do this.
    </P
><P
>     To make the backup, you can use the <SPAN
CLASS="APPLICATION"
>pg_dumpall</SPAN
>
     command from the version you are currently running.  For best
     results, however, try to use the <SPAN
CLASS="APPLICATION"
>pg_dumpall</SPAN
>
     command from <SPAN
CLASS="PRODUCTNAME"
>PostgreSQL</SPAN
> 8.0.11,
     since this version contains bug fixes and improvements over older
     versions.  While this advice might seem idiosyncratic since you
     haven't installed the new version yet, it is advisable to follow
     it if you plan to install the new version in parallel with the
     old version.  In that case you can complete the installation
     normally and transfer the data later.  This will also decrease
     the downtime.
    </P
></LI
><LI
CLASS="STEP"
><P
>     If you are installing the new version at the same location as the
     old one then shut down the old server, at the latest before you
     install the new files:
</P><PRE
CLASS="SCREEN"
><KBD
CLASS="USERINPUT"
>pg_ctl stop</KBD
></PRE
><P>
     On systems that have <SPAN
CLASS="PRODUCTNAME"
>PostgreSQL</SPAN
> started at boot time,
     there is probably a start-up file that will accomplish the same thing. For
     example, on a <SPAN
CLASS="SYSTEMITEM"
>Red Hat Linux</SPAN
> system one
     might find that
</P><PRE
CLASS="SCREEN"
><KBD
CLASS="USERINPUT"
>/etc/rc.d/init.d/postgresql stop</KBD
></PRE
><P>
     works.
    </P
><P
>     Very old versions might not have <SPAN
CLASS="APPLICATION"
>pg_ctl</SPAN
>.  If you
     can't find it or it doesn't work, find out the process ID of the
     old server, for example by typing
</P><PRE
CLASS="SCREEN"
><KBD
CLASS="USERINPUT"
>ps ax | grep postmaster</KBD
></PRE
><P>
     and signal it to stop this way:
</P><PRE
CLASS="SCREEN"
><KBD
CLASS="USERINPUT"
>kill -INT <TT
CLASS="REPLACEABLE"
><I
>processID</I
></TT
></KBD
></PRE
><P>
    </P
></LI
><LI
CLASS="STEP"
><P
>     If you are installing in the same place as the old version then
     it is also a good idea to move the old installation out of the
     way, in case you have trouble and need to revert to it.
     Use a command like this:
</P><PRE
CLASS="SCREEN"
><KBD
CLASS="USERINPUT"
>mv /usr/local/pgsql /usr/local/pgsql.old</KBD
></PRE
><P>
    </P
></LI
></OL
></DIV
><P
>   After you have installed <SPAN
CLASS="PRODUCTNAME"
>PostgreSQL</SPAN
> 8.0.11, create a new database
   directory and start the new server. Remember that you must execute
   these commands while logged in to the special database user account
   (which you already have if you are upgrading).
</P><PRE
CLASS="PROGRAMLISTING"
><KBD
CLASS="USERINPUT"
>/usr/local/pgsql/bin/initdb -D /usr/local/pgsql/data</KBD
>
<KBD
CLASS="USERINPUT"
>/usr/local/pgsql/bin/postmaster -D /usr/local/pgsql/data</KBD
></PRE
><P>
   Finally, restore your data with
</P><PRE
CLASS="SCREEN"
><KBD
CLASS="USERINPUT"
>/usr/local/pgsql/bin/psql -d template1 -f <TT
CLASS="REPLACEABLE"
><I
>outputfile</I
></TT
></KBD
></PRE
><P>
   using the <SPAN
CLASS="emphasis"
><I
CLASS="EMPHASIS"
>new</I
></SPAN
> <SPAN
CLASS="APPLICATION"
>psql</SPAN
>.
  </P
><P
>   Further discussion appears in
   
   <A
HREF="migration.html"
>Section 22.4</A
>,
   which you are encouraged to read in any case.
  </P
></DIV
><DIV
CLASS="NAVFOOTER"
><HR
ALIGN="LEFT"
WIDTH="100%"><TABLE
SUMMARY="Footer navigation table"
WIDTH="100%"
BORDER="0"
CELLPADDING="0"
CELLSPACING="0"
><TR
><TD
WIDTH="33%"
ALIGN="left"
VALIGN="top"
><A
HREF="install-getsource.html"
ACCESSKEY="P"
>Prev</A
></TD
><TD
WIDTH="34%"
ALIGN="center"
VALIGN="top"
><A
HREF="index.html"
ACCESSKEY="H"
>Home</A
></TD
><TD
WIDTH="33%"
ALIGN="right"
VALIGN="top"
><A
HREF="install-procedure.html"
ACCESSKEY="N"
>Next</A
></TD
></TR
><TR
><TD
WIDTH="33%"
ALIGN="left"
VALIGN="top"
>Getting The Source</TD
><TD
WIDTH="34%"
ALIGN="center"
VALIGN="top"
><A
HREF="installation.html"
ACCESSKEY="U"
>Up</A
></TD
><TD
WIDTH="33%"
ALIGN="right"
VALIGN="top"
>Installation Procedure</TD
></TR
></TABLE
></DIV
></BODY
></HTML
>